Beispiel #1
1
/*******************************************************************************
  Function Name  : OnContextMenu
  Input(s)       : pWnd, point
  Output         : -
  Functionality  : Show the context menu with a list of column names as menu items.
  Member of      : CRxMsgList
  Author(s)      : Arunkumar K
  Date Created   : 20-05-2010
  Modifications  : 
*******************************************************************************/
void CRxMsgList::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{	
	if (point.x==-1 && point.y==-1)
	{
		// OBS! point is initialized to (-1,-1) if using SHIFT+F10 or VK_APPS		
	}
	else
	{
		CPoint pt = point;
		ScreenToClient(&pt);

		CRect headerRect;
		GetHeaderCtrl()->GetClientRect(&headerRect);
		if (headerRect.PtInRect(pt))
		{
			// Show context-menu with the option to show hide columns
			CMenu menu;
			if (menu.CreatePopupMenu())
			{
				for( int i = GetColumnStateCount()-1 ; i >= 0; --i)
				{
					UINT uFlags = MF_BYPOSITION | MF_STRING;

					// Put check-box on context-menu
					if (IsColumnVisible(i))
						uFlags |= MF_CHECKED;
					else
						uFlags |= MF_UNCHECKED;

					if(i == 0)		//Disable 'Time' column
						break;

					// Retrieve column-title
					LVCOLUMN lvc = {0};
					lvc.mask = LVCF_TEXT;
					TCHAR sColText[256];
					lvc.pszText = sColText;
				
					lvc.cchTextMax = 15;	//Set the Width of Menu Items here
					//lvc.cchTextMax = sizeof(sColText)-1;
					VERIFY( GetColumn(i, &lvc) );

					menu.InsertMenu(0, uFlags, i, lvc.pszText);					
				}

				menu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this, 0);
			}
		}
	}
}
Beispiel #2
1
afx_msg void CIec101sDlg::OnRClickGrid(NMHDR *pNMHDR, LRESULT *pResult)
{
	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNMHDR;

	CMenu MenuRButton;
	MenuRButton.CreatePopupMenu();				
	MenuRButton.AppendMenu(MF_STRING, IDM_PRINT1, "Печать...");	
	
	POINT point;
	GetCursorPos(&point);
	MenuRButton.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this, NULL);
	MenuRButton.DestroyMenu();
				
}
Beispiel #3
0
void COnlineUsersDlg::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
    CMenu menu;
    menu.LoadMenu(IDR_MENU_ONLINEUSERS);
    TRANSLATE(menu);
    CMenu* pop = menu.GetSubMenu(0);
    if(!pop)
        return;

    UINT uCmd = pop->TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN |
        TPM_RIGHTBUTTON, point.x, point.y,
        this, NULL );
    MenuCommand(uCmd);
}
Beispiel #4
0
/** 
* Dispalys the popup menu with the appropriate menu items enabled.
*/
void StageView::PopupMenu(CPoint* pt) {

	//Determine the type of object clicked on
	CListCtrl& list = GetListCtrl();


	ClientToScreen (pt);

	CMenu FloatingMenu;
	VERIFY(FloatingMenu.LoadMenu(IDR_ME_STAGELIST_POPUP));
	CMenu* pPopupMenu = FloatingMenu.GetSubMenu (0);
	ASSERT(pPopupMenu != NULL);

	POSITION pos = list.GetFirstSelectedItemPosition();
	int nItem = -1;
	if(pos)
		nItem = list.GetNextSelectedItem(pos);

	if(nItem <= 0) {
		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_RENAMESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_DELETESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);

		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_CUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_COPY, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	} else {
		MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
		if(material->GetAttributeInt(nItem-1, "stagetype") != MaterialDoc::STAGE_TYPE_NORMAL) {
			pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_RENAMESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		}
	}

	MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
	if(material->FindStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "bumpmap") >= 0) {
		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_ADDBUMPMAP, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}
	if(material->FindStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "diffusemap") >= 0) {
		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_ADDDIFFUSEMAP, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}
	if(material->FindStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "specularmap") >= 0) {
		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_ADDSPECULAR, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	if(materialDocManager->IsCopyStage()) {
		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_PASTE, MF_BYCOMMAND | MF_ENABLED);
	} else {
		pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_PASTE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt->x, pt->y, &list);
}
Beispiel #5
0
void CIconListBox::OnRButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	CPoint pt; 
	pt= point ; 
	this->ClientToScreen(&pt);
	// show the menu (returns, when menu is closed again!) 
	CMenu* pMenu = PopMenu.GetSubMenu (0); 
	pMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, 
		pt.x, pt.y, this); 
	
	//this->ScreenToClient(&pt);
	CCheckListBox::OnRButtonDown(nFlags, point);
}
Beispiel #6
0
void CSearchInfo::OnRclickListResults(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LPNMHDR Control = (LPNMHDR) pNMHDR;		// stay compatable with IE 3.0!
	
	int nItem = m_lstResults.GetSelectionMark();
	if (0 > nItem || nItem > m_lstResults.GetItemCount() - 1)
		return;

    CMenu menu;
    menu.LoadMenu(IDR_SEARCHEX_RCLICK);
    CMenu *pMenu = menu.GetSubMenu(0);
    ASSERT(pMenu != NULL);

    // Display and track the popup menu
    CPoint point;
    GetCursorPos(&point);

	int res = pMenu->TrackPopupMenu( (TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD),
                 point.x, point.y, this);

	POSITION pos = m_lstResults.GetFirstSelectedItemPosition();
	
	switch(res)
	{
	case ID_LSTSEARCHEX_BLOCK:
		if(pos)
		{
			pos   = m_lstResults.GetFirstSelectedItemPosition();
			nItem = m_lstResults.GetNextSelectedItem(pos);

			ResultHost* p = (ResultHost*) m_lstResults.GetItemData(nItem);


			// Dispaly Preferences, sharing tab
			m_pDoc->m_nLastPref = PREF_SEARCHBLOCK;
			
			CPrefDialog PrefDlg("Preferences");
		
			PrefDlg.m_TabSearchBlock->m_SearchExInit = IPtoStr(p->Host);
			PrefDlg.DoModal();

			m_pView->OnChecksScreen();
		}

		break;
	}
		
	*pResult = 0;
}
void CDiagramEntity::ShowPopup( CPoint point, CWnd* parent )
/* ============================================================
	Function :		CDiagramEntity::ShowPopup
	Description :	Shows the popup menu for the object.

	Return :		void
	Parameters :	CPoint point	-	The point to track.
					CWnd* parent	-	The parent CWnd of the 
										menu (should be the 
										CDiagramEditor)

	Usage :			The function uses hardcoded strings to 
					avoid having to include resource file 
					fragments. Derived classes needing a non-
					standard or localized menu should load 
					menues from resources instead.

   ============================================================*/
{

	CMenu menu;
	if( menu.CreatePopupMenu() )
	{

		menu.AppendMenu( MF_STRING, CMD_CUT, _T( "Cu&t" ) );
		menu.AppendMenu( MF_STRING, CMD_COPY, _T( "&Copy" ) );
		menu.AppendMenu( MF_STRING, CMD_DUPLICATE, _T( "Du&plicate" ) );
		menu.AppendMenu( MF_SEPARATOR );
		menu.AppendMenu( MF_STRING, CMD_UP, _T( "&Up" ) );
		menu.AppendMenu( MF_STRING, CMD_DOWN, _T( "&Down" ) );
		menu.AppendMenu( MF_STRING, CMD_FRONT, _T( "To &front" ) );
		menu.AppendMenu( MF_STRING, CMD_BOTTOM, _T( "To &back" ) );
		menu.AppendMenu( MF_SEPARATOR );
		menu.AppendMenu( MF_STRING, CMD_FREEZE, _T( "Freeze Selection" ) );
		menu.AppendMenu( MF_STRING, CMD_UNFREEZE_ALL, _T( "Unfreeze All" ) );
		menu.AppendMenu( MF_SEPARATOR );
		menu.AppendMenu( MF_STRING, CMD_HIDE, _T( "Hide Selection" ) );	
		menu.AppendMenu( MF_STRING, CMD_UNHIDE_ALL, _T( "Unhide All" ) );
		menu.AppendMenu( MF_STRING, CMD_HIDE_UNSEL, _T( "Hide Unselected" ) );
		menu.AppendMenu( MF_SEPARATOR );
		menu.AppendMenu( MF_STRING, CMD_CONTROL_LIST, _T( "Control List " ) );
		
		menu.AppendMenu( MF_SEPARATOR );
		menu.AppendMenu( MF_STRING, CMD_PROPERTIES, _T( "P&roperties" ) );
		menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, parent );

	}

}
Beispiel #8
0
void CGameManageDlg::OnNMRclickList1(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: 在此添加控件通知处理程序代码
	CMenu PopMenu;
	CString strMenu;
	PopMenu.CreatePopupMenu();
	CPoint Point;
	GetCursorPos(&Point);
	m_GameDiskListCtrl.ScreenToClient(&Point);
	m_ListIndex1 = m_GameDiskListCtrl.HitTest(Point);

	if (0 <= m_ListIndex1 && m_ListIndex1 < m_wSocket.m_pRoomInfo->uDeskCount)
	{
		int flag = -1;
		int uesecount = 0;
		for (int j = 0; j < m_wSocket.m_UserManage.GetOnLineUserCount(); j++)
		{
			if (m_wSocket.m_UserManage.FindOnLineUserByIndex(j)->GameUserInfo.bDeskNO == m_ListIndex1)
			{
				uesecount++;
			}
		}
		if (uesecount == 0) flag = 0; 
		for (int i = 0; i < m_wSocket.m_DeskStation.vVirtuals.size(); i++)
		{
			if (m_ListIndex1 == m_wSocket.m_DeskStation.vVirtuals[i])
			{
				flag = 1;
				break;
			}
		}
		if (flag != -1)
		{
			if (flag == 0)
				PopMenu.AppendMenu(0, MSG_CMD_GM_LOCK, TEXT("封桌"));
			else if (flag == 1)
				PopMenu.AppendMenu(0, MSG_CMD_GM_UNLOCK, TEXT("解封"));
			PopMenu.AppendMenu(0, MSG_CMD_GM_ALLLOCK, TEXT("批量封桌"));
			PopMenu.AppendMenu(0, MSG_CMD_GM_ALLUNLOCK, TEXT("批量解封"));
			//显示菜单

			GetCursorPos(&Point);
			//m_GameUeserListCtrl.ClientToScreen(&Point);
			PopMenu.TrackPopupMenu(TPM_RIGHTBUTTON, Point.x, Point.y, this);
			PopMenu.DestroyMenu();
		}
	}
	*pResult = 0;
}
Beispiel #9
0
void KTgaButton::OnRButtonUp(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	if(m_pOutDoorMgr && m_nButtonType == GROUNDTEXTURE)
		return ;
	CButton::OnRButtonUp(nFlags, point);

	POINT point1;
	GetCursorPos(&point1);
	CMenu* pMenu = m_MenuTga.GetSubMenu(0);
	pMenu->TrackPopupMenu(TPM_LEFTALIGN, point1.x, point1.y, this);
	CButton::OnRButtonUp(nFlags, point);


}
Beispiel #10
0
void CFFPlugsRow::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	m_ParmSlider.SetFocus();
	if (point.x == -1 && point.y == -1) {	// if menu triggered via keyboard
		CRect	r;
		m_ParmSlider.GetWindowRect(r);	// position menu over slider
		point = r.TopLeft() + CSize(10, 10);	// offset looks nicer
	}
	CMenu	menu;
	menu.LoadMenu(IDR_VIEW_ROW_CTX);
	CMenu	*mp = menu.GetSubMenu(0);
	CWnd	*NotifyWnd = GetNotifyWnd();
	theApp.UpdateMenu(NotifyWnd, &menu);
	mp->TrackPopupMenu(0, point.x, point.y, NotifyWnd);
}
Beispiel #11
0
void CTransDlg::OnRButtonDown(UINT nFlags, CPoint point) 
{
    CPoint lpt = point;
    ClientToScreen(&lpt);
    CMenu* popup = m_popup.GetSubMenu(0);

    // display the popup menu
    popup->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, lpt.x, lpt.y,
                          (CWnd*) this, NULL);

    // BUGFIX: See "PRB: Menus for Notification Icons Don't Work Correctly"
    GetParent()->PostMessage(WM_NULL, 0, 0);

    CDialog::OnRButtonDown(nFlags, point);
}
Beispiel #12
0
void CPopupEdit::OnRButtonDown(UINT nFlags, CPoint point) 
{
	CPoint local = point; 
	ClientToScreen(&local);

	CMenu menu;
	VERIFY(menu.LoadMenu(IDM_MEMORYUNITS));
	CMenu *PopupMenu = menu.GetSubMenu(0);
	ASSERT_VALID(PopupMenu);

	SetFocus();
	PopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, local.x, local.y, this);
	
	CEdit::OnRButtonDown(nFlags, point);
}
void CSequenceInstrumentEditPanel::OnRClickInstSettings(NMHDR* pNMHDR, LRESULT* pResult)
{
	POINT oPoint;
	GetCursorPos(&oPoint);

	if (m_pSequence == NULL)
		return;

	// Display clone menu
	CMenu contextMenu;
	contextMenu.LoadMenu(IDR_SEQUENCE_POPUP);
	CMenu *pMenu = contextMenu.GetSubMenu(0);
	pMenu->EnableMenuItem(ID_CLONE_SEQUENCE, (m_pSequence->GetItemCount() != 0) ? FALSE : TRUE);
	pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, oPoint.x, oPoint.y, this);
}
Beispiel #14
0
void CMainFrame::OnButtonDeleteclass()
{
	CMFCRibbonBaseElement* pButton = m_wndRibbonBar.FindByID(ID_BUTTON_DELETECLASS);

	CRect pos = pButton->GetRect( );
	ClientToScreen( &pos );

	CMenu menu;
	menu.CreatePopupMenu( );
	for ( UINT m = 0; m < theApp.Classes.size( ); m++ )
	{
		menu.AppendMenu( MF_STRING | MF_ENABLED, WM_DELETECLASSMENU + m, theApp.Classes[m]->Name );
	}
	menu.TrackPopupMenu( TPM_LEFTALIGN | TPM_HORNEGANIMATION, pos.left, pos.bottom, this );
}
Beispiel #15
0
void CSystemDlg::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
{
    // TODO: Add your control notification handler code here
    if (m_list_dialupass.IsWindowVisible())
        return;

    CMenu	popup;
    popup.LoadMenu(IDR_PSLIST);
    CMenu*	pM = popup.GetSubMenu(0);
    CPoint	p;
    GetCursorPos(&p);

    pM->TrackPopupMenu(TPM_LEFTALIGN, p.x, p.y, this);
    *pResult = 0;
}
Beispiel #16
0
void CDetailInfo::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
	CMenu menu; // = new CMenu();

	menu.CreatePopupMenu();
	
	menu.AppendMenu(MF_STRING, MP_COPYSELECTED, GetResString(IDS_COPY));
	menu.AppendMenu(MF_STRING, MP_SELECTALL, GetResString(IDS_SELECTALL));

	m_pMenuXP = new CMenuXP();
	m_pMenuXP->AddMenu(&menu, TRUE);
	menu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x, point.y, this);
	delete m_pMenuXP;
	m_pMenuXP = NULL;
}
void CFPAnalysisView::OnContextMenu(CWnd* pWnd, CPoint point) 
{
   	if (currentimage.OK())
	{
		CMenu MenuBar;
		MenuBar.LoadMenu(IDR_FPANALTYPE);
		CMenu* pMenu = MenuBar.GetSubMenu(2);
		
		pMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,this);
	}
	else
	{
		CScrollView::OnContextMenu(pWnd,point);
	}
}
Beispiel #18
0
void CPage5::OnNMRClickListDrivers(NMHDR *pNMHDR, LRESULT *pResult)
{
    LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
    NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
    if (pNMListView->iItem != -1 && pNMListView->iSubItem != -1)
    {
        CPoint pt;
        GetCursorPos(&pt);
        CMenu menu;
        menu.LoadMenu(IDR_MENU5_DRIVER);
        CMenu* pMenu = menu.GetSubMenu(0);
        pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, this);
    }
    *pResult = 0;
}
void CParticleMenuGridProperty::OnRClickValue(CPoint C,BOOL B)
{
	CPoint pt;
	GetCursorPos(&pt);

	CMenu menu;
	menu.CreatePopupMenu();
	menu.AppendMenu(MF_STRING,MENU_USE_SELECTED_TEXTURE,"Use Selected Texture");
	CString texturePath;
	if(((CMainFrame*)AfxGetMainWnd())->GetSelectedResourceTexture(texturePath))
		menu.EnableMenuItem(MENU_USE_SELECTED_TEXTURE,MF_BYCOMMAND|MF_ENABLED);
	else
		menu.EnableMenuItem(MENU_USE_SELECTED_TEXTURE,MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
	menu.TrackPopupMenu(TPM_LEFTALIGN,pt.x,pt.y,m_pWndList->GetParent());
}
void CJobControlDlg::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LPNMLISTVIEW	lpnmlv = (LPNMLISTVIEW)pNMHDR;
	if (lpnmlv->iItem >= 0) {
		CMenu	menu;
		menu.LoadMenu(IDR_JOB_CONTROL_CTX);
		CMenu	*mp = menu.GetSubMenu(0);
		CToolDlg::UpdateMenu(this, &menu);
		CPoint	pt;
		GetCursorPos(&pt);
		UpdateMenu(this, mp);	// call menu's UI handlers
		mp->TrackPopupMenu(0, pt.x, pt.y, this);
	}
	*pResult = 0;
}
Beispiel #21
0
void CMainWindow::createCustomMenu()
{
	CMenu menu;
	CMenu sub;
	CMenu popup;
	
    if (!m_pBrowserEng->GetHTMLWND())
        return;

	VERIFY(menu.CreateMenu());
	VERIFY(popup.CreatePopupMenu());
	menu.AppendMenu(MF_POPUP, (UINT) popup.m_hMenu, _T(""));

	RHODESAPP().getAppMenu().copyMenuItems(m_arAppMenuItems);

#ifdef ENABLE_DYNAMIC_RHOBUNDLE
    String strIndexPage = CFilePath::join(RHODESAPP().getStartUrl(),"index"RHO_ERB_EXT);
    if ( RHODESAPP().getCurrentUrl().compare(RHODESAPP().getStartUrl()) == 0 ||
         RHODESAPP().getCurrentUrl().compare(strIndexPage) == 0 )
        m_arAppMenuItems.addElement(CAppMenuItem("Reload RhoBundle","reload_rhobundle"));
#endif //ENABLE_DYNAMIC_RHOBUNDLE

	//update UI with custom menu items
	USES_CONVERSION; 
    for ( int i = m_arAppMenuItems.size() - 1; i >= 0; i--)
    {
        CAppMenuItem& oItem = m_arAppMenuItems.elementAt(i);
        if (oItem.m_eType == CAppMenuItem::emtSeparator) 
			popup.InsertMenu(0, MF_BYPOSITION | MF_SEPARATOR, (UINT_PTR)0, (LPCTSTR)0);
		else
        {
            StringW strLabelW = convertToStringW(oItem.m_strLabel);

			popup.InsertMenu(0, MF_BYPOSITION, ID_CUSTOM_MENU_ITEM_FIRST + i, 
                oItem.m_eType == CAppMenuItem::emtClose ? _T("Exit") : strLabelW.c_str() );
        }
    }

	RECT  rect; 
	GetWindowRect(&rect);
    rect.bottom -= m_menuBarHeight;
	sub.Attach(menu.GetSubMenu(0));
	sub.TrackPopupMenu( TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON | TPM_VERNEGANIMATION, 
						rect.right-1, 
						rect.bottom-1,
						m_hWnd);
	sub.Detach();
}
Beispiel #22
0
void CFileTreeCtrl::OnContextMenu(CWnd* pWnd, CPoint point)
{
    if (point.x == -1)
    {
        HTREEITEM ht = GetSelectedItem();
        RECT rect;

        GetItemRect( ht, &rect, true );
        ClientToScreen( &rect );

        /* Offset the popup menu origin so
        * we can read some of the text
        */

        point.x = rect.left + 15;
        point.y = rect.top + 8;
    }

    CMenu menu;
    menu.LoadMenu(IDR_MENU_TREEVIEW);

    CMenu * pop;
    pop = menu.GetSubMenu(0);

    UINT uCmd = pop->TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN |	TPM_RIGHTBUTTON, point.x, point.y, this, NULL );

    /* Menu item chosen ? */
    if (uCmd != 0)
    {
        switch(uCmd)
        {
            case ID_TREEVIEW_REFRESH:
                OnFileRefresh();
                break;

            case ID_TREEVIEW_COPYPATH:
                OnFileCopyPathToClipboard();
                break;

            case ID_TREEVIEW_OPENPATH:
                OnOpenPathInExplorer();
                break;

        }
    }

    menu.DestroyMenu();
}
Beispiel #23
0
afx_msg void CGranitDlg::OnRClickGrid1(NMHDR *pNMHDR, LRESULT *pResult)
{	
	CMenu MenuRButton;
	MenuRButton.CreatePopupMenu();				
	MenuRButton.AppendMenu(MF_STRING, IDM_ADD, "Добавить набор инф.объектов");	
	//MenuRButton.AppendMenu(MF_STRING, IDM_ADDDIAP, "Добавить диапазон наборов инф.объектов");		
	MenuRButton.AppendMenu(MF_STRING, IDM_DEL, "Удалить набор инф.объектов");
	MenuRButton.AppendMenu(MF_SEPARATOR);
	MenuRButton.AppendMenu(MF_STRING, IDM_PRINT2, "Печать...");	

	POINT point;
	GetCursorPos(&point);
	MenuRButton.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this, NULL);
	MenuRButton.DestroyMenu();
				
}
void COXRollup::OnProcessSysMenu()
	{
	// dim the roll up and down commands via the boolean flag
	CMenu *pSysmenu = GetSysMenu();
	pSysmenu->EnableMenuItem(IDM_OX_RU_ROLLUP,
		MF_BYCOMMAND|(m_bRolledUp ? MF_DISABLED|MF_GRAYED : MF_ENABLED));
	pSysmenu->EnableMenuItem(IDM_OX_RU_ROLLDOWN,
		MF_BYCOMMAND|(m_bRolledUp ? MF_ENABLED : MF_DISABLED|MF_GRAYED));
	pSysmenu->EnableMenuItem(IDM_OX_RU_ARRANGE,
		MF_BYCOMMAND|(IsArranged() ? MF_DISABLED|MF_GRAYED : MF_ENABLED));
	
	// set the position of the system menu
	CRect rect;
	m_pTitleBar->GetWindowRect(&rect);
	pSysmenu->TrackPopupMenu(TPM_LEFTBUTTON|TPM_LEFTALIGN, rect.left, rect.bottom, this, NULL);
	}
