本文整理汇总了C++中MenuItem::addChildWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItem::addChildWindow方法的具体用法?C++ MenuItem::addChildWindow怎么用?C++ MenuItem::addChildWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItem
的用法示例。
在下文中一共展示了MenuItem::addChildWindow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMenu
void InGameMenuWindow::createMenu(MenuBase* menu)
{
CEGUI::WindowManager* windowMan = CEGUI::WindowManager::getSingletonPtr();
const ActionVector actions = ActionManager::getSingleton().getInGameGlobalActions();
map<CeGuiString, PopupMenu*> menuGroups;
for (ActionVector::const_iterator actIter = actions.begin(); actIter != actions.end(); actIter++)
{
Action* action = *actIter;
ActionGroup* group = action->getGroup();
if (group != NULL)
{
PopupMenu* menuGrp;
map<CeGuiString, PopupMenu*>::iterator grpIter = menuGroups.find(group->getName());
if (grpIter != menuGroups.end())
{
menuGrp = (*grpIter).second;
}
else
{
MenuItem* grpItem = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
getNamePrefix()+"IngameMenu/"+group->getName()));
grpItem->setText(group->getName());
menu->addChildWindow(grpItem);
menuGrp = static_cast<PopupMenu*>(windowMan->createWindow("RastullahLook/PopupMenu",
getNamePrefix()+"IngameMenu/Menu"+group->getName()));
grpItem->addChildWindow(menuGrp);
menuGroups[group->getName()] = menuGrp;
}
MenuItem* item = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
getNamePrefix()+"IngameMenu/"+group->getName()+"/"+action->getName()));
item->setText(action->getDescription());
menuGrp->addChildWindow(item);
setAction(item, action);
}
}
}