Beispiel #1
0
void CDropListBox::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	//Click in the client area?
	CRect rcClient;
	GetClientRect( rcClient );
	if( !rcClient.PtInRect( point ) )
	{
		ReleaseCapture();
		GetParent()->SendMessage( WM_VRC_SETCAPTURE );
	}

	int nPos = PointTest(point);
	if(nPos != LB_ERR)
	{
		PLIST_ITEM pItem = (PLIST_ITEM)GetItemDataPtr(nPos);
		if((int)pItem != -1 && pItem != NULL)
		{
			if(pItem->state & ACBIS_DISABLED)
			{
				return;
			}
			if(pItem->GetChildCount() > 0)
			{
				Expand(pItem, LBE_TOGGLE);
				return;
			}
		}
	}
	CListBox::OnLButtonDblClk(nFlags, point);
}
Beispiel #2
0
void CDropListBox::OnLButtonDown(UINT nFlags, CPoint point) 
{
	//Click in the client area?
	CRect rcClient;
	GetClientRect( rcClient );
	if( !rcClient.PtInRect( point ) )
	{
		ReleaseCapture();
		GetParent()->SendMessage( WM_VRC_SETCAPTURE );
	}

	//Click on the disabled item is disallowed
	int nPos = PointTest(point);

	if(nPos != LB_ERR)
	{
		PLIST_ITEM pItem = (PLIST_ITEM)GetItemDataPtr(nPos);
		if((DWORD)pItem != -1 && pItem != NULL && (pItem->state & ACBIS_DISABLED))
		{
			return;
		}
	}

	//Get current selected item
	nPos = GetCurSel();

	if(nPos != LB_ERR)
	{
		PLIST_ITEM pItem = (PLIST_ITEM)GetItemDataPtr(nPos);
		if((DWORD)pItem != -1 && pItem != NULL && (pItem->state & ACBIS_DISABLED))
		{
			return;
		}

		//parent node can not be selected
		if(pItem->GetChildCount() > 0)
		{
			CRect rcItem;
			GetItemRect(nPos, &rcItem);
			if(PointTestState(point, rcItem))
			{
				Expand(pItem, LBE_TOGGLE);
			}
			return;
		}

		//send current selection to combobox
		m_pComboParent->PostMessage( WM_SELECTED_ITEM, (WPARAM)nPos, 0 );
	}

	//Destroy the dropdown list
	ReleaseCapture();
	m_pComboParent->PostMessage( WM_DESTROY_DROPLIST );

	//
	// Return so that the listbox can be destroyed
//	CListBox::OnLButtonDown(nFlags, point);
}
Beispiel #3
0
int main()
{	
  PointTest();
  //VectorTest();
  //TrianglePointInsideTest();
  //TriangleIntersectLineGreen();
  //TriangleIntersectLineRed();
  //PlaneIntersectLine();
  //DistancePointToLine();
  //ClosestPointOnLine();
  return 0;
}
Beispiel #4
0
void CDropListBox::OnMouseMove(UINT nFlags, CPoint point) 
{
	//
	// Is mouse within listbox
	CRect rcClient;
	GetClientRect( rcClient );
	if( !rcClient.PtInRect( point ) )
	{
		ReleaseCapture();
		GetParent()->SendMessage( WM_VRC_SETCAPTURE );
	}

	//
	// Set selection item under mouse
	int nPos = PointTest(point);
	PLIST_ITEM pItem = (PLIST_ITEM)GetItemDataPtr(nPos);
	if( nPos != LB_ERR && (DWORD)pItem != -1 && pItem != NULL)
	{
		if( GetCurSel() != nPos && !(pItem->state & ACBIS_DISABLED) )
		{
			SetCurSel( nPos );
		}
	}

	//
	// Check if we have auto scrolled
	if( m_nLastTopIdx != GetTopIndex() )
	{
		int nDiff = m_nLastTopIdx - GetTopIndex();
		m_nLastTopIdx = GetTopIndex();

		SCROLLINFO info;
		info.cbSize = sizeof(SCROLLINFO);
		if( m_pDropWnd->GetScrollBarPtr()->GetScrollInfo( &info, SIF_ALL|SIF_DISABLENOSCROLL ) )
		{
			info.nPos = m_nLastTopIdx;
			m_pDropWnd->GetScrollBarPtr()->SetScrollInfo( &info );
		}
	}

	CListBox::OnMouseMove(nFlags, point);
}