本文整理汇总了C++中wxStripMenuCodes函数的典型用法代码示例。如果您正苦于以下问题:C++ wxStripMenuCodes函数的具体用法?C++ wxStripMenuCodes怎么用?C++ wxStripMenuCodes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxStripMenuCodes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxASSERT_MSG
wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
int id,
const wxString& t,
const wxString& strHelp,
wxItemKind kind,
wxMenu *pSubMenu)
:wxMenuItemBase(pParentMenu, id, t, strHelp, kind, pSubMenu)
{
wxASSERT_MSG( id != 0 || pSubMenu != NULL , wxT("A MenuItem ID of Zero does not work under Mac") ) ;
// In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines
// therefore these item must not be translated
if (pParentMenu != NULL && !pParentMenu->GetNoEventsMode())
if ( wxStripMenuCodes(m_text).Upper() == wxT("EXIT") )
m_text = wxT("Quit\tCtrl+Q") ;
m_radioGroup.start = -1;
m_isRadioGroupStart = false;
wxString text = wxStripMenuCodes(m_text, (pParentMenu != NULL && pParentMenu->GetNoEventsMode()) ? wxStrip_Accel : wxStrip_All);
if (text.IsEmpty() && !IsSeparator())
{
wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
}
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
// use accessors for ID and Kind because they might have been changed in the base constructor
m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, entry, strHelp, GetKind(), pSubMenu );
delete entry;
}
示例2: wxStripMenuCodes
//
// Find the itemString in menuString, and return the item id or wxNOT_FOUND
//
int wxMenuBar::FindMenuItem(
const wxString& rMenuString
, const wxString& rItemString
) const
{
wxString sMenuLabel = wxStripMenuCodes(rMenuString);
size_t nCount = GetMenuCount(), i;
wxMenuList::const_iterator it;
#if defined(__INTEL_COMPILER) && 1 // VDM auto patch
# pragma ivdep
# pragma swp
# pragma unroll
#endif
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for (i = 0, it = m_menus.begin(); i < nCount; i++, it++)
{
wxString sTitle = wxStripMenuCodes(m_titles[i]);
if (rMenuString == sTitle)
return (*it)->FindItem(rItemString);
}
return wxNOT_FOUND;
} // end of wxMenuBar::FindMenuItem
示例3: switch
void wxGISToolBar::AddCommand(wxGISCommand* pCmd)
{
switch(pCmd->GetKind())
{
case enumGISCommandMenu:
return;
case enumGISCommandSeparator:
case enumGISCommandCheck:
case enumGISCommandRadio:
case enumGISCommandNormal:
{
wxBitmap Bitmap = pCmd->GetBitmap();
if(!Bitmap.IsOk())
Bitmap = wxBitmap(tool_16_xpm);
AddTool(pCmd->GetID(), wxStripMenuCodes(pCmd->GetCaption()), Bitmap, wxBitmap(), (wxItemKind)pCmd->GetKind(), pCmd->GetTooltip(), pCmd->GetMessage(), NULL);
}
break;
case enumGISCommandDropDown:
{
wxBitmap Bitmap = pCmd->GetBitmap();
if(!Bitmap.IsOk())
Bitmap = wxBitmap(tool_16_xpm);
AddTool(pCmd->GetID(), wxStripMenuCodes(pCmd->GetCaption()), Bitmap, wxBitmap(), (wxItemKind)enumGISCommandNormal, pCmd->GetTooltip(), pCmd->GetMessage(), NULL);
SetToolDropDown(pCmd->GetID(), true);
}
break;
case enumGISCommandControl:
{
IToolControl* pToolCtrl = dynamic_cast<IToolControl*>(pCmd);
if(pToolCtrl)
{
IToolBarControl* pToolBarControl = pToolCtrl->GetControl();
wxControl* pControl = dynamic_cast<wxControl*>(pToolBarControl);
if(pControl)
{
if(pToolCtrl->HasToolLabel())
{
wxString sToolLabel = pToolCtrl->GetToolLabel();
AddLabel(wxID_ANY, sToolLabel, sToolLabel.Len() * 5);
}
pControl->Reparent(this);
AddControl(pControl);
//add ctrl to remove map
m_RemControlMap[m_CommandArray.size()] = pToolBarControl;
}
else return;
}
else return;
}
break;
default: return;
}
wxGISCommandBar::AddCommand(pCmd);
Realize();
}
示例4: wxStripMenuCodes
// Find the menu menuString, item itemString, and return the item id.
// Returns -1 if none found.
int wxMenuBar::FindMenuItem(const wxString& menuString, const wxString& itemString) const
{
const wxString stripped = wxStripMenuCodes(menuString);
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
{
if ( wxStripMenuCodes(m_titles[i]) == stripped )
return m_menus.Item(i)->GetData()->FindItem (itemString);
}
return wxNOT_FOUND;
}
示例5: wxStripMenuCodes
// Find the itemString in menuString, and return the item id or wxNOT_FOUND
int wxMenuBar::FindMenuItem(const wxString& menuString,
const wxString& itemString) const
{
wxString menuLabel = wxStripMenuCodes(menuString);
size_t count = GetMenuCount();
for ( size_t i = 0; i < count; i++ )
{
wxString title = wxStripMenuCodes(m_titles[i]);
if ( menuLabel == title )
return _wxMenuAt(m_menus, i)->FindItem(itemString);
}
return wxNOT_FOUND;
}
示例6: MacPreControlCreate
bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[],
int majorDim, long style,
const wxValidator& val, const wxString& name)
{
if ( !wxControl::Create(parent, id, pos, size, style, val, name) )
return false;
int i;
m_noItems = n;
m_noRowsOrCols = majorDim;
m_radioButtonCycle = NULL;
if (majorDim==0)
m_majorDim = n ;
else
m_majorDim = majorDim ;
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , wxStripMenuCodes(label) , pos , size ,style, val , name , &bounds , title ) ;
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlGroupBoxTextTitleProc , (long) this ) ;
for (i = 0; i < n; i++)
{
wxRadioButton *radBtn = new wxRadioButton
(
this,
wxID_ANY,
wxStripMenuCodes(choices[i]),
wxPoint(5,20*i+10),
wxDefaultSize,
i == 0 ? wxRB_GROUP : 0
);
if ( i == 0 )
m_radioButtonCycle = radBtn ;
// m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle);
}
SetSelection(0);
MacPostControlCreate() ;
return true;
}
示例7: wxFindMnemonic
void wxMenuItem::SetItemLabel(const wxString& label)
{
char mnem = wxFindMnemonic (label);
wxString label2 = wxStripMenuCodes(label);
m_text = label;
if (m_buttonWidget)
{
wxXmString label_str(label2);
XtVaSetValues ((Widget) m_buttonWidget,
XmNlabelString, label_str(),
NULL);
if (mnem != 0)
XtVaSetValues ((Widget) m_buttonWidget, XmNmnemonic, mnem, NULL);
char *accel = wxFindAccelerator (label2);
if (accel)
XtVaSetValues ((Widget) m_buttonWidget, XmNaccelerator, accel, NULL);
XmString accel_str = wxFindAcceleratorText (label2);
if (accel_str)
{
XtVaSetValues ((Widget) m_buttonWidget, XmNacceleratorText, accel_str, NULL);
XmStringFree (accel_str);
}
}
}
示例8: GetCount
wxSize wxRadioBox::GetMaxButtonSize() const
{
// calculate the max button size
int widthMax = 0,
heightMax = 0;
const int count = GetCount();
for ( int i = 0 ; i < count; i++ )
{
int width, height;
if ( m_radioWidth[i] < 0 )
{
GetTextExtent(wxStripMenuCodes(wxGetWindowText((*m_radioButtons)[i])), &width, &height);
// adjust the size to take into account the radio box itself
// FIXME this is totally bogus!
width += RADIO_SIZE;
height *= 3;
height /= 2;
}
else
{
width = m_radioWidth[i];
height = m_radioHeight[i];
}
if ( widthMax < width )
widthMax = width;
if ( heightMax < height )
heightMax = height;
}
return wxSize(widthMax, heightMax);
}
示例9: wxCHECK_MSG
wxString wxMenuBar::GetLabelTop(size_t pos) const
{
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
wxT("invalid menu index in wxMenuBar::GetLabelTop") );
return wxStripMenuCodes(m_titles[pos]);
}
示例10: wxStripMenuCodes
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
m_macIsUserPane = FALSE ;
m_label = wxStripMenuCodes(label) ;
if ( !wxControl::Create( parent, id, pos, size, style,
wxDefaultValidator , name ) )
{
return false;
}
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ;
m_peer = new wxMacControl(this) ;
verify_noerr(CreateStaticTextControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, str ,
NULL , m_peer->GetControlRefAddr() ) ) ;
MacPostControlCreate(pos,size) ;
return true;
}
示例11: wxGetWindowText
wxSize wxToggleButton::DoGetBestSize() const
{
wxString label = wxGetWindowText(GetHWND());
int wBtn;
GetTextExtent(wxStripMenuCodes(label), &wBtn, NULL);
int wChar, hChar;
wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont());
// add a margin - the button is wider than just its label
wBtn += 3*wChar;
// the button height is proportional to the height of the font used
int hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hChar);
#if wxUSE_BUTTON
wxSize sz = wxButton::GetDefaultSize();
if (wBtn > sz.x)
sz.x = wBtn;
if (hBtn > sz.y)
sz.y = hBtn;
#else
wxSize sz(wBtn, hBtn);
#endif
CacheBestSize(sz);
return sz;
}
示例12: GetFontToUse
bool wxOwnerDrawnBase::OnMeasureItem(size_t *width, size_t *height)
{
if ( IsOwnerDrawn() )
{
wxMemoryDC dc;
wxFont font;
GetFontToUse(font);
dc.SetFont(font);
// item name/text without mnemonics
wxString name = wxStripMenuCodes(GetName(), wxStrip_Mnemonics);
wxCoord w, h;
dc.GetTextExtent(name, &w, &h);
*width = w + m_margin;
*height = h;
}
else
{
*width = 0;
*height = 0;
}
return true;
}
示例13: wxCHECK_MSG
bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
{
WXHMENU submenu = menu ? menu->GetHMenu() : 0;
wxCHECK_MSG( submenu, false, wxT("can't append invalid menu to menubar") );
if ( !wxMenuBarBase::Append(menu, title) )
return false;
menu->wxMenuBase::SetTitle(title);
#if defined(WINCE_WITHOUT_COMMANDBAR)
if (IsAttached())
#else
if (GetHmenu())
#endif
{
#if defined(WINCE_WITHOUT_COMMANDBAR)
if (!GetToolBar())
return false;
TBBUTTON tbButton;
memset(&tbButton, 0, sizeof(TBBUTTON));
tbButton.iBitmap = I_IMAGENONE;
tbButton.fsState = TBSTATE_ENABLED;
tbButton.fsStyle = TBSTYLE_DROPDOWN | TBSTYLE_NO_DROPDOWN_ARROW | TBSTYLE_AUTOSIZE;
size_t pos = GetMenuCount();
HMENU hPopupMenu = (HMENU) menu->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(title);
tbButton.iString = (int) label.wx_str();
tbButton.idCommand = NewControlId();
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
{
wxLogLastError(wxT("TB_INSERTBUTTON"));
return false;
}
#else
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
(UINT_PTR)submenu, title.wx_str()) )
{
wxLogLastError(wxT("AppendMenu"));
}
#endif
#if wxUSE_ACCEL
if ( menu->HasAccels() )
{
// need to rebuild accelerator table
RebuildAccelTable();
}
#endif // wxUSE_ACCEL
if (IsAttached())
Refresh();
}
return true;
}
示例14: wxStripMenuCodes
//
// Find the itemString in menuString, and return the item id or wxNOT_FOUND
//
int wxMenuBar::FindMenuItem(
const wxString& rMenuString
, const wxString& rItemString
) const
{
wxString sMenuLabel = wxStripMenuCodes(rMenuString);
size_t nCount = GetMenuCount(), i;
wxMenuList::const_iterator it;
for (i = 0, it = m_menus.begin(); i < nCount; i++, it++)
{
wxString sTitle = wxStripMenuCodes(m_titles[i]);
if (rMenuString == sTitle)
return (*it)->FindItem(rItemString);
}
return wxNOT_FOUND;
} // end of wxMenuBar::FindMenuItem
示例15: wxMacGetBoundsForControl
bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[],
int majorDim, long style,
const wxValidator& val, const wxString& name)
{
m_macIsUserPane = false ;
if ( !wxControl::Create(parent, id, pos, size, style, val, name) )
return false;
int i;
m_noItems = n;
m_noRowsOrCols = majorDim;
m_radioButtonCycle = NULL;
if (majorDim==0)
m_majorDim = n ;
else
m_majorDim = majorDim ;
m_label = label ;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
if( bounds.right <= bounds.left )
bounds.right = bounds.left + 100 ;
if ( bounds.bottom <= bounds.top )
bounds.bottom = bounds.top + 100 ;
m_peer = new wxMacControl(this) ;
verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
true /*primary*/ , m_peer->GetControlRefAddr() ) ) ;
for (i = 0; i < n; i++)
{
wxRadioButton *radBtn = new wxRadioButton
(
this,
wxID_ANY,
wxStripMenuCodes(choices[i]),
wxPoint(5,20*i+10),
wxDefaultSize,
i == 0 ? wxRB_GROUP : 0
);
if ( i == 0 )
m_radioButtonCycle = radBtn ;
// m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle);
}
SetSelection(0);
MacPostControlCreate(pos,size) ;
return true;
}