Ejemplo n.º 1
0
CMenu *
PortPopup::AudioMenu(bool isInput, short nch)
{
	CMenu	*menu = new CMenu;
	menu->CreatePopupMenu();
	short n_p = environment.quaAudio.countPorts();
	for (short i=0; i<n_p; i++) {
		QuaAudioPort *p = environment.quaAudio.port(i);
		CMenu	*chmenu = new CMenu;
		chmenu->CreatePopupMenu();
		if (isInput) {
			short n_c = p->NInputs();
			for (short j=0; (j+nch-1)<n_c; j+=nch) {
				chmenu->AppendMenu(MF_STRING, MenuIndexItem(p, j, isInput), p->InputName(j).c_str());
			}
		} else {
			short n_c = p->NOutputs();
			for (short j=0; (j+nch-1)<n_c; j+=nch) {
				chmenu->AppendMenu(MF_STRING, MenuIndexItem(p, j, isInput), p->OutputName(j).c_str());
			}
		}
		menu->AppendMenu(MF_POPUP, (UINT) chmenu->m_hMenu, p->name(NMFMT_NAME));
	}
	return menu;
}
Ejemplo n.º 2
0
CMenu *
PortPopup::MidiMenu(bool isInput)
{
	CMenu	*menu = new CMenu;
	menu->CreatePopupMenu();
	short n_p = environment.quaMidi.countPorts();
	for (short i=0; i<n_p; i++) {
		QuaMidiPort *p = environment.quaMidi.port(i);
		if (	(isInput && (p->mode & QUA_PORT_IN)) ||
				(!isInput && (p->mode & QUA_PORT_OUT))) {
			CMenu	*chmenu = new CMenu;
			chmenu->CreatePopupMenu();
			if (isInput) {
				for (short j=1; j<=16; j++) {
					string buf = "Ch " + to_string(j);
					chmenu->AppendMenu(MF_STRING, MenuIndexItem(p, j, isInput), buf.c_str());
				}
			} else {
				for (short j=1; j<=16; j++) {
					string buf = "Ch " + to_string(j);
					chmenu->AppendMenu(MF_STRING, MenuIndexItem(p, j, isInput), buf.c_str());
				}
			}
			menu->AppendMenu(MF_POPUP, (UINT) chmenu->m_hMenu, p->name(NMFMT_NAME));
		}
	}
	return menu;
}
Ejemplo n.º 3
0
void CDConsoleDlg::OnNMRClickListDcusers(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
	// TODO: Add your control notification handler code here
	*pResult = 0;

	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	*pResult = 0;
	int nItem = pNMListView->iItem;
	if (-1 == nItem)
	{
		return;
	}

	//弹出菜单
	CMenu menu;
	menu.CreatePopupMenu();
	menu.AppendMenu(MF_STRING, ID_MENU_DCUSERINFO, _T("Info"));
	CString sUserType = m_DcUsers.GetItemText(nItem, DCUSERS_CATEGORY);

	if (sUserType == _T("9"))
	{
		CMenu gisMenu;
		gisMenu.CreatePopupMenu();//
		gisMenu.AppendMenu(MF_STRING, ID_MENU_DCGISSUBSCRIBE, _T("Sub"));
		gisMenu.AppendMenu(MF_STRING, ID_MENU_DCGISUNSUBSCRIBE, _T("UnSub"));
		menu.AppendMenu(MF_POPUP, (UINT)gisMenu.m_hMenu, _T("GIS"));
	}

	CPoint pmenu;
	::GetCursorPos(&pmenu);
	menu.TrackPopupMenu(0, pmenu.x, pmenu.y, this);
}
Ejemplo n.º 4
0
void CDConsoleDlg::OnNMRClickTreeDcgroups(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: Add your control notification handler code here
	*pResult = 0;

	CPoint pt, pmenu;
	::GetCursorPos(&pt);
	::GetCursorPos(&pmenu);
	m_DcGroups.ScreenToClient(&pt);

	UINT uFlag = 0;
	HTREEITEM hSelectedItem = m_DcGroups.HitTest(pt,&uFlag);
	if (NULL == hSelectedItem || !(TVHT_ONITEM & uFlag))
	{
		return;
	}

	m_DcGroups.SelectItem(hSelectedItem);

	if (m_DcGroups.GetParentItem(hSelectedItem) == NULL)
	{
		GroupInfo* pInfo = (GroupInfo*)m_DcGroups.GetItemData(hSelectedItem);
		//用户节点
		CMenu menu;
		menu.CreatePopupMenu();	
		menu.AppendMenu(MF_STRING, ID_MENU_DCGROUPINFO, _T("Info"));
		//menu.AppendMenu(MF_STRING, ID_MENU_SUB_DCGROUP, _T("Sub"));
		if (pInfo->GroupCategory != "-1")
		{
			menu.AppendMenu(MF_STRING, ID_MENU_UNSUB_DCGROUP, _T("UnSub"));
			menu.AppendMenu(MF_STRING, ID_MENU_SUB_JOIN_DCGROUP, _T("SubJoin"));
		}
	
		/*menu.AppendMenu(MF_STRING, ID_MENU_JOIN_DCGROUP, _T("JoinGroup"));*/
		
		//临时组
		if (pInfo->GroupCategory == "-1")
		{	
			menu.EnableMenuItem(ID_MENU_DCGROUPINFO, MF_GRAYED);
		}

		//动态组
		if (pInfo->GroupCategory == "9")//怎么判断动态群组是谁创建的?
		{
			menu.AppendMenu(MF_STRING, ID_MENU_RM_DGNA, _T("Remove"));
		}

		menu.TrackPopupMenu(0, pmenu.x, pmenu.y, this);
	}
	else
	{
		//用户节点
		CMenu menu;
		menu.CreatePopupMenu();
		menu.AppendMenu(MF_STRING, ID_MENU_DCGROUPUSERINFO, _T("Info"));

		menu.TrackPopupMenu(0, pmenu.x, pmenu.y, this);
	}
}
Ejemplo n.º 5
0
/******************************************************************************
Function Name  :  OnNMRclick
Input(s)       :
Output         :  void
Functionality  :
Member of      :  CTreeViewEx
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  30/03/2011
Modifications  :
******************************************************************************/
void CTreeViewEx::OnNMRclick(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
    // TODO: Add your control notification handler code here
    CPoint point;
    GetCursorPos(&point);
    CPoint omCurrentPoint(point);
    ScreenToClient(&omCurrentPoint);
    UINT flags;
    HTREEITEM hItem = GetTreeCtrl().HitTest(omCurrentPoint, &flags);
    CTreeCtrl& omTempTreeCtrl = GetTreeCtrl();
    if(hItem && (flags & TVHT_ONITEM) && !(flags & TVHT_ONITEMRIGHT))
    {
        omTempTreeCtrl.SelectItem(hItem);
        eTYPE_ENTITY eEnityType = GetEditorWindow()->eGetCurrentEntityType();
        CMenu omContextMenu;

        VERIFY(omContextMenu.CreatePopupMenu());
        if(eEnityType == TEST_SETUP)
        {
            VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_ADD_TESTCASE, _("New Test Case")));
        }
        else if(eEnityType == TEST_CASE)
        {
            CMenu omSubMenu;
            omSubMenu.CreatePopupMenu();
            omSubMenu.AppendMenu(MF_STRING, IDM_ADD_SEND, _("Send"));
            omSubMenu.AppendMenu(MF_STRING, IDM_ADD_VERIFY, _("Verify"));
            omSubMenu.AppendMenu(MF_STRING, IDM_ADD_WAIT, _("Wait"));
            omSubMenu.AppendMenu(MF_STRING, IDM_ADD_VERIFYRESPONSE, _("verfiyResponse"));
            omSubMenu.AppendMenu(MF_STRING, IDM_ADD_VERIFYDLC, _("verifyDlc"));
            //omSubMenu.AppendMenu(MF_STRING, IDM_ADD_REPLAY, _T("Replay"));
            omContextMenu.AppendMenu(MF_POPUP, (UINT_PTR)omSubMenu.m_hMenu, _("New"));
            omContextMenu.AppendMenu(MF_STRING, IDM_DELETE, _("Delete"));
        }
        else
        {
            omContextMenu.AppendMenu(MF_STRING, IDM_DELETE, _("Delete"));
        }

        if(omContextMenu.GetMenuItemCount() > 0)
        {
            omContextMenu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
        }
        *pResult = 0;
    }

    else        //On Tree View Create Collapse All and Expand All
    {
        CMenu omContextMenu;
        VERIFY(omContextMenu.CreatePopupMenu());
        VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_COLLAPSE_ALL, _("Collapse All")));
        VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_EXPAND_ALL, _("Expand All")));
        VERIFY(omContextMenu.AppendMenu(MF_SEPARATOR));
        VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_SETTINGS_CLR, _("Background Color")));
        omContextMenu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
        *pResult = 0;
    }
}
Ejemplo n.º 6
0
void CTreeViewEx::OnNMRclick(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
    CPoint point;
    GetCursorPos(&point);
    CPoint omCurrentPoint(point);
    ScreenToClient(&omCurrentPoint);
    UINT flags;
    HTREEITEM hItem = GetTreeCtrl().HitTest(omCurrentPoint, &flags);
    CTreeCtrl& omTempTreeCtrl = GetTreeCtrl();

    if(hItem && (flags & TVHT_ONITEM) && !(flags & TVHT_ONITEMRIGHT))
    {
        omTempTreeCtrl.SelectItem(hItem);
        CMenu omContextMenu;
        VERIFY(omContextMenu.CreatePopupMenu());

        if(omTempTreeCtrl.GetItemData(hItem) == def_ID_TESTSUITE)
        {
            VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_TESTSUITE_ADD, _T("Add...")));

            if(GetExecutorWindow()->bGetBusStatus() == TRUE)
            {
                VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_TESTSUITE_EXECUTE, _T("Execute")));
            }
            else
            {
                VERIFY(omContextMenu.AppendMenu(MF_STRING|MF_GRAYED, IDM_TESTSUITE_EXECUTE, _T("Execute")));
            }
        }
        else
        {
            HTREEITEM hParentItem = omTempTreeCtrl.GetParentItem(hItem);

            if(omTempTreeCtrl.GetItemData(hParentItem) == def_ID_TESTSUITE)
            {
                VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_TESTSETUP_DELETE, _T("Delete")));
                VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_TESTSETUP_MODIFY, _T("Modify...")));
            }
        }

        omContextMenu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
        *pResult = 0;
    }
    else        //On Tree View Create Collapse All and Expand All
    {
        CMenu omContextMenu;
        VERIFY(omContextMenu.CreatePopupMenu());
        VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_COLLAPSE_ALL, _T("Collapse All")));
        VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_EXPAND_ALL, _T("Expand All")));
        omContextMenu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
        *pResult = 0;
    }
}
void CImageTreeCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
	// TODO: Add your message handler code here

	
	CPoint pt(point);
	ScreenToClient(&pt);
	UINT flags;
	HTREEITEM hItem = HitTest(pt, &flags);
	bool bOnItem = (flags & TVHT_ONITEM) != 0;

	CMenu add;
	VERIFY(add.CreatePopupMenu());
	if(bOnItem) {
		if(CanInsertItem(GetParentItem(hItem)))
			VERIFY(add.AppendMenu(MF_STRING, ID_ADD_SIBLING, _T("New Sibling\tINS")));
		if(CanInsertItem(hItem))
			VERIFY(add.AppendMenu(MF_STRING, ID_ADD_CHILD, _T("New Child Item\tCtrl+INS")));
	}
	if(CanInsertItem(0))
		VERIFY(add.AppendMenu(MF_STRING, ID_ADD_ROOT, _T("New Root Item\tShift+INS")));

	CMenu sort;
	VERIFY(sort.CreatePopupMenu());
	VERIFY(sort.AppendMenu(MF_STRING, ID_SORT_LEVEL, _T("Current Level\tCtrl+S")));
	VERIFY(sort.AppendMenu(MF_STRING, ID_SORT_LEVELANDBELOW, _T("Current Level And Below\tCtrl+Shift+S")));

	CMenu menu;
	VERIFY(menu.CreatePopupMenu());
	if(bOnItem) {
		if(CanEditLabel(hItem))
			VERIFY(menu.AppendMenu(MF_STRING, ID_RENAME, _T("Rename\tF2")));
		if(CanDeleteItem(hItem))
			VERIFY(menu.AppendMenu(MF_STRING, ID_DELETE, _T("Delete\tDEL")));
	}
	if(add.GetMenuItemCount() > 0)
		VERIFY(menu.AppendMenu(MF_POPUP, UINT(add.GetSafeHmenu()), _T("Add")));
	if(bOnItem) {
		if(menu.GetMenuItemCount() > 0)
			VERIFY(menu.AppendMenu(MF_SEPARATOR));
		VERIFY(menu.AppendMenu(MF_POPUP, UINT(sort.GetSafeHmenu()), _T("Sort")));
	}

	

	// maybe the menu is empty...
	if(menu.GetMenuItemCount() > 0)
		menu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
	

}
Ejemplo n.º 8
0
//----------------------------------------------------------------------------
// Function CreateSubMenu
// @func    adds submenu to menu
// @rdesc   pointer to created menu (CMenu*)
// @parm    CFrameWnd    | *pWnd        | frame window to use
// @parm    UINT         | mainMenuItem | main menu item in which's menu submenu is to be added
// @parm    UINT         | itemIndex    | index of submenu in menu
// @parm    const char   | *string      | item caption (next to > sign)
// @parm    MenuItemData | *data        | pointer to null terminated list of menu items (default NULL)
//----------------------------------------------------------------------------
// @prog 
// Anneke Sicherer-Roetman
// @revs 
// 13-03-2000 - First implementation
//----------------------------------------------------------------------------
// @todo 
//----------------------------------------------------------------------------
CMenu *AddSubMenu(CMenu *pMenuBar, UINT mainMenuItem, UINT itemIndex, 
				  const char *string, MenuItemData *data /* = NULL */)
{
	ASSERT(string);

	ASSERT_VALID(pMenuBar);

	CMenu *pSubMenu = pMenuBar->GetSubMenu(mainMenuItem);
	ASSERT_VALID(pSubMenu);

	CMenu *pMenu = new CMenu;
	VERIFY(pMenu->CreatePopupMenu());
	VERIFY(pSubMenu->InsertMenu(itemIndex, MF_BYPOSITION | MF_POPUP, 
		(UINT)pMenu->m_hMenu, string));

	if (data) 
	{
		for (int i = 0; data[i].string; i++)
		{
			AddSubMenuItem(pMenu, data[i].cmdID, data[i].string);
		}
	}

	return pMenu;
}
Ejemplo n.º 9
0
void CGameManageDlg::OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult)
{

	//HTREEITEM pNMTreeView = m_GameListTreeCtrl.GetSelectedItem();
	CMenu PopMenu;
	CString strMenu;
	PopMenu.CreatePopupMenu();
	CPoint Point;
	GetCursorPos(&Point);
	m_GameListTreeCtrl.ScreenToClient(&Point);
	HTREEITEM pNMTreeView = m_GameListTreeCtrl.HitTest(Point);

	RECT rc;
	GetWindowRect(&rc);

	// TODO: 在此添加控件通知处理程序代码
	if (pNMTreeView != NULL)
	{
		CNodeType* p = (CNodeType*)m_GameListTreeCtrl.GetItemData(pNMTreeView);
		if (p != NULL)
		{
			if (p->m_uDataType == GLK_GAME_ROOM)
			{
// 				PopMenu.AppendMenu(0, MSG_CMD_GM_ALLLOCK, TEXT("封桌"));
// 				PopMenu.AppendMenu(0, MSG_CMD_GM_ALLUNLOCK, TEXT("解封"));
				PopMenu.AppendMenu(0, MSG_CMD_GM_PRINTLOG, TEXT("打印用户状态logo"));

				PopMenu.TrackPopupMenu(TPM_RIGHTBUTTON, Point.x + rc.left, Point.y + rc.top, this);
				PopMenu.DestroyMenu();
			}
		}
	}
	*pResult = 0;
}
Ejemplo n.º 10
0
//右键消息
VOID CSkinRichEdit::OnRButtonDown(UINT nFlags, CPoint Point)
{
	//设置焦点
	SetFocus();
	CMenu PopMenu;

	//建立菜单
	PopMenu.CreatePopupMenu();
	PopMenu.AppendMenu(0,IDM_COPY_STRING,TEXT("复制(&C) \tCtrl+C"));
	PopMenu.AppendMenu(0,IDM_SELECT_ALL,TEXT("全选(&A) \tCtrl+A"));
	PopMenu.AppendMenu(0,IDM_DELETE_STRING,TEXT("删除(&D)"));
	PopMenu.AppendMenu(0,IDM_CLEAR_ALL,TEXT("清除屏幕"));
	PopMenu.AppendMenu(0,MF_SEPARATOR);
	PopMenu.AppendMenu(0,IDM_SAVE_STRING,TEXT("保存信息..."));

	//设置菜单
	UINT nSel=((GetSelectionType()!=SEL_EMPTY)?0:MF_GRAYED);
	PopMenu.EnableMenuItem(IDM_COPY_STRING,MF_BYCOMMAND|nSel);
	PopMenu.EnableMenuItem(IDM_DELETE_STRING,MF_BYCOMMAND|nSel);
	PopMenu.EnableMenuItem(IDM_SELECT_ALL,MF_BYCOMMAND);

	//显示菜单
	ClientToScreen(&Point);
	PopMenu.TrackPopupMenu(TPM_RIGHTBUTTON,Point.x,Point.y,this);
	PopMenu.DestroyMenu();

	return;
}
Ejemplo n.º 11
0
void CMainFrame::OnButtonEditclass( )
{
	if ( gbClassBrowser )
	{	
		CDialogClasses dlg;
		dlg.DoModal( );
	} else {
		// TODO:instead of menu popup a window
		CMFCRibbonBaseElement* pButton = m_wndRibbonBar.FindByID( ID_BUTTON_EDITCLASS );

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

		CMenu menu;
		menu.CreatePopupMenu( );

		for ( UINT m = 0; m < theApp.Classes.size( ); m++ )
		{
			CString MenuItem;
			MenuItem.Format( "%i - %s", m, theApp.Classes[m]->Name );

			menu.AppendMenu( MF_STRING | MF_ENABLED, WM_CLASSMENU + m, MenuItem );
		}

		menu.TrackPopupMenu( TPM_LEFTALIGN | TPM_HORNEGANIMATION, pos.left, pos.bottom, this );
	}
}
Ejemplo n.º 12
0
void CKeyControl::OnRButtonDown(UINT nFlags, CPoint point) 
{
	CMenu rbMenu;
	rbMenu.CreatePopupMenu();

	CLinkListNode<KEY> *pNode = PtInKey(point);
	
	if (pNode)
	{
		rbMenu.AppendMenu(MF_STRING, 5000, "&Edit Key");
		if ((pNode->m_pPrev) && (pNode->m_pNext))
		{
			rbMenu.AppendMenu(MF_SEPARATOR, 5001, "");
			rbMenu.AppendMenu(MF_STRING, 5002, "&Delete Key");
		}
		
		m_pMenuKey = pNode;			

		ClientToScreen(&point);
		rbMenu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
	}

	
	CStatic::OnRButtonDown(nFlags, point);
}
Ejemplo n.º 13
0
void CRemoteFileDialog::OnViewMenu()
{
	// build the view menu manually (because we're a non-resource dependent file)
	CMenu menu;

	if (menu.CreatePopupMenu())
	{
		menu.InsertMenu(0, MF_STRING | MF_BYPOSITION, ID_VIEW_LARGEICON, _T("Lar&ge Icons"));
		menu.InsertMenu(1, MF_STRING | MF_BYPOSITION, ID_VIEW_SMALLICON, _T("S&mall Icons"));
		menu.InsertMenu(2, MF_STRING | MF_BYPOSITION, ID_VIEW_LIST, _T("&List"));
		menu.InsertMenu(3, MF_STRING | MF_BYPOSITION, ID_VIEW_DETAILS, _T("&Details"));

		// check the appropriate one
		int nView = (m_lcFiles.GetStyle() & LVS_TYPEMASK);
		menu.CheckMenuRadioItem(ID_VIEW_LARGEICON, ID_VIEW_DETAILS, VIEWIDS[nView], MF_BYCOMMAND);

		// get the button rect in screen coords
		CRect rButton;

		m_toolbar.GetItemRect(1, rButton);
		m_toolbar.ClientToScreen(rButton);
		m_toolbar.GetToolBarCtrl().PressButton(ID_VIEWMENU);

		menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, rButton.left, rButton.bottom, this);

		m_toolbar.GetToolBarCtrl().PressButton(ID_VIEWMENU, FALSE);
	}
}
Ejemplo n.º 14
0
	// Create the Control
		//              this,             ID,      name, txt font,                   left,    top, width
	void create(CKXPluginGUI* parent,UINT ID, char* name,CFont* sfont,int num_items,
							int left, int top, int wd)
	{
		// add the kX static bitmap holder
		back.create("",left,top,backbmp,parent,kMETHOD_TRANS);
		back.show();

		// add the kX button
		parent->create_checkbox(butt, ID, name, left+wd, top, 20);
		butt.set_method(kMETHOD_TRANS);
		butt.set_check(0);
		butt.show();

		// add the text label
		txtbox.Create("",WS_CHILD|WS_VISIBLE|SS_LEFT,
					CRect(CPoint(left+5,top+4),CSize(wd-5,12)), parent, NULL);
		txtbox.SetFont(sfont,NULL);	
		//txtbox.SetTextColor(RGB(241,159,3));
		txtbox.SetBkColor(CLR_NONE);

		// create the popmenu
		nItems = num_items;
		popmenu.CreatePopupMenu();
		for(int i=0; i<nItems; i++)	// add items
		{
			char tmp[64];
			sprintf(tmp,"%d -- Item --", i);
			popmenu.AppendMenu(MF_STRING, i+100, tmp);
		}
		popmenu.CheckMenuItem(100,MF_CHECKED);	// check first item
		curr_sel=0;
	};
