本文整理汇总了C++中wxMenu::GetMenuItems方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMenu::GetMenuItems方法的具体用法?C++ wxMenu::GetMenuItems怎么用?C++ wxMenu::GetMenuItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxMenu
的用法示例。
在下文中一共展示了wxMenu::GetMenuItems方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectPopUpMenu
//Hack to allow use (events) of wxmenu inside a tool like simpletexttool
void hdDrawingView::connectPopUpMenu(wxMenu &mnu)
{
// Connect the main menu
mnu.Connect(wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &hdDrawingView::OnGenericPopupClick,
NULL,
this);
// Connect all submenus
wxMenuItem *item;
wxMenuItemList list = mnu.GetMenuItems();
for (unsigned int index = 0; index < list.GetCount(); index++)
{
wxMenuItemList::compatibility_iterator node = list.Item(index);
item = (wxMenuItem *) node->GetData();
if (item->IsSubMenu())
{
wxMenu *submenu = item->GetSubMenu();
submenu->Connect(wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &hdDrawingView::OnGenericPopupClick,
NULL,
this);
}
}
}
示例2: MouseRightDown
bool LocationView::MouseRightDown(const Point2D& mousePt, wxMenu& popupMenu)
{
if(IsClicked(mousePt))
{
if(popupMenu.GetMenuItems().size() == 0)
{
popupMenu.Append(ID_POPUP_MNU_PROPERTIES, wxT("Properties"));
}
return true;
}
return false;
}
示例3: SetMenu
void SetMenu( wxMenu* menu, const OS_string& items, EnabledCallback enabledCallback = NULL )
{
// protect the MRU so that it is only tied to one menu
HELIUM_ASSERT( m_Menu == NULL || m_Menu == menu );
m_Menu = menu;
m_MenuItemIDToString.clear();
// Clear out the old menu items
while ( m_Menu->GetMenuItemCount() > 0 )
{
m_Menu->Delete( *( m_Menu->GetMenuItems().begin() ) );
}
// Build a new list of menu items from the MRU
OS_string::ReverseIterator mruItr = items.ReverseBegin();
OS_string::ReverseIterator mruEnd = items.ReverseEnd();
for ( ; mruItr != mruEnd; ++mruItr )
{
const tstring& item = *mruItr;
wxMenuItem* menuItem = menu->Append( wxID_ANY, item.c_str() );
bool enabled = true;
if ( enabledCallback )
{
enabled = (*enabledCallback)( item );
}
if ( enabled )
{
Connect( menuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MenuMRUEvtHandler::OnMRUMenuItem ), NULL, this );
}
else
{
menuItem->SetItemLabel( ( item + TXT( " (missing)" ) ).c_str() );
menuItem->Enable( false );
}
m_MenuItemIDToString.insert( M_MenuItemIDToString::value_type( menuItem->GetId(), item ) );
}
}
示例4: ApplyBranding
void RebrandingHelper::ApplyBranding(wxMenu & menu, wxString scope)
{
size_t separatorIndex = 0;
wxMenuItemList & itemsList = menu.GetMenuItems();
for(auto itemIt = itemsList.begin(); itemIt != itemsList.end();++itemIt)
{
wxMenuItem * item = *itemIt;
if (!item) continue;
wxString name = menu.GetLabelText(item->GetId());
if (item->GetId() == wxID_SEPARATOR)
{
name = "Separator_";
name << separatorIndex;
separatorIndex++;
}
wxString itemScope = scope + "." + name;
if (ShouldDelete(itemScope)) menu.Destroy(item);
else if (ShouldRename(itemScope)) item->SetItemLabel(GetNewName(itemScope));
}
}