Пример #1
0
void CvSqlQueryRichEditView::OnRButtonDown(UINT nFlags, CPoint point) 
{
	CRichEditView::OnRButtonDown(nFlags, point);
	CPoint p = point;
	ClientToScreen(&p);
	CRichEditCtrl& ctrl = GetRichEditCtrl();

	CMenu menu;
	VERIFY(menu.LoadMenu(IDR_RICHTEXT_POPUP));
	CMenu* pPopup = menu.GetSubMenu(0);
	ASSERT(pPopup != NULL);
	CWnd* pWndPopupOwner = this;

	long nStartChar= -1, nEndChar = -1;
	GetRichEditCtrl().GetSel(nStartChar, nEndChar);
	UINT nFlagCutCopy = (nStartChar != nEndChar)? MF_ENABLED: MF_DISABLED|MF_GRAYED;
	UINT nFlagPaste   = ::IsClipboardFormatAvailable(CF_TEXT)? MF_ENABLED: MF_DISABLED|MF_GRAYED; 
	UINT nFlagUndo   = ctrl.CanUndo()? MF_ENABLED: MF_DISABLED|MF_GRAYED; 

	pPopup->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND|nFlagCutCopy);
	pPopup->EnableMenuItem(ID_EDIT_CUT,  MF_BYCOMMAND|nFlagCutCopy);
	pPopup->EnableMenuItem(ID_EDIT_PASTE,  MF_BYCOMMAND|nFlagPaste);
	pPopup->EnableMenuItem(ID_EDIT_UNDO,  MF_BYCOMMAND|nFlagUndo);
	pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, p.x, p.y, pWndPopupOwner);
}
Пример #2
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);	
}
Пример #3
0
void CGh0stView::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CListView::OnRButtonDown(nFlags, point);

	CMenu	popup;
	popup.LoadMenu(IDR_LIST);
	CMenu*	pM = popup.GetSubMenu(0);
	CPoint	p;
	GetCursorPos(&p);
	int	count = pM->GetMenuItemCount();
	if (m_pListCtrl->GetSelectedCount() == 0)
	{
		for (int i = 0; i < count - 2; i++)
		{
			pM->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
		}
		pM->EnableMenuItem(count - 1, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);

	}
	
	// 全选
	if (m_pListCtrl->GetItemCount() > 0)
		pM->EnableMenuItem(count - 2, MF_BYPOSITION | MF_ENABLED);
	else
		pM->EnableMenuItem(count - 2, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
	
	pM->TrackPopupMenu(TPM_LEFTALIGN, p.x, p.y, this);
}
Пример #4
0
BOOL CFiveDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
    m_pDlg = NULL;
    CRect rect(0, 0, 200, 200);
    m_Table.CreateEx( WS_EX_CLIENTEDGE, _T("ChessTable"), NULL, WS_VISIBLE | WS_BORDER | WS_CHILD,
        CRect( 0, 0, 401, 478 ), this, IDC_TABLE );
    // 设置双方姓名
    SetDlgItemText( IDC_ST_ME, m_Table.m_strMe );
    SetDlgItemText( IDC_ST_ENEMY, _T("无玩家加入") );
    // 禁用“再玩”和“离开”
    CMenu *pMenu = GetMenu();
    pMenu->EnableMenuItem( ID_MENU_PLAYAGAIN, MF_DISABLED | MF_GRAYED | MF_BYCOMMAND );
    pMenu->EnableMenuItem( ID_MENU_LEAVE, MF_DISABLED | MF_GRAYED | MF_BYCOMMAND );
    // 捕获聊天输入框句柄,供处理回车使用
    m_hChat = FindWindowEx( GetDlgItem( IDC_CMB_CHAT )->GetSafeHwnd(), NULL, _T("Edit"), NULL );
    ::SendMessage( m_hChat, EM_LIMITTEXT, (WPARAM)128, 0);
    m_Table.Clear( TRUE );
    GetDlgItem( IDC_CMB_CHAT )->EnableWindow( FALSE );
    GetDlgItem( IDC_BTN_BACK )->EnableWindow( FALSE );
    GetDlgItem( IDC_BTN_HQ )->EnableWindow( FALSE );
    GetDlgItem( IDC_BTN_LOST )->EnableWindow( FALSE );

    GetDlgItem( IDC_TABLE )->SetFocus();
	return FALSE;  // return TRUE  unless you set the focus to a control
}
Пример #5
0
void CRegDlg::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	if(!isEnable) return;
	if( SelectNode== m_hRoot)
	{
		return;
	}
	
    CMenu	popup;
	popup.LoadMenu(IDR_REGL_MENU);
	CMenu*	pM = popup.GetSubMenu(0);
	CPoint	p;
	GetCursorPos(&p);
	
	if (m_list.GetSelectedCount() == 0)             //没有选中
	{
		pM->EnableMenuItem(0, MF_BYPOSITION | MF_GRAYED);     //编辑
		pM->EnableMenuItem(1, MF_BYPOSITION | MF_GRAYED);     //删除
	}else{
		if(getType(m_list.GetSelectionMark())==100)
			pM->EnableMenuItem(0, MF_BYPOSITION | MF_GRAYED);     //编辑
		pM->EnableMenuItem(2, MF_BYPOSITION | MF_GRAYED);         //新建
		
	}
   pM->TrackPopupMenu(TPM_LEFTALIGN, p.x, p.y, this);
	*pResult = 0;
}
Пример #6
0
void player_start_editor::OnInitMenu(CMenu* pMenu)
{
	int i;
	CMenu *m;

	// disable any items we should disable
	m = pMenu->GetSubMenu(0);

	// uncheck all menu items
	for (i = 0; i < Num_teams; i++ ){
		m->CheckMenuItem(i, MF_BYPOSITION | MF_UNCHECKED);
	}

	for ( i = Num_teams; i < MAX_TVT_TEAMS; i++ ){
		m->EnableMenuItem(i, MF_BYPOSITION | MF_GRAYED);
	}

	// put a check next to the currently selected item
	m->CheckMenuItem(selected_team, MF_BYPOSITION | MF_CHECKED);


	m = pMenu->GetSubMenu(1); 
	if (Num_teams > 1) {
		m->CheckMenuItem(ID_AUTOBALANCE, autobalance ? MF_CHECKED : MF_UNCHECKED); 
	}
	else {
		m->EnableMenuItem(ID_AUTOBALANCE, MF_GRAYED); 
	}
	
	CDialog::OnInitMenu(pMenu);
}
Пример #7
0
void CStatusCtrl::OnContextMenu(CWnd* pWnd, CPoint point)
{
    ClientToScreen(&point);

    CMenu menu;
    menu.LoadMenu(IDR_OUTPUTCONTEXT);

    CMenu* pPopup = menu.GetSubMenu(0);
    ASSERT(pPopup != NULL);
    CWnd* pWndPopupOwner = this;
    //while (pWndPopupOwner->GetStyle() & WS_CHILD)
    //	pWndPopupOwner = pWndPopupOwner->GetParent();

    if (!GetLineCount())
    {
        pPopup->EnableMenuItem(ID_OUTPUTCONTEXT_COPYTOCLIPBOARD,MF_GRAYED);
        pPopup->EnableMenuItem(ID_OUTPUTCONTEXT_CLEARALL,MF_GRAYED);
    }
    HCURSOR	hCursor;
    hCursor=AfxGetApp()->LoadStandardCursor( IDC_ARROW );
    m_doPopupCursor = TRUE;
    SetCursor(hCursor);

    pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
                           pWndPopupOwner);
}
void CLryEDBQryView::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	// TODO: Add your message handler code here
	CMenu Menu;	
	CMenu *pMenu;
	Menu.LoadMenu(IDR_POPUP_E_DATABASE);
	pMenu = Menu.GetSubMenu(0);

	if(pReportdlg.m_hWnd==NULL)
	{
		pMenu->EnableMenuItem(ID_FILE_PRINT_PREVIEW,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);
		pMenu->EnableMenuItem(ID_PRINT_REPORT_SETTING,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);
		pMenu->EnableMenuItem(ID_FILE_PRINT_PREVIEW,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);	
	} 
	CRect rect;
	CPoint pt;
	GetClientRect(&rect);
	pt = point;
	ScreenToClient(&pt);

	CWnd *pOwner = this;

	while(pOwner->GetStyle()&WS_CHILD)
	{
		pOwner = pOwner->GetParent();
	}

	if(PtInRect(rect,pt))
		pMenu->TrackPopupMenu(TPM_LEFTALIGN,point.x,point.y,pOwner); 
		//弹出自己的右键菜单
	else
		CXTListView::OnContextMenu(pWnd,point); //弹出默认的滚动条菜单		
}
Пример #9
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;
}
Пример #10
0
void CDownloads_History::OnRClick()
{
	CMenu menu;
	menu.LoadMenu (IDM_HISTORYITEMS);
	ApplyLanguageToMenu (&menu);
	CMenu *pPopup = menu.GetSubMenu (0);

	if (GetSelectedCount () != 1)
	{
		pPopup->EnableMenuItem (ID_LAUNCH, MF_BYCOMMAND | MF_GRAYED);
		pPopup->EnableMenuItem (ID_OPENFOLDER, MF_BYCOMMAND | MF_GRAYED);
		pPopup->EnableMenuItem (ID_URLTOCLIPBOARD, MF_BYCOMMAND | MF_GRAYED);
	}

	if (GetSelectedCount () == 0)
		pPopup->EnableMenuItem (ID_HSTITEM_DELETE, MF_BYCOMMAND | MF_GRAYED);

	m_odmenu.Attach (&menu, FALSE);
	
	CPoint pt (0,0);
	GetCursorPos (&pt);
	pPopup->TrackPopupMenu (TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_LEFTALIGN,	pt.x, pt.y, this);
	m_odmenu.Detach ();

	menu.DestroyMenu ();
}
Пример #11
0
// 리스트박스에서 오른쪽버튼눌렀을시
void CConnectDlg::OnRclickListServer(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	if(this->m_nClient == 0){	// 클라이언트 선택시에만
		NM_LISTVIEW *pNMListView = (NM_LISTVIEW *)pNMHDR;
		int intNum = pNMListView->iItem;
		/**
		if(intNum == -1){
			return;
		}
		**/
		m_nListIndex = intNum;	// 현재 선택되었다면 현재의 위치저장

		// TrackPopupMenu
		CMenu obMenu;
		obMenu.LoadMenu(IDR_MENU_SERVER_LIBRARY);
		CMenu *pPopupMenu = obMenu.GetSubMenu(0);
		ASSERT(pPopupMenu);
		CPoint obCursorPoint = (0, 0);
		GetCursorPos(&obCursorPoint);
		if(0 >= m_listServer.GetSelectedCount()){
			pPopupMenu->EnableMenuItem(ID_SERVER_LIBRARY_DELETE, MF_BYCOMMAND | MF_GRAYED | MF_DISABLED); 
		}else{
			pPopupMenu->EnableMenuItem(ID_SERVER_LIBRARY_DELETE, MF_BYCOMMAND | MF_ENABLED);
		}
		pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, obCursorPoint.x, obCursorPoint.y, this);
		
	}
	*pResult = 0;
}
Пример #12
0
LRESULT CResendDlg::OnListRClick(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
{
	CPoint pt;
    GetCursorPos(&pt);
    CMenu menu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_POPUPMENU));  
    CMenu submenu = menu.GetSubMenu(5);

    strconv_t strconv;
    CString sSelectAll = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("SelectAll"));
    CString sDeselectAll = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("DeselectAll"));
	CString sDeleteSelected = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("DeleteSelected"));
	CString sDeleteAll = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("DeleteAll"));

    MENUITEMINFO mii;
    memset(&mii, 0, sizeof(MENUITEMINFO));
    mii.cbSize = sizeof(MENUITEMINFO);
    mii.fMask = MIIM_STRING;

    mii.dwTypeData = sSelectAll.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU6_SELECTALL, FALSE, &mii);

    mii.dwTypeData = sDeselectAll.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU6_DESELECTALL, FALSE, &mii);

	mii.dwTypeData = sDeleteSelected.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU6_DELETESELECTED, FALSE, &mii);

	mii.dwTypeData = sDeleteAll.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU6_DELETEALL, FALSE, &mii);

	// Get count of checked list items
	int nItems = 0;
	int nChecked = 0;
	int i;
    for(i=0; i<m_listReports.GetItemCount(); i++)
    {
		nItems++;

		// If list item checked
		if(m_listReports.GetCheckState(i))
			nChecked++;
	}
	
	submenu.EnableMenuItem(ID_MENU6_SELECTALL, nItems>0?MF_ENABLED:MF_DISABLED);
	submenu.EnableMenuItem(ID_MENU6_DESELECTALL, nItems>0?MF_ENABLED:MF_DISABLED);	
	submenu.EnableMenuItem(ID_MENU6_DELETESELECTED, nChecked>0?MF_ENABLED:MF_DISABLED);
	submenu.EnableMenuItem(ID_MENU6_DELETEALL, nItems>0?MF_ENABLED:MF_DISABLED);

	submenu.TrackPopupMenu(0, pt.x, pt.y, m_hWnd);
    return 0;

	return 0;
}
Пример #13
0
void CDummyWnd::OnStopserver() 
{
	CMenu Menu;
	CMenu *pSub;

	Menu.LoadMenu(IDR_MENU);
	pSub = Menu.GetSubMenu(0);

	pSub->EnableMenuItem(ID_STARTSERVER, MF_BYCOMMAND | MF_ENABLED);
	pSub->EnableMenuItem(ID_STOPSERVER, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);

	KillTimer(0);
}
Пример #14
0
/**
 * WM_WATCHTAB_CONTEXTMENU handler. This message is sent by the tab
 * control on right mouse button click.
 *
 * @param           wparam: not used
 *                  lparam: pointer to WatchTabHitInfo
 * @return          0
 * @exception       -
 * @see             
*/
LRESULT CWatchWindow::OnWatchTabContextMenu (WPARAM wparam, LPARAM lparam)
{
    WatchTabHitInfo *pHitInfo;
    CMenu menuBar;
    CMenu *pMenu;
    bool bEnable;


    // LPARAM is a pointer to WatchTabHitInfo.
    //////////////////////////////////////////

    pHitInfo = (WatchTabHitInfo *)lparam;
    if (pHitInfo == NULL)
        return (0);


    // Remember the tab we hit (-1 if none). Menu item command
    // handlers might find this information useful.
    //////////////////////////////////////////////////////////

    m_iContextMenuTab = pHitInfo->m_iTabIndex;


    // Load the context menu and enable/disable menu items according to where the user clicked.
    // "Add Pane" is always enabled.
    // "Remove Pane" is enabled only if the user hit a tab, this tab is a custom pane tab and
    // we have more than one custom pane tab.
    ///////////////////////////////////////////////////////////////////////////////////////////

    if (!menuBar.LoadMenu (IDM_WATCH_TABMENU))
        return (0);

    pMenu = menuBar.GetSubMenu (0);
    if (pMenu == 0)
        return (0);

    pMenu->EnableMenuItem (ID_WATCH_ADD_PANE, MF_BYCOMMAND | MF_ENABLED);
    bEnable = m_iContextMenuTab != -1 &&
              m_iCustomPaneCount > 1 &&
              pHitInfo->m_iTabIndex >= 0 &&
              pHitInfo->m_iTabIndex < m_iCustomPaneCount;
    pMenu->EnableMenuItem (ID_WATCH_REMOVE_PANE, MF_BYCOMMAND | (bEnable ? MF_ENABLED : MF_GRAYED));


    // Show and track popup menu. Command handlers are called from inside here.
    ///////////////////////////////////////////////////////////////////////////

    pMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pHitInfo->m_Point.x, pHitInfo->m_Point.y, this);

    return (0);
}
Пример #15
0
BOOL CSkinWin::PopupSysMenu(CPoint point)
{
    CWnd * pWnd = CWnd::FromHandle(m_hWnd);
    CMenu SysMenu;
    HMENU HTest;  
    HTest = GetSystemMenu(m_hWnd, FALSE) ;
    if ( ! HTest )
	{
        return FALSE;
    }
    SysMenu.Attach( GetSystemMenu(m_hWnd, FALSE) );
//  when gray menuitem, a strange line appears!!
  
    try
    {
#if 0
		SysMenu.EnableMenuItem( SC_SIZE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED );
        if ( m_winstate == 0 )
        {
            SysMenu.EnableMenuItem( SC_MINIMIZE, MF_BYCOMMAND|MF_ENABLED );
            SysMenu.EnableMenuItem( SC_MAXIMIZE, MF_BYCOMMAND|MF_ENABLED );
            SysMenu.EnableMenuItem( SC_RESTORE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED );
        }    
        else if ( m_winstate == 1 )
        {
            SysMenu.EnableMenuItem( SC_MAXIMIZE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED );
            SysMenu.EnableMenuItem( SC_RESTORE, MF_BYCOMMAND|MF_ENABLED );
        }
        else if ( m_winstate == 2 )
        {
            SysMenu.EnableMenuItem( SC_MINIMIZE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED );
            SysMenu.EnableMenuItem( SC_RESTORE, MF_BYCOMMAND|MF_ENABLED );
        }
        
        if (!m_minable) 
        {
            SysMenu.EnableMenuItem( SC_MINIMIZE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        }
        
        if (!m_maxable) 
        {
            SysMenu.EnableMenuItem( SC_MAXIMIZE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        }
#endif            
        SysMenu.TrackPopupMenu( 0, point.x, point.y, pWnd  );        
        SysMenu.Detach();
    }

    catch (...) 
    {

    }
    OnNcPaint(0);
    return TRUE;
}
void CPropTreeItemFileEdit::OnContextMenu(CWnd *pWnd, CPoint point)
{

	CMenu FloatingMenu;
	VERIFY(FloatingMenu.LoadMenu(IDR_ME_EDIT_MENU));
	CMenu *pPopupMenu = FloatingMenu.GetSubMenu(0);

	if (CanUndo()) {
		pPopupMenu->EnableMenuItem(ID_EDIT_UNDO, MF_BYCOMMAND | MF_ENABLED);
	} else {
		pPopupMenu->EnableMenuItem(ID_EDIT_UNDO, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	DWORD dwSel = GetSel();

	if (HIWORD(dwSel) != LOWORD(dwSel)) {
		pPopupMenu->EnableMenuItem(ID_EDIT_CUT, MF_BYCOMMAND | MF_ENABLED);
		pPopupMenu->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND | MF_ENABLED);
		pPopupMenu->EnableMenuItem(ID_EDIT_DELETE, MF_BYCOMMAND | MF_ENABLED);
	} else {
		pPopupMenu->EnableMenuItem(ID_EDIT_CUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		pPopupMenu->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		pPopupMenu->EnableMenuItem(ID_EDIT_DELETE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
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());
}
Пример #18
0
void CDownloads_Groups::ShowHistoryContextMenu()
{
	CMenu menu;
	menu.LoadMenu (IDM_GROUP);
	CMenu *pPopup = menu.GetSubMenu (2);

	ApplyLanguageToMenu_History (pPopup);

	pPopup->SetDefaultItem (ID_HISTORY_SETTINGS);

	if (_DldsMgr.m_histmgr.GetRecordCount () == 0)
		pPopup->EnableMenuItem (ID_HISTORY_CLEAR, MF_BYCOMMAND | MF_GRAYED);

	CPoint pt (m_rbX, m_rbY);
	ClientToScreen (&pt);

	m_odmenu.Attach (&menu, FALSE);

	fsSetImage images [] =
	{
		fsSetImage (ID_HISTORY_CLEAR, 2),
		fsSetImage (ID_HISTORY_SETTINGS, 3),
	};

	m_odmenu.SetImages (images, sizeof (images) / sizeof (fsSetImage));

	pPopup->TrackPopupMenu (TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_LEFTALIGN,	pt.x, pt.y, this);
	m_odmenu.Detach ();

	menu.DestroyMenu ();
}
Пример #19
0
void CSpiderTaskTree::ShowContextMenu()
{
	HTREEITEM hItem = GetSelectedItem ();
	if (hItem == NULL)
		return;

	int iItem = FindTree (hItem);
	if (iItem == -1)
		return;

	CMenu menu;
	menu.LoadMenu (IDM_SPIDER_TREE);
	CMenu *pPopup = menu.GetSubMenu (0);

	CString str = LS (L_DONTDOWNLOADANDDEL); str += "\tDel";
	menu.ModifyMenu (ID_DONTDOWNLOADANDDEL, MF_BYCOMMAND|MF_STRING, ID_DONTDOWNLOADANDDEL, str);

	fsDLWebPage *wp = m_vConfs [iItem].wptree->GetData ();
	if (wp->dld == NULL || wp->dld->pMgr->IsDone ())
		pPopup->EnableMenuItem (ID_DONTDOWNLOADANDDEL, MF_BYCOMMAND | MF_GRAYED);

	ClientToScreen (&m_rbPt);
	pPopup->TrackPopupMenu (TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_LEFTALIGN,	m_rbPt.x, m_rbPt.y, this);
	menu.DestroyMenu ();
}
Пример #20
0
void CVideoRecvTestDlg::OnClose()
{

	if (IDYES != ::MessageBox(m_hWnd, "是否退出?", "",
		MB_ICONINFORMATION | MB_YESNO))
	{
		return;
	}

	CMenu* pMenu = this->GetSystemMenu(FALSE);
	pMenu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);

	GetDlgItem(IDC_BUTTON1)->EnableWindow(FALSE);
	GetDlgItem(IDC_BUTTON2)->EnableWindow(FALSE);
	GetDlgItem(IDC_BUTTON3)->EnableWindow(FALSE);
    

	KillTimer(1004);
	if(*m_hDevice)
	{
		HVAPI_SetCallBackEx(*m_hDevice, NULL, NULL, 0, CALLBACK_TYPE_H264_VIDEO, NULL);
		HVAPI_SetCallBackEx(*m_hDevice, NULL, NULL, 0, CALLBACK_TYPE_HISTORY_VIDEO, NULL);
	}

	if(m_hProceThread)
	{
		m_fIsQuit = TRUE;
		int iWaitTimes = 0;
		int MAX_WAIT_TIME = 8;
		while(WaitForSingleObject(m_hProceThread, 500) == WAIT_TIMEOUT
			&& iWaitTimes < MAX_WAIT_TIME)
		{
			iWaitTimes++;
		}
		if(iWaitTimes >= MAX_WAIT_TIME)
		{
			TerminateThread(m_hProceThread, 0);
		}
		CloseHandle(m_hProceThread);
		m_hProceThread = NULL;
	}

	while (!m_VideoFrameData.IsEmpty())
	{
		VideoFrameData cTmpInfo = m_VideoFrameData.RemoveHead();
		if (cTmpInfo.pVideoData)
		{
			delete [] cTmpInfo.pVideoData;
			cTmpInfo.pVideoData = NULL;
		}

		if(cTmpInfo.pszVideoExInfo)
		{
			delete[] cTmpInfo.pszVideoExInfo;
			cTmpInfo.pszVideoExInfo = NULL;
		}
	}

	CDialog::OnClose();
}
Пример #21
0
void CProcessManager::OnNMRClickList(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
	

	CMenu	popup;
	popup.LoadMenu(IDR_PROCESS_MENU);               
	CMenu*	pM = popup.GetSubMenu(0);                 
	CPoint	p;
	GetCursorPos(&p);
	int	count = pM->GetMenuItemCount();

	if (m_List.GetSelectedCount() == 0)         
	{ 
		for (int i = 0;i<count;i++)
		{
			if(i!=2)
			{
				pM->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);          
			}
		}

	}

	pM->TrackPopupMenu(TPM_LEFTALIGN, p.x, p.y, this);

	*pResult = 0;
}
Пример #22
0
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);
	}
Пример #23
0
/*
	PopUpMenu()
*/
void CWallBrowserFileView::PopUpMenu(const CPoint& point)
{
	CRect rect;
	CMenu menu;
	CMenu* pSubMenu = NULL;

	// coordinate dell'area client (CWnd, base 0,0)
	CWnd::GetClientRect(&rect);
	
	// trasforma le coordinate in assolute (schermo)
	// da aggiungere alle coordinate del click del mouse per ottenere le coordinate a cui visualizzare il menu a comparsa
	CWnd::ClientToScreen(&rect);	
	
	// click su un elemento del controllo
	if(GetListCtrl().HitTest(point) >= 0)
	{
		if(menu.LoadMenu(IDM_FILEPOPUP))
			pSubMenu = menu.GetSubMenu(0);
	}

	// visualizza il menu popup
	if(pSubMenu)
	{
		pSubMenu->EnableMenuItem(IDM_FILEPOPUP_PASTE,::IsClipboardFormatAvailable(CF_DIB) ? MF_ENABLED : MF_GRAYED);
		pSubMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x+rect.left,point.y+rect.top,this);
	}
}
////////////////////////////////////////////////////////////////////////////////////
////////////				ImageProcessing Menu Interfaces            /////////////
////////////////////////////////////////////////////////////////////////////////////
void CFPAnalysisView::OnEditUndo() 
{
  CWnd* pMain = GetParent();
  CFPAnalysisDoc* pDoc = GetDocument();
  CString szTitle = currentimage.GetFilename();

  if (pMain != NULL)
  {
	CMenu* pMenu = pMain->GetMenu();
	UINT state = pMenu->GetMenuState(ID_EDIT_UNDO, MF_BYCOMMAND);
	ASSERT(state != 0xFFFFFFFF);
		
	if (state & MF_GRAYED)
	{
			// do nothing if undo is grayed
	}
	else
	{
	   currentimage.SetOperationType(UNDO);
       currentimage.go();
	   pDoc->SetTitle(szTitle);  // if UNDO set caption to the filename
       pMenu->EnableMenuItem(ID_EDIT_UNDO, MF_DISABLED | MF_GRAYED); //disable undo
       Invalidate(TRUE);
	}
	
  }

}
void CFPAnalysisView::OnFileSave() 
{
  if (currentimage.OK())
	{
		if(AfxMessageBox("This will overwrite your existing file.", MB_ICONEXCLAMATION | MB_OKCANCEL)==IDOK)
		{
			
			CString sFilename = currentimage.GetFilename();
			CString sExt = sFilename.Right(3);

			if (!sExt.CompareNoCase("BMP"))
				currentimage.SaveBMP(sFilename);

			// disable undo after save	
			CWnd* pMain = GetParent();
			if (pMain != NULL)
			{
				CMenu* pMenu = pMain->GetMenu();
				pMenu->EnableMenuItem(ID_EDIT_UNDO, MF_DISABLED | MF_GRAYED);
			}

			Invalidate(TRUE);					// Refresh the entire view	
			
		}
	}	
}
Пример #26
0
void
CPropSheet::HideButtons()
{
    SetRedraw(FALSE);
    CWnd *wnd = GetDlgItem(0x3023);
    if (wnd) 
		wnd->ShowWindow(SW_HIDE);
    wnd = GetDlgItem(0x3024);
    if (wnd) 
		wnd->ShowWindow(SW_HIDE);
    wnd = GetDlgItem(0x3025);
    if (wnd) 
		wnd->ShowWindow(SW_HIDE);
    wnd = GetDlgItem(IDCANCEL);
    if (wnd) 
		wnd->ShowWindow(SW_HIDE);
	
    SetRedraw(TRUE);
    InvalidateRect(NULL,FALSE);

    CMenu *menu = GetSystemMenu(FALSE);
	if (menu)
		menu->EnableMenuItem(1, MF_BYPOSITION | MF_DISABLED);

}
Пример #27
0
void CDataView::OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult)
{
	CPoint point;
	::GetCursorPos(&point);

	CTreeCtrl & Tree = GetTreeCtrl(); 

	CGLSampleDoc *pDoc = GetDocument();

	CGeomEntity *pEntity = GetSelectedEntity(pDoc);

	if(pEntity == NULL)
		return;

	eGeometry eGeomType = pEntity->GetGeometryType();

	if(eGeomType == TL_BSPLINE)
	{
		CMenu menuMain;
		menuMain.LoadMenu(IDR_BSPLINE_CONTEXT);
		CMenu *pContextMenu = menuMain.GetSubMenu(0);
		//pContextMenu->EnableMenuItem( ID_BSPLINEDATACONTEXT_MODIFYBSPLINE, MF_BYCOMMAND | MF_DISABLED|MF_GRAYED );
		pContextMenu->EnableMenuItem( ID_BSPLINEDATACONTEXT_CHANGECOLOR, MF_BYCOMMAND | MF_DISABLED|MF_GRAYED );
		pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, GetActiveWindow());
	}
	else if(eGeomType == TL_BEAM)
	{
		CMenu menuItem;
		menuItem.LoadMenu(IDR_BEAM_SOLVE_CONTEXT);
		CMenu *pContextMenu = menuItem.GetSubMenu(0);
		pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, GetActiveWindow());
	}

	*pResult = 0;
}
Пример #28
0
void CMsgView::OnContextMenu(CWnd *pWnd, CPoint point) 
{
    CFrameWnd *pFrame;
    CMenu menu;
    CMenu *pPopupMenu;
    int nStart;
    int nEnd;
    UINT uiEnable;

    // make sure window is active

    pFrame = GetParentFrame ();
    ASSERT (pFrame != NULL);
    if (pFrame != NULL)
    {
        pFrame->ActivateFrame ();
    };

    if (!menu.LoadMenu (IDR_COMPILEVW_POPUP))
    {
        return;
    }
    pPopupMenu = menu.GetSubMenu (0);
    ASSERT (pPopupMenu != NULL);
    if (pPopupMenu == NULL)
    {
        return;
    }
    GetEditCtrl().GetSel(nStart, nEnd);
    uiEnable = (nStart == nEnd) ? MF_DISABLED | MF_GRAYED : MF_ENABLED;
    pPopupMenu->EnableMenuItem(IDM_MSG_COPY, uiEnable);
    pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
Пример #29
0
LRESULT CClientDlg::OnPatchTermSrv( WPARAM wp, LPARAM lp )
{
	BOOL bFlag=false;
	if (wcsstr((WCHAR*)wp,L"AutoAdminLogon"))
	{
		if (!wcsstr((WCHAR*)wp,L" is "))
		{
			if (wcsstr((WCHAR*)wp,L"Enable"))
				bFlag=true;

			CMenu* pMenu = GetMenu();

			if(pMenu)
			{
				UINT state = pMenu->GetMenuState(ID_TOOLS_AUTOLOGONON, MF_BYCOMMAND);
				if(state == 0xFFFFFFFF)
					return 0;
				pMenu->EnableMenuItem(ID_TOOLS_AUTOLOGONON,MF_BYCOMMAND );
				if (! bFlag)
				{
					pMenu->CheckMenuItem(ID_TOOLS_AUTOLOGONON, MF_UNCHECKED | MF_BYCOMMAND);
				}
				else
				{
					pMenu->CheckMenuItem(ID_TOOLS_AUTOLOGONON, MF_CHECKED | MF_BYCOMMAND);
				}

			}
		}
	}


	Log( (WCHAR*)wp );
	return 0;
}
Пример #30
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);
	}
}