Пример #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
void TreeDlg::OnButtonExpandAll() {
  CTreeCtrl *ctrl = getTreeCtrl();
  int hp = ctrl->GetScrollPos(SB_HORZ);
  int vp = ctrl->GetScrollPos(SB_VERT);
  TreeItemExpander(true).visitAllItems(ctrl);
  ctrl->SetFocus();
  ctrl->SetScrollPos(SB_HORZ, hp);
  ctrl->SetScrollPos(SB_VERT, vp);
}
Пример #4
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;
}
Пример #5
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);
	}
}
Пример #6
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);

}
Пример #7
0
void TreeDlg::OnExpand() {
  CTreeCtrl *ctrl = getTreeCtrl();
  ctrl->Expand(ctrl->GetSelectedItem(), TVE_EXPAND);
  ctrl->SetFocus();
}
Пример #8
0
void TreeDlg::OnCollapse() {
  CTreeCtrl *ctrl = getTreeCtrl();
  ctrl->Expand(ctrl->GetSelectedItem(), TVE_COLLAPSE);
  ctrl->SetFocus();
}
Пример #9
0
void TreeDlg::OnButtonExpand() {
  CTreeCtrl *ctrl = getTreeCtrl();
  TreeItemExpander(true).visitAllItems(ctrl, ctrl->GetSelectedItem());
  ctrl->SetFocus();
}