void ImageViewDialog::OnRButtonDown(UINT nFlags, CPoint point) {
  CMenu menu;
  menu.LoadMenu(IDR_POPUP_IMAGE_VIEW);
  CMenu *contextMenu = menu.GetSubMenu(0);
  int choice = contextMenu->TrackPopupMenu(TPM_RETURNCMD, point.x, point.y, this);
  if (choice == ID_SAVE_IMAGE) {
    CFileDialog dlg(FALSE);
    if (dlg.DoModal() == IDOK) {
      CString filePath = dlg.GetPathName();
      topImage_.SaveToFile(filePath + "_top.bmp");
      bottomImage_.SaveToFile(filePath + "_bottom.bmp");
    }
  }

  CDialog::OnRButtonDown(nFlags, point);
}
void CMemoryHackerDlg::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
CMenu menu;
menu.LoadMenu(IDR_PROCESS_MENU); // our context menu
CMenu* pPopup = menu.GetSubMenu(0);

RECT rect;
GetWindowRect(&rect);
CPoint mousepos;
GetCursorPos(&mousepos);
pPopup->TrackPopupMenu(NULL,mousepos.x,mousepos.y, this); 

// The menu is a temporary MFC object, no need to delete it.
	*pResult = 0;
}
Beispiel #27
0
void CMyCommView::OnBtsendkey() 
{
    // TODO: Add your control notification handler code here
    CRect rect;
    CPoint point;
    CButton * mybt = (CButton *)GetDlgItem(IDC_BTSENDKEY);
    mybt->GetWindowRect(rect);
    point.x = rect.right;
    point.y = rect.bottom;

    CMenu menu;
    VERIFY( menu.LoadMenu( IDR_MENU_SNEDKEY ) );
    CMenu* popup = menu.GetSubMenu(0);
    ASSERT( popup != NULL );
            popup->TrackPopupMenu(TPM_RIGHTALIGN| TPM_RIGHTBUTTON, point.x, point.y, this ); 
}
Beispiel #28
0
// Now run off WM_CONTEXTMENU: if user wants standard handling, then let him have it
void COXSizeControlBar::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	if (m_Style & SZBARF_STDMOUSECLICKS)
	{
		CMenu menu;
		if (menu.CreatePopupMenu())
		{
			OnAddContextMenuItems(0,(LPARAM)menu.m_hMenu);
			menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
		}
	} 
	else
	{
		CControlBar::OnContextMenu(pWnd, point);
	}
}
void CInputDocView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	// make sure window is active
	GetParentFrame()->ActivateFrame();

	CMenu menu;
	if (menu.LoadMenu(IDR_InputDocPopup))
	{
		CMenu* pPopup = menu.GetSubMenu(0);
		ASSERTX(pPopup != NULL);

		pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
			point.x, point.y,
			AfxGetMainWnd()); // use main window for cmds
	}
}
Beispiel #30
0
void CGraphPanel::OnRButtonUp(UINT nFlags, CPoint point) 
{
    CWnd::OnRButtonUp(nFlags, point);

    ClientToScreen(&point);

    CMenu* menu = new CMenu();
    menu->CreatePopupMenu();

    //append common menu items from parent windows
    EnumerateParentWindows(AppendMenuForAllParents, (void*)menu);

    menu->TrackPopupMenu(TPM_CENTERALIGN, point.x, point.y, this);

    delete menu;
}