本文整理汇总了C++中CCmdUI::SetRadio方法的典型用法代码示例。如果您正苦于以下问题:C++ CCmdUI::SetRadio方法的具体用法?C++ CCmdUI::SetRadio怎么用?C++ CCmdUI::SetRadio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCmdUI
的用法示例。
在下文中一共展示了CCmdUI::SetRadio方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCmdMsg
//.........这里部分代码省略.........
);
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;
case ID_HEIGHT_30PX: nBtnHeight = 30; break;
} // switch( nID )
if( nBtnHeight != 0 )
{
if( nCode == CN_UPDATE_COMMAND_UI )
{
CCmdUI * pCmdUI = (CCmdUI *)pExtra;
ASSERT( pCmdUI != NULL );
pCmdUI->Enable();
pCmdUI->SetRadio(
(m_nThinColorBtnHeight == nBtnHeight) ? TRUE : FALSE
);
}
else
{
if( m_nThinColorBtnHeight != nBtnHeight )
{
m_nThinColorBtnHeight = nBtnHeight;
CWnd::RepositionBars(0,0xFFFF,0);
m_wndToolBarColor.RedrawWindow();
}
}
return TRUE;
}
INT nColorCmdIndex =
m_wndToolBarColor.CommandToIndex( nID );
if( nColorCmdIndex >= 0 )
{
if( nCode == CN_UPDATE_COMMAND_UI )
{
CCmdUI * pCmdUI = (CCmdUI *)pExtra;
ASSERT( pCmdUI != NULL );
pCmdUI->Enable();
}
else
{
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
CExtCmdItem * pCmdItem =
g_CmdManager->CmdGetPtr(
_T("PageToolbars"),
nID
);
ASSERT( pCmdItem != NULL );
CString sMsg;
sMsg.Format(
_T("Command from the color toolbar:\n\n%s"),
pCmdItem->m_sMenuText
);
::AfxMessageBox( LPCTSTR(sMsg) );
}
return TRUE;
}
}
}
return CPageBase::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
示例2: OnContextMenu
/**
* Show context menu and handle user selection.
*/
void CLocationView::OnContextMenu(CWnd* pWnd, CPoint point)
{
if (point.x == -1 && point.y == -1)
{
//keystroke invocation
CRect rect;
GetClientRect(rect);
ClientToScreen(rect);
point = rect.TopLeft();
point.Offset(5, 5);
}
CRect rc;
CPoint pt = point;
GetClientRect(rc);
ScreenToClient(&pt);
BCMenu menu;
VERIFY(menu.LoadMenu(IDR_POPUP_LOCATIONBAR));
theApp.TranslateMenu(menu.m_hMenu);
BCMenu* pPopup = (BCMenu *) menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CCmdUI cmdUI;
cmdUI.m_pMenu = pPopup;
cmdUI.m_nIndexMax = cmdUI.m_pMenu->GetMenuItemCount();
for (cmdUI.m_nIndex = 0 ; cmdUI.m_nIndex < cmdUI.m_nIndexMax ; ++cmdUI.m_nIndex)
{
cmdUI.m_nID = cmdUI.m_pMenu->GetMenuItemID(cmdUI.m_nIndex);
switch (cmdUI.m_nID)
{
case ID_DISPLAY_MOVED_NONE:
cmdUI.SetRadio(m_displayMovedBlocks == DISPLAY_MOVED_NONE);
break;
case ID_DISPLAY_MOVED_ALL:
cmdUI.SetRadio(m_displayMovedBlocks == DISPLAY_MOVED_ALL);
break;
case ID_DISPLAY_MOVED_FOLLOW_DIFF:
cmdUI.SetRadio(m_displayMovedBlocks == DISPLAY_MOVED_FOLLOW_DIFF);
break;
}
}
CString strItem;
CString strNum;
int nLine = -1;
int bar = IsInsideBar(rc, pt);
// If cursor over bar, format string with linenumber, else disable item
if (bar != BAR_NONE)
{
// If outside bar area use left bar
if (bar == BAR_YAREA)
bar = BAR_LEFT;
nLine = GetLineFromYPos(pt.y, bar);
strNum.Format(_T("%d"), nLine + 1); // Show linenumber not lineindex
}
else
pPopup->EnableMenuItem(ID_LOCBAR_GOTODIFF, MF_GRAYED);
LangFormatString1(strItem, ID_LOCBAR_GOTOLINE_FMT, strNum);
pPopup->SetMenuText(ID_LOCBAR_GOTODIFF, strItem, MF_BYCOMMAND);
// invoke context menu
// we don't want to use the main application handlers, so we use flags TPM_NONOTIFY | TPM_RETURNCMD
// and handle the command after TrackPopupMenu
int command = pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, point.x, point.y, AfxGetMainWnd());
CMergeDoc* pDoc = GetDocument();
switch (command)
{
case ID_LOCBAR_GOTODIFF:
m_view[MERGE_VIEW_LEFT]->GotoLine(nLine, true, bar);
if (bar == BAR_LEFT || bar == BAR_RIGHT)
m_view[bar]->SetFocus();
break;
case ID_EDIT_WMGOTO:
m_view[MERGE_VIEW_LEFT]->WMGoto();
break;
case ID_DISPLAY_MOVED_NONE:
SetConnectMovedBlocks(DISPLAY_MOVED_NONE);
pDoc->SetDetectMovedBlocks(FALSE);
break;
case ID_DISPLAY_MOVED_ALL:
SetConnectMovedBlocks(DISPLAY_MOVED_ALL);
pDoc->SetDetectMovedBlocks(TRUE);
break;
case ID_DISPLAY_MOVED_FOLLOW_DIFF:
SetConnectMovedBlocks(DISPLAY_MOVED_FOLLOW_DIFF);
pDoc->SetDetectMovedBlocks(TRUE);
break;
}
}