本文整理汇总了C++中CCmdUI::Enable方法的典型用法代码示例。如果您正苦于以下问题:C++ CCmdUI::Enable方法的具体用法?C++ CCmdUI::Enable怎么用?C++ CCmdUI::Enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCmdUI
的用法示例。
在下文中一共展示了CCmdUI::Enable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCmdMsg
BOOL CPopupFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
if (m_pMenu != NULL && pHandlerInfo == NULL)
{
if (nCode == CN_COMMAND)
{
if (m_pMenu->SelectItem(nID) == S_OK)
return TRUE;
}
else if (nCode == CN_UPDATE_COMMAND_UI)
{
CCmdUI* pCmdUI = (CCmdUI*)pExtra;
long lState;
if (m_pMenu->GetItemState(pCmdUI->m_nID, &lState) == S_OK)
{
pCmdUI->Enable((lState & MenuStateDisable) == 0);
pCmdUI->SetCheck((lState & MenuStateCheck) != 0);
return TRUE;
}
}
}
return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
示例2: OnUIEnableEvent
LRESULT CPIMDIFrameWndEx::OnUIEnableEvent(WPARAM wParam, LPARAM lParam)
{
CCmdUI* pCmdUI = (CCmdUI*)wParam;
ASSERT(pCmdUI != NULL);
BOOL bEnable = (BOOL)lParam;
pCmdUI->Enable(bEnable);
return 0;
}
示例3: OnCmdMsg
BOOL CPageToolbars::OnCmdMsg(UINT nID, INT nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
if( !m_bInitComplete ){
return CPageBase::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
if( nCode == CN_UPDATE_COMMAND_UI
|| nCode == CN_COMMAND
)
{
if( nID == ID_MYEXTBTN_SLIDER || nID == ID_MYEXTBTN_SCROLLER ) {
if( nCode == CN_UPDATE_COMMAND_UI ){
CCmdUI * pCmdUI = (CCmdUI *)pExtra;
ASSERT( pCmdUI != NULL );
pCmdUI->Enable();
}
return TRUE;
}
if( nID == ID_COMBOBOX_IN_TOOLBAR
|| nID == ID_COMBOBOX_IN_MENUBAR
|| nID == ID_EDIT_IN_TOOLBAR
|| nID == ID_EDIT_IN_MENUBAR
|| nID == ID_CHECKBOX_IN_TOOLBAR
|| nID == ID_CHECKBOX_IN_MENUBAR
|| nID == ID_LINE_WIDTH_0
|| nID == ID_LINE_WIDTH_1
|| nID == ID_LINE_WIDTH_2
|| nID == ID_LINE_WIDTH_3
|| nID == ID_LINE_WIDTH_4
|| nID == ID_LINE_WIDTH_5
|| nID == ID_LINE_WIDTH_6
|| nID == ID_LINE_WIDTH_7
|| nID == ID_LINE_WIDTH_8
|| nID == ID_LINE_WIDTH_9
|| nID == ID_LINE_WIDTH_10
|| nID == ID_LINE_WIDTH_OTHER
)
{
if( nCode == CN_UPDATE_COMMAND_UI ){
CCmdUI * pCmdUI = (CCmdUI *)pExtra;
ASSERT( pCmdUI != NULL );
pCmdUI->Enable();
}
return TRUE;
}
if( nID == IDC_CHECK_SHOW_GRIPPER ) {
if( nCode == CN_COMMAND ){
bool bDlgButtonChecked = ( IsDlgButtonChecked( nID ) == BST_CHECKED );
m_wndToolBarColor.SetBarStyle(
bDlgButtonChecked
? m_wndToolBarColor.GetBarStyle() | CBRS_GRIPPER
: m_wndToolBarColor.GetBarStyle() & ~CBRS_GRIPPER
);
m_wndToolBarPalette.SetBarStyle(
bDlgButtonChecked
? m_wndToolBarPalette.GetBarStyle() | CBRS_GRIPPER
: m_wndToolBarPalette.GetBarStyle() & ~CBRS_GRIPPER
);
m_wndToolBar.SetBarStyle(
bDlgButtonChecked
? m_wndToolBar.GetBarStyle() | CBRS_GRIPPER
: m_wndToolBar.GetBarStyle() & ~CBRS_GRIPPER
);
m_wndMenuBar.SetBarStyle(
bDlgButtonChecked
? m_wndMenuBar.GetBarStyle() | CBRS_GRIPPER
: m_wndMenuBar.GetBarStyle() & ~CBRS_GRIPPER
);
m_wndToolBarControls1.SetBarStyle(
bDlgButtonChecked
? m_wndToolBarControls1.GetBarStyle() | CBRS_GRIPPER
: m_wndToolBarControls1.GetBarStyle() & ~CBRS_GRIPPER
);
m_wndToolBarControls2.SetBarStyle(
bDlgButtonChecked
? m_wndToolBarControls2.GetBarStyle() | CBRS_GRIPPER
: m_wndToolBarControls2.GetBarStyle() & ~CBRS_GRIPPER
);
_Update();
}
}
if( m_wndToolBarColor.GetSafeHwnd() != NULL )
{
INT nBtnHeight = 0;
switch( nID )
{
case ID_HEIGHT_8PX: nBtnHeight = 8; break;
case ID_HEIGHT_10PX: nBtnHeight = 10; break;
case ID_HEIGHT_12PX: nBtnHeight = 12; break;
case ID_HEIGHT_14PX: nBtnHeight = 14; break;
case ID_HEIGHT_16PX: nBtnHeight = 16; break;
case ID_HEIGHT_18PX: nBtnHeight = 18; break;
case ID_HEIGHT_20PX: nBtnHeight = 20; break;
case ID_HEIGHT_22PX: nBtnHeight = 22; break;
case ID_HEIGHT_24PX: nBtnHeight = 24; break;
case ID_HEIGHT_26PX: nBtnHeight = 26; break;
case ID_HEIGHT_28PX: nBtnHeight = 28; break;
//.........这里部分代码省略.........