Ejemplo n.º 15
0
CMenu* CDlgMenuThread::CreateMenu()
{
		CMenu* menu = new CMenu();
		menu->CreatePopupMenu();
		m_arrayMenuData.Add(menu);
		return menu;
}
Ejemplo n.º 16
0
void CSourceDirListCtrl::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	CMenu srcDirMenu;
	srcDirMenu.CreatePopupMenu();
	srcDirMenu.AppendMenu(MF_STRING, IDM_SOURCE_DIR_REMOVE,		_T("Remove"));
	srcDirMenu.AppendMenu(MF_STRING, IDM_SOURCE_DIR_REMOVE_ALL,	_T("Remove All"));
	srcDirMenu.AppendMenu(MF_SEPARATOR);
	srcDirMenu.AppendMenu(MF_STRING, IDM_SOURCE_DIR_SELECT_ALL,	_T("Select All\tCtrl+A"));
	srcDirMenu.AppendMenu(MF_SEPARATOR);
	srcDirMenu.AppendMenu(MF_STRING, IDM_SOURCE_DIR_CHECK,		_T("Check"));
	srcDirMenu.AppendMenu(MF_STRING, IDM_SOURCE_DIR_UNCHECK,	_T("Uncheck"));
	srcDirMenu.AppendMenu(MF_SEPARATOR);
	srcDirMenu.AppendMenu(MF_STRING, IDM_SOURCE_DIR_OPEN_DIR,	_T("Open Folder"));

	//Set menu enable status
	int nCount = GetSelectedCount();
	if(nCount <= 0)
	{
		srcDirMenu.EnableMenuItem(IDM_SOURCE_DIR_REMOVE, MF_BYCOMMAND | MF_GRAYED);
		srcDirMenu.EnableMenuItem(IDM_SOURCE_DIR_CHECK, MF_BYCOMMAND | MF_GRAYED);
		srcDirMenu.EnableMenuItem(IDM_SOURCE_DIR_UNCHECK, MF_BYCOMMAND | MF_GRAYED);
	}
	if(nCount != 1)
	{
		srcDirMenu.EnableMenuItem(IDM_SOURCE_DIR_OPEN_DIR, MF_BYCOMMAND | MF_GRAYED);
	}

	srcDirMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, point.x, point.y, this);	
}
Ejemplo n.º 17
0
int CDrawQuoteTabCtrl::OpenAllMarketMenu(CPoint point )
{
	CDrawQuoteTab* pTab = m_ayItem[m_nCurItem];
	CString strCurItemName = pTab->m_strName;
	CArray<StockType> ayAllMarket;
	m_pDataSource->HSDataSourceEx_GetSystemMarketInfo(0, 0, ayAllMarket);

	short nPreMarket = 0;
	CMenu menu;
	menu.CreatePopupMenu();
	for (int i=0; i<ayAllMarket.GetCount(); i++)
	{
		if ((nPreMarket&0xFF00) != (ayAllMarket.GetAt(i).m_nStockType&0xFF00))
		{
			menu.AppendMenu(MF_SEPARATOR|MF_MENUBARBREAK);
		}
		menu.AppendMenu(MF_BYCOMMAND,CDRAWTAB_ID_MENU_MARKET_BEGIN+i,ayAllMarket.GetAt(i).m_stTypeName.m_szName);
		if (!strCurItemName.IsEmpty() && strCurItemName==ayAllMarket.GetAt(i).m_stTypeName.m_szName)
		{
			menu.CheckMenuItem(CDRAWTAB_ID_MENU_MARKET_BEGIN+i,MF_BYCOMMAND|MF_CHECKED);
		}

		CString strTemp;
		strTemp.Format("%s-%d",ayAllMarket.GetAt(i).m_stTypeName.m_szName,ayAllMarket.GetAt(i).m_nStockType);
		m_mapTempMenuIndex.SetAt(CDRAWTAB_ID_MENU_MARKET_BEGIN+i,strTemp);

		nPreMarket = (ayAllMarket.GetAt(i).m_nStockType&0xFF00);
	}

	CWnd* pWnd = m_pDrawTabNotify->TabGetCWnd();
	int nMenuID = menu.TrackPopupMenu(TPM_VERPOSANIMATION | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,point.x,point.y,pWnd);
	menu.DestroyMenu();
	return nMenuID;
}
Ejemplo n.º 18
0
void CDConsoleDlg::OnRclickTreePatchgroups(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: Add your control notification handler code here
	*pResult = 0;
	CPoint pt, pmenu;
	::GetCursorPos(&pt);
	::GetCursorPos(&pmenu);
	m_PatchGroups.ScreenToClient(&pt);

	UINT uFlag = 0;
	HTREEITEM hSelectedItem = m_PatchGroups.HitTest(pt,&uFlag);
	if (NULL == hSelectedItem || !(TVHT_ONITEM & uFlag))
	{
		return;
	}

	m_PatchGroups.SelectItem(hSelectedItem);
	if (m_PatchGroups.GetParentItem(hSelectedItem) == NULL)
	{
		GroupInfo* pInfo = (GroupInfo*)m_PatchGroups.GetItemData(hSelectedItem);

		//组节点
		CMenu menu;
		menu.CreatePopupMenu();
		//menu.AppendMenu(MF_STRING, ID_MENU_SUBGROUP, _T("SubscribeGroup"));
		menu.AppendMenu(MF_STRING, ID_MENU_GETPATCHGROUPINFO, _T("GetPatchGroupInfo"));
		menu.AppendMenu(MF_STRING, ID_MENU_ADDPATCHROUPMEMBER, _T("AddMember"));
		menu.AppendMenu(MF_STRING, ID_MENU_DELPATCHROUPMEMBER, _T("DelMember"));
		menu.AppendMenu(MF_STRING, ID_MENU_SUB_JOIN_DCGROUP, _T("SubJoinGroup"));
		menu.AppendMenu(MF_STRING, ID_MENU_UNSUB_DCGROUP, _T("UnSubscribeGroup"));
		menu.AppendMenu(MF_STRING, ID_MENU_RMPATCHROUP, _T("RemovePatchGroup"));

		menu.TrackPopupMenu(0, pmenu.x, pmenu.y, this);
	}
}
Ejemplo n.º 19
0
void CUIEditorView::OnRButtonDown(UINT nFlags, CPoint point)
{
	g_CoreSystem.getCEGUISystem()->injectMousePosition(point.x, point.y);
	g_CoreSystem.getCEGUISystem()->injectMouseButtonDown(CEGUI::RightButton);

	if( getShowMode() == false ) return;

	CMenu menu;
	menu.CreatePopupMenu();
	CEGUI::Window* mouseWindow = g_CoreSystem.getCEGUISystem()->getWindowContainingMouse();
	bool showMenu = false;
	INT menuId = ID_RIGHT_WINDOW_SELECT;
	for ( ; mouseWindow ; mouseWindow = mouseWindow->getParent(),++menuId )
	{
		if (mouseWindow != CEGUI::System::getSingleton().getGUISheet() && !mouseWindow->isAutoWindow())
		{
			menu.AppendMenu(MF_STRING, menuId,mouseWindow->getName().c_str());
			showMenu = true;
		}		
	}
	if (showMenu)
	{
		POINT pos;
		GetCursorPos(&pos);
		menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,pos.x, pos.y, this);
		g_DataPool.OnSelectWindowChanged(NULL, m_pSelectedWindow);
	}
	CView::OnRButtonDown(nFlags, point);
}
Ejemplo n.º 20
0
VOID CDeskIconManager::MouseRClick(int nX,int nY)
{
	//个性化
	//rundll32.exe shell32.dll,Control_RunDLL desk.cpl,1,2
	
	HMODULE hShellMod = LoadLibrary(L"shell32.dll");

	if (hShellMod)
	{
		typedef void ( WINAPI *TypeRunDll32FunW)(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow);

		TypeRunDll32FunW pFun = (TypeRunDll32FunW)::GetProcAddress(hShellMod,"Control_RunDLLW");
		if (pFun)
		{
			pFun(m_wndShow,NULL,L"desk.cpl,1,2",SW_SHOW);
		}
	}


 	CMenu Menu;
 	Menu.CreatePopupMenu();
 	Menu.AppendMenu(MF_STRING,0,L"刷新(&E)");
	Menu.AppendMenu(MF_STRING,0,L"个性化(&R)");
	//Menu.AppendMenu(MF_STRING,0,L"个性化(&R)");
 	::TrackPopupMenu(Menu.m_hMenu,TPM_LEFTALIGN|TPM_TOPALIGN,nX,nY,0,m_wndShow,NULL);
	
}
Ejemplo n.º 21
0
// Intent: Works like COleServerDoc::OnGetEmbeddedItem
//		   Constructs a menu once to be used further
CMenu* COXRollup::OnGetSysMenu()
	{
	// this is our base implementation; you can override it if you want to
	CMenu *pSysMenu = new CMenu();
	VERIFY(pSysMenu->CreatePopupMenu());

	// add all menu items; for strings see string table in OXRollup.rc
	CString sMenuText;
	sMenuText.LoadString(IDS_OX_RUM_ROLLUP);
	pSysMenu->AppendMenu(MF_STRING | MF_ENABLED, IDM_OX_RU_ROLLUP, sMenuText);
	sMenuText.LoadString(IDS_OX_RUM_ROLLDOWN);
	pSysMenu->AppendMenu(MF_STRING | MF_ENABLED, IDM_OX_RU_ROLLDOWN, sMenuText);
	pSysMenu->AppendMenu(MF_SEPARATOR);
	sMenuText.LoadString(IDS_OX_RUM_ARRANGE);
	pSysMenu->AppendMenu(MF_STRING | MF_ENABLED, IDM_OX_RU_ARRANGE, sMenuText);
	sMenuText.LoadString(IDS_OX_RUM_ARRANGEALL);
	pSysMenu->AppendMenu(MF_STRING | MF_ENABLED, IDM_OX_RU_ARRANGEALL, sMenuText);
	pSysMenu->AppendMenu(MF_SEPARATOR);
	sMenuText.LoadString(IDS_OX_RUM_ABOUT);
	pSysMenu->AppendMenu(MF_STRING | MF_ENABLED, IDM_OX_RU_ABOUT, sMenuText);
	sMenuText.LoadString(IDS_OX_RUM_CLOSE);
	pSysMenu->AppendMenu(MF_STRING | MF_ENABLED, IDM_OX_RU_CLOSE, sMenuText);
	
	ASSERT_VALID(pSysMenu);
	return pSysMenu;
	}
