本文整理汇总了C++中cegui::PopupMenu::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PopupMenu::addItem方法的具体用法?C++ PopupMenu::addItem怎么用?C++ PopupMenu::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::PopupMenu
的用法示例。
在下文中一共展示了PopupMenu::addItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_menu_bar
void vis_settings_panel_impl::init_menu_bar(CEGUI::Menubar* menuBar)
{
CEGUI::String skin = menuBar->getType();
skin = skin.substr(0, skin.find_first_of('/'));
CEGUI::String menuItemMapping = skin + "/MenuItem";
CEGUI::String popupMenuMapping = skin + "/PopupMenu";
CEGUI::WindowManager& windowManager = CEGUI::WindowManager::getSingleton();
CEGUI::MenuItem* fileMenuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "FileMenuItem"));
fileMenuItem->setText("File");
menuBar->addChild(fileMenuItem);
CEGUI::PopupMenu* filePopupMenu = static_cast<CEGUI::PopupMenu*>(windowManager.createWindow(popupMenuMapping, "FilePopupMenu"));
fileMenuItem->addChild(filePopupMenu);
CEGUI::MenuItem* menuItem;
menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "FileTestMenuItem1"));
menuItem->setText("Open");
filePopupMenu->addItem(menuItem);
menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "FileTestMenuItem2"));
menuItem->setText("Save");
filePopupMenu->addItem(menuItem);
menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "FileTestMenuItem3"));
menuItem->setText("Exit");
filePopupMenu->addItem(menuItem);
menuItem->subscribeEvent(MenuItem::EventClicked,
Event::Subscriber([=](const CEGUI::EventArgs& args)->bool
{
exit_app_signal_();
return true;
})
);
CEGUI::MenuItem* viewMenuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "ViewMenuItem"));
viewMenuItem->setText("View");
menuBar->addChild(viewMenuItem);
CEGUI::PopupMenu* viewPopupMenu = static_cast<CEGUI::PopupMenu*>(windowManager.createWindow(popupMenuMapping, "ViewPopupMenu"));
viewMenuItem->addChild(viewPopupMenu);
menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "ViewTestMenuItem1"));
menuItem->setText("Lights");
viewPopupMenu->addItem(menuItem);
}
示例2: initMenubar
void WidgetDemo::initMenubar(CEGUI::Menubar* menuBar)
{
CEGUI::String skin = menuBar->getType();
skin = skin.substr(0, skin.find_first_of('/'));
CEGUI::String menuItemMapping = skin + "/MenuItem";
CEGUI::String popupMenuMapping = skin + "/PopupMenu";
CEGUI::WindowManager& windowManager = CEGUI::WindowManager::getSingleton();
CEGUI::MenuItem* fileMenuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "FileMenuItem"));
fileMenuItem->setText("File");
menuBar->addChild(fileMenuItem);
CEGUI::PopupMenu* filePopupMenu = static_cast<CEGUI::PopupMenu*>(windowManager.createWindow(popupMenuMapping, "FilePopupMenu"));
fileMenuItem->addChild(filePopupMenu);
CEGUI::MenuItem* menuItem;
menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "FileTestMenuItem1"));
menuItem->setText("Open");
filePopupMenu->addItem(menuItem);
menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "FileTestMenuItem2"));
menuItem->setText("Save");
filePopupMenu->addItem(menuItem);
menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "FileTestMenuItem3"));
menuItem->setText("Exit");
filePopupMenu->addItem(menuItem);
CEGUI::MenuItem* viewMenuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "ViewMenuItem"));
fileMenuItem->setText("View");
menuBar->addChild(viewMenuItem);
CEGUI::PopupMenu* viewPopupMenu = static_cast<CEGUI::PopupMenu*>(windowManager.createWindow(popupMenuMapping, "ViewPopupMenu"));
viewMenuItem->addChild(viewPopupMenu);
menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, "ViewTestMenuItem1"));
menuItem->setText("Midgets");
viewPopupMenu->addItem(menuItem);
}