当前位置: 首页>>代码示例>>C++>>正文


C++ wxMenu::GetMenuItems方法代码示例

本文整理汇总了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);
        }
    }
}
开发者ID:dragansah,项目名称:pgadmin3,代码行数:26,代码来源:hdDrawingView.cpp

示例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;
}
开发者ID:jjhoyt,项目名称:gengis,代码行数:14,代码来源:LocationView.cpp

示例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 ) );
        }
    }
开发者ID:foolhuang,项目名称:Helium,代码行数:43,代码来源:MenuMRU.cpp

示例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));
	}
}
开发者ID:HaoDrang,项目名称:GD,代码行数:24,代码来源:RebrandingHelper.cpp


注:本文中的wxMenu::GetMenuItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。