Ejemplo n.º 22
0
void CClipboardListBox::OnRButtonUp(UINT nFlags, CPoint point)
{
	const UINT_PTR IDM_SELECTALL = 0x80fb;
	const UINT_PTR IDM_COPY = 0x80fc;
	const UINT_PTR IDM_CLEAR = 0x80fd;
	CMenu menu;
	menu.CreatePopupMenu();
	menu.InsertMenu(0, MF_BYPOSITION|MF_STRING, IDM_SELECTALL, "Select All");
	menu.InsertMenu(1, MF_BYPOSITION|MF_STRING, IDM_COPY, "Copy");
	menu.InsertMenu(2, MF_BYPOSITION|MF_STRING, IDM_CLEAR, "Clear");

	this->ClientToScreen(&point);
	UINT_PTR cmd = menu.TrackPopupMenu(TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD, point.x, point.y, this);

	if(IDM_COPY==cmd)
	{
		DoCopy();
	}
	else if(IDM_CLEAR==cmd)
	{
		ResetContent();
	}	
	else if(IDM_SELECTALL==cmd)
	{
		SelectAll();	
	}	
	return;
	//CListBox::OnRButtonUp(nFlags, point);
}
Ejemplo n.º 23
0
void CToolbarWnd::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
    CMenu menu;
    menu.CreatePopupMenu();
    menu.AppendMenu(MF_STRING, MP_TOGGLEDTOOLBAR, GetResString(IDS_CLOSETOOLBAR));
    menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
