示例#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);
}
示例#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);
}
示例#3
0
BOOL TreeDlg::OnInitDialog() {
  __super::OnInitDialog();
  m_accelTable = LoadAccelerators(theApp.m_hInstance, MAKEINTRESOURCE(IDR_ACCELERATORTREE));

  CTreeCtrl *ctrl = getTreeCtrl();
  m_images.Create(IDB_BITMAPTERMINAL, 13, 1, RGB(255, 255, 255));
  ctrl->SetImageList(&m_images, TVSIL_NORMAL);
  traverse(ctrl, m_tree, TVI_ROOT);
  ctrl->SetFocus();
  ctrl->SelectItem(ctrl->GetRootItem());

  m_layoutManager.OnInitDialog(this);
  m_layoutManager.addControl(IDC_DERIVATIONTREE , RELATIVE_SIZE );
  m_layoutManager.addControl(IDOK               , RELATIVE_X_POS);
  m_layoutManager.addControl(IDC_BUTTONEXPAND   , RELATIVE_X_POS);
  m_layoutManager.addControl(IDC_BUTTONEXPANDALL, RELATIVE_X_POS);

  return false;
}
示例#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);
	}
}
示例#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);

}
示例#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();
}
示例#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);
}