Example #1
0
void CShaderLibView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	CTreeCtrl* pWndTree = (CTreeCtrl*) &m_wndShaderLibView;
	ASSERT_VALID(pWndTree);

	if (pWnd != pWndTree)
	{
		CWnd::OnContextMenu(pWnd, point);
		return;
	}

	if (point != CPoint(-1, -1))
	{
		// Select clicked item:
		CPoint ptTree = point;
		pWndTree->ScreenToClient(&ptTree);

		UINT flags = 0;
		HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags);
		if (hTreeItem != NULL)
		{
			pWndTree->SelectItem(hTreeItem);
		}
	}

	pWndTree->SetFocus();
	( (CWinAppEx*)AfxGetApp())->GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EXPLORER, point.x, point.y, this, TRUE);
}
Example #2
0
void CFileView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	CTreeCtrl* pWndTree = (CTreeCtrl*) &m_wndFileView;
	ASSERT_VALID(pWndTree);

	if (pWnd != pWndTree)
	{
		CDockablePane::OnContextMenu(pWnd, point);
		return;
	}

	if (point != CPoint(-1, -1))
	{
		// 选择已单击的项:
		CPoint ptTree = point;
		pWndTree->ScreenToClient(&ptTree);

		UINT flags = 0;
		HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags);
		if (hTreeItem != NULL)
		{
			pWndTree->SelectItem(hTreeItem);
		}
	}

	pWndTree->SetFocus();
	theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EXPLORER, point.x, point.y, this, TRUE);
}
Example #3
0
// @pymethod (int, int)|PyCTreeCtrl|HitTest|Determines which tree view item, if any, is at a specified position.
PyObject *PyCTreeCtrl_HitTest( PyObject *self, PyObject *args )
{
	CTreeCtrl *pList = GetTreeCtrl(self);
	if (!pList) return NULL;
	TVHITTESTINFO i;
	memset(&i, 0, sizeof(i));
	// @pyparm point|x,y||The point to test.
	if (!PyArg_ParseTuple( args, "(ii):HitTest", &i.pt.x, &i.pt.y))
		return NULL;
	GUI_BGN_SAVE;
	pList->HitTest( &i );
	GUI_END_SAVE;
	return Py_BuildValue("iN", i.flags, PyWinLong_FromHANDLE(i.hItem));
	// @rdesc The result is a tuple of (flags, hItem).
	// flags may be a combination of the following values:
	// @flagh Value|Description
	// @flag commctrl.TVHT_ABOVE|Above the client area.  
	// @flag commctrl.TVHT_BELOW|Below the client area.  
	// @flag commctrl.TVHT_NOWHERE|In the client area, but below the last item.  
	// @flag commctrl.TVHT_ONITEM|On the bitmap or label associated with an item.  
	// @flag commctrl.TVHT_ONITEMBUTTON|On the button associated with an item.  
	// @flag commctrl.TVHT_ONITEMICON|On the bitmap associated with an item.  
	// @flag commctrl.TVHT_ONITEMINDENT|In the indentation associated with an item.  
	// @flag commctrl.TVHT_ONITEMLABEL|On the label (string) associated with an item.  
	// @flag commctrl.TVHT_ONITEMRIGHT|In the area to the right of an item.  
	// @flag commctrl.TVHT_ONITEMSTATEICON|On the state icon for a tree view item that is in a user-defined state.  
	// @flag commctrl.TVHT_TOLEFT|To the left of the client area.  
	// @flag commctrl.TVHT_TORIGHT|To the right of the client area.  
}
Example #4
0
void CClassView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndClassView;
	ASSERT_VALID(pWndTree);

	if (pWnd != pWndTree)
	{
		CDockablePane::OnContextMenu(pWnd, point);
		return;
	}

	if (point != CPoint(-1, -1))
	{
		// 选择已单击的项:
		CPoint ptTree = point;
		pWndTree->ScreenToClient(&ptTree);

		UINT flags = 0;
		HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags);
		if (hTreeItem != NULL)
		{
			pWndTree->SelectItem(hTreeItem);
		}
	}

	pWndTree->SetFocus();
	CMenu menu;
	menu.LoadMenu(IDR_POPUP_SORT);

	CMenu* pSumMenu = menu.GetSubMenu(0);

	if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx)))
	{
		CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu;

		if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE))
			return;

		((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu);
		UpdateDialogControls(this, FALSE);
	}
}
Example #5
0
void CSiteView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndSiteView;
	ASSERT_VALID(pWndTree);

	if (pWnd != pWndTree)
	{
		CDockablePane::OnContextMenu(pWnd, point);
		return;
	}

	if (point != CPoint(-1, -1))
	{
		// Select clicked item:
		CPoint ptTree = point;
		pWndTree->ScreenToClient(&ptTree);

		UINT flags = 0;
		HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags);
		if (hTreeItem != NULL)
		{
			pWndTree->SelectItem(hTreeItem);
		}
	}
	HTREEITEM item = pWndTree->GetSelectedItem();
	TREE_T * item_data = (TREE_T*)pWndTree->GetItemData(item);
	pWndTree->SetFocus();

	if (item_data == NULL)
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_ROOT, point.x, point.y, this, TRUE);
	else if (item_data->tree_level == TREE_LEVEL_SITE)
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_SITES, point.x, point.y, this, TRUE);
	else if (item_data->tree_level == TREE_LEVEL_RECORDER)
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_RECORDER, point.x, point.y, this, TRUE);
	else if (item_data->tree_level==TREE_LEVEL_CAMERA)
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_CAMERA, point.x, point.y, this, TRUE);

}
Example #6
0
void CuListCtrlLoggedEvent::OnButtonUp(CPoint point)
{
	try
	{
		UINT flags = 0;
		UINT nFlags = 0;
		CPoint p = point;
		ClientToScreen (&p);

		if (!m_bDragging)
			return;
		m_bDragging = FALSE;

		ASSERT(m_pImageListDrag != NULL);
		m_pImageListDrag->DragLeave(GetParentFrame());
		m_pImageListDrag->EndDrag();
		delete m_pImageListDrag;
		m_pImageListDrag = NULL;

		if (m_iItemDrag == -1)
			return;

		//
		// Determine the pane under the mouse pointer:
		CRect rFrame, rLeftTree, rRightTree, rBottomList;
		m_pEventSettingFrame->GetWindowRect (rFrame);

		CvEventSettingLeft*   pLeftView  = m_pEventSettingFrame->GetLeftView();
		CvEventSettingRight*  pRightView = m_pEventSettingFrame->GetRightView();
		CvEventSettingBottom* pBottomView= m_pEventSettingFrame->GetBottomView();
		if (!(pLeftView && pRightView && pBottomView))
			return;
		CTreeCtrl* pTreeLeft  = pLeftView->GetTreeCtrl();
		CTreeCtrl* pTreeRight = pRightView->GetTreeCtrl();
		CListCtrl* pListBottom= pBottomView->GetListCtrl();
		if (!(pTreeLeft && pTreeRight && pListBottom))
			return;

		pTreeLeft->GetWindowRect  (rLeftTree);
		pTreeRight->GetWindowRect (rRightTree);
		pListBottom->GetWindowRect(rBottomList);
		
		CWnd* pWndTarget = NULL;
		CPoint cursorPos;
		GetCursorPos (&cursorPos);

		int nPane = 0;
		if (rFrame.PtInRect (cursorPos))
		{
			if (rLeftTree.PtInRect (cursorPos))
			{
				pWndTarget = pTreeLeft;
				nPane = 1;
			}
			else
			if (rRightTree.PtInRect (cursorPos))
			{
				pWndTarget = pTreeRight;
				nPane = 2;
			}
			else
			if (rBottomList.PtInRect (cursorPos))
			{
				pWndTarget = pListBottom;
				nPane = 3;
			}
		}

		if (nPane == 1 || nPane == 2)
		{
			CTreeCtrl* pTree = NULL;
			CListCtrl* pListCtrl = pListBottom; 

			if (nPane == 1)
				pTree = pTreeLeft;
			else
				pTree = pTreeRight;

			UINT flags, nAction = 0;
			HTREEITEM hTreeItemTarget = NULL;
			CaMessageNode* pNodeTarget = NULL;
			CPoint pt = point;
			pt.y += 8;
			ClientToScreen (&pt);

			pTree->ScreenToClient(&pt);
			hTreeItemTarget = pTree->HitTest (pt, &flags);
			if (hTreeItemTarget && (flags&TVHT_ONITEM))
			{
				pTree->SelectItem (hTreeItemTarget);
				pNodeTarget = (CaMessageNode*)pTree->GetItemData (hTreeItemTarget);

				nAction = GetCompatibleSourceTarget(pTree, pNodeTarget->GetNodeInformation());
				NewUserMessage (nPane, nAction, pTree, pNodeTarget, pListCtrl);
			}
		}
	}
	catch (...)
	{
		TRACE0 ("Internal error(1): CuListCtrlLoggedEvent::OnButtonUp \n");
	}
	::ReleaseCapture();
}
Example #7
0
void CuListCtrlLoggedEvent::OnMouseMove(UINT nFlags, CPoint point) 
{
	CPoint p = point;
	ClientToScreen (&p);
	CPoint pDragMove = p;

	if (!m_pEventSettingFrame)
		m_pEventSettingFrame = (CfEventSetting*)GetParentFrame();
	ASSERT (m_pEventSettingFrame);
	if (!m_pEventSettingFrame)
	{
		CuListCtrlVScrollEvent::OnMouseMove(nFlags, point);
		return;
	}
	m_pEventSettingFrame->ScreenToClient(&pDragMove);

	if (!m_bDragging)
	{
		CuListCtrlVScrollEvent::OnMouseMove(nFlags, point);
		return;
	}
	
	ASSERT(m_pImageListDrag != NULL);
	m_pImageListDrag->DragMove(pDragMove);  // move the image
	m_pImageListDrag->DragLeave(/*this*/GetParentFrame());

	//
	// Determine the pane under the mouse pointer:
	CRect rFrame, rLeftTree, rRightTree, rBottomList;
	m_pEventSettingFrame->GetWindowRect (rFrame);

	CvEventSettingLeft*   pLeftView  = m_pEventSettingFrame->GetLeftView();
	CvEventSettingRight*  pRightView = m_pEventSettingFrame->GetRightView();
	CvEventSettingBottom* pBottomView= m_pEventSettingFrame->GetBottomView();
	if (!(pLeftView && pRightView && pBottomView))
	{
		CuListCtrlVScrollEvent::OnMouseMove(nFlags, point);
		return;
	}
	CTreeCtrl* pTreeLeft  = pLeftView->GetTreeCtrl();
	CTreeCtrl* pTreeRight = pRightView->GetTreeCtrl();
	CListCtrl* pListBottom= pBottomView->GetListCtrl();
	if (!(pTreeLeft && pTreeRight && pListBottom))
	{
		CuListCtrlVScrollEvent::OnMouseMove(nFlags, point);
		return;
	}

	pTreeLeft->GetWindowRect  (rLeftTree);
	pTreeRight->GetWindowRect (rRightTree);
	pListBottom->GetWindowRect(rBottomList);
	
	CWnd* pWndTarget = NULL;
	CPoint cursorPos;
	GetCursorPos (&cursorPos);

	int nPane = 0;
	if (rFrame.PtInRect (cursorPos))
	{
		if (rLeftTree.PtInRect (cursorPos))
		{
			pWndTarget = pTreeLeft;
			nPane = 1;
		}
		else
		if (rRightTree.PtInRect (cursorPos))
		{
			pWndTarget = pTreeRight;
			nPane = 2;
		}
		else
		if (rBottomList.PtInRect (cursorPos))
		{
			pWndTarget = pListBottom;
			nPane = 3;
		}
	}

	if (nPane == 1 || nPane == 2)
	{
		CTreeCtrl* pTree = NULL;
		if (nPane == 1)
			pTree = pTreeLeft;
		else
			pTree = pTreeRight;

		UINT flags, nAction = 0;
		HTREEITEM hTreeItemTarget = NULL;
		CaMessageNode* pNodeTarget = NULL;
		CPoint pt = point;
		pt.y += 8;
		ClientToScreen (&pt);

		pTree->ScreenToClient(&pt);
		hTreeItemTarget = pTree->HitTest (pt, &flags);
		if (hTreeItemTarget && (flags&TVHT_ONITEM))
		{
			pTree->SelectItem (hTreeItemTarget);
			pNodeTarget = (CaMessageNode*)pTree->GetItemData (hTreeItemTarget);
			nAction = GetCompatibleSourceTarget(pTree,pNodeTarget->GetNodeInformation());
		}
		TRACE1 ("DD Action = %x\n", nAction);

		if (nAction != 0)
			::SetCursor (theApp.m_hCursorDropCategory);
		else
			::SetCursor (theApp.m_hCursorNoDropCategory);
	}
	else
	{
		::SetCursor (theApp.m_hCursorNoDropCategory);
	}
	m_pImageListDrag->DragEnter(GetParentFrame(), pDragMove);  // lock updates and show drag image

	CuListCtrlVScrollEvent::OnMouseMove(nFlags, point);
}