Ejemplo n.º 24
0
void DataCaptureGridCtrl::OnRButtonDown(UINT nFlags, CPoint point)
{
  CGridCellIndices currCell = GetCellIndices(point);
  int currRow = currCell.m_nRow;
  if ((currRow <= 0) || (currRow > dataCaptureData.Size()))
    return;

  m_currDCap = currRow - 1;

  CMenu popMenu;
  popMenu.CreatePopupMenu();

  UINT insFlags = MF_STRING;
  if (dataCaptureData.IsNotValid(m_currDCap))
    insFlags = MF_STRING | MF_GRAYED;

  VERIFY(popMenu.AppendMenu(insFlags, WM_DCAPM_INS_BEFORE,  "Insert Before" ));
  VERIFY(popMenu.AppendMenu(insFlags, WM_DCAPM_INS_AFTER, "Insert After" ));
  VERIFY(popMenu.AppendMenu(insFlags, WM_DCAPM_DUPLICATE, "Duplicate" ));
  VERIFY(popMenu.AppendMenu(MF_STRING, WM_DCAPM_DELETE, "Delete" ));

  ClientToScreen(&point);
  popMenu.TrackPopupMenu( TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x, point.y, this );

}
Ejemplo n.º 25
0
void CGroupDlg::OnMacroses() 
{
	CMenu menu;
	menu.CreatePopupMenu ();

	CString str;
	str.Format ("%%server%%  - %s", LS (L_SERVER_MACROS_DESC));
	menu.InsertMenu (0, MF_BYPOSITION | MF_STRING, ID_FOLDER_MACROS_0, str);

	str.Format ("%%path_on_server%%  - %s", LS (L_PATHONSERVER_MACROS_DESC));
	menu.InsertMenu (1, MF_BYPOSITION | MF_STRING, ID_FOLDER_MACROS_0 + 1, str);

	str.Format ("%%year%%  - %s", LS (L_YEAR_MACROS_DESC));
	menu.InsertMenu (2, MF_BYPOSITION | MF_STRING, ID_FOLDER_MACROS_0 + 2, str);

	str.Format ("%%month%%  - %s", LS (L_MONTH_MACROS_DESC));
	menu.InsertMenu (3, MF_BYPOSITION | MF_STRING, ID_FOLDER_MACROS_0 + 3, str);

	str.Format ("%%day%%  - %s", LS (L_DAY_MACROS_DESC));
	menu.InsertMenu (4, MF_BYPOSITION | MF_STRING, ID_FOLDER_MACROS_0 + 4, str);

	str.Format ("%%date%%  - %s", LS (L_DATE_MACROS_DESC));
	menu.InsertMenu (5, MF_BYPOSITION | MF_STRING, ID_FOLDER_MACROS_0 + 5, str);

	str.Format ("%%sdrive%% - %s", LS (L_STARTDRIVELETTER));
	menu.InsertMenu (6, MF_BYPOSITION | MF_STRING, ID_FOLDER_MACROS_0 + 6, str);

	CPoint pt;
	GetCursorPos (&pt);
	menu.TrackPopupMenu (TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_RIGHTALIGN, pt.x, pt.y, this);
}
Ejemplo n.º 26
0
void Playlist::OnRclickFilelist(NMHDR* pNMHDR, LRESULT* pResult)
{
	if (!m_FileList.GetItemCount()) return;

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

	if (m_FileList.GetSelectedCount()==1) {
		pPopup->AppendMenu(MF_STRING | MF_ENABLED, ID_PL_PLAY, "Play");
		pPopup->AppendMenu(MF_SEPARATOR, 0, "");
	}
	pPopup->AppendMenu(MF_STRING | MF_ENABLED, ID_PL_SEL_REV, "Inverse Selection");
	if (m_FileList.GetSelectedCount()) pPopup->AppendMenu(MF_STRING | MF_ENABLED, ID_PL_REM_FILE, "Remove File(s)");
	if (m_FileList.GetItemCount()>1) {
		pPopup->AppendMenu(MF_SEPARATOR, 0, "");
		pPopup->AppendMenu(MF_STRING | MF_ENABLED, ID_PL_SORT_TITLE, "Sort By Title");
		pPopup->AppendMenu(MF_STRING | MF_ENABLED, ID_PL_SORT_FILE, "Sort By File Name");
		pPopup->AppendMenu(MF_STRING | MF_ENABLED, ID_PL_SORT_DUR, "Sort By Duration");
		pPopup->AppendMenu(MF_SEPARATOR, 0, "");
		pPopup->AppendMenu(MF_STRING | MF_ENABLED, ID_PL_SORT_REV, "Reverse List");
		pPopup->AppendMenu(MF_STRING | MF_ENABLED, ID_PL_RANDOM, "Randomize");
	}

	POINT pt;
	GetCursorPos(&pt);
	pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this);
	delete pPopup;

	*pResult = 0;
}
Ejemplo n.º 27
0
BOOL CSkin::LoadMenu(CXMLElement* pXML)
{
	CString strName = pXML->GetAttributeValue( _T("name") );
	if ( strName.IsEmpty() ) return FALSE;
	
	CMenu* pMenu = NULL;
	
	if ( m_pMenus.Lookup( strName, (void*&)pMenu ) )
	{
		delete pMenu;
		m_pMenus.RemoveKey( strName );
	}
	
	pMenu = new CMenu();
	
	if ( pXML->GetAttributeValue( _T("type"), _T("popup") ).CompareNoCase( _T("bar") ) == 0 )
	{
		pMenu->CreateMenu();
	}
	else
	{
		pMenu->CreatePopupMenu();
	}
	
	if ( CreateMenu( pXML, pMenu->GetSafeHmenu() ) )
	{
		m_pMenus.SetAt( strName, pMenu );
		return TRUE;
	}
	else
	{
		delete pMenu;
		return FALSE;
	}
}
Ejemplo n.º 28
0
void CListCtrlEx::OnNotifyNmRClick()
{
	CMenu theMenu;
	theMenu.CreatePopupMenu();

	UINT nFlags;
	for (int i = 0; i < this->m_nColumnCount; i++)
	{
		nFlags = 0;
		if (i == 0)
			nFlags |= MF_DISABLED | MF_GRAYED;
		else
			nFlags |= MF_ENABLED;
		if (this->m_pColumnArray[i].iOrder > 0)
			nFlags |= MF_CHECKED;

		theMenu.AppendMenu(nFlags, ID_LIST_COLUMN_BASE + i, this->m_pColumnArray[i].name);
	}

	POINT curPos;
	::GetCursorPos(&curPos);
	theMenu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, 
						   curPos.x, curPos.y, 
						   this, NULL);
}
Ejemplo n.º 29
0
void CClosableTabCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
	if (m_bCloseable)
	{
		if (point.x == -1 || point.y == -1) {
			if (!SetDefaultContextMenuPos())
				return;
			point = m_ptCtxMenu;
			ClientToScreen(&point);
		}
		else {
			m_ptCtxMenu = point;
			ScreenToClient(&m_ptCtxMenu);
		}

		int iTab = GetTabUnderPoint(m_ptCtxMenu);
		if (iTab != -1)
		{
			if (GetParent()->SendMessage(UM_QUERYTAB, (WPARAM)iTab) == 0)
			{
				CMenu menu;
				menu.CreatePopupMenu();
				menu.AppendMenu(MF_STRING, MP_REMOVE, GetResString(IDS_FD_CLOSE));
				menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
			}
		}
	}
}
Ejemplo n.º 30
0
void CGameManageDlg::OnNMRclickList4(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: 在此添加控件通知处理程序代码

	//m_GameUeserListCtrl.Getse

	CMenu PopMenu;
	CString strMenu;
	PopMenu.CreatePopupMenu();
	CPoint Point;
	GetCursorPos(&Point);
	m_GameUeserListCtrl.ScreenToClient(&Point);
	m_ListIndex2 = m_GameUeserListCtrl.HitTest(Point);
	if (0 <= m_ListIndex2 && m_ListIndex2 < m_wSocket.m_UserManage.GetOnLineUserCount())
	{
		 PopMenu.AppendMenu(0, MSG_CMD_GM_ACT_NO_TALK, TEXT("禁止聊天"));
		 PopMenu.AppendMenu(0, MSG_CMD_GM_ACT_KICK_OUT, TEXT("踢出房间"));
		 PopMenu.AppendMenu(0, MSG_CMD_GM_ACT_BANDON_ID, TEXT("禁止登录"));
		 PopMenu.AppendMenu(0, MSG_CMD_CM_START_CHAT, TEXT("发起聊天"));
		 PopMenu.AppendMenu(0,  MSG_CMD_GM_ACT_AWORD, TEXT("奖励"));
		 //显示菜单

		 GetCursorPos(&Point);
		 PopMenu.TrackPopupMenu(TPM_RIGHTBUTTON, Point.x, Point.y, this);
		 PopMenu.DestroyMenu();
	}

	*pResult = 0;
}