本文整理汇总了C++中cegui::String::find_first_of方法的典型用法代码示例。如果您正苦于以下问题:C++ String::find_first_of方法的具体用法?C++ String::find_first_of怎么用?C++ String::find_first_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::String
的用法示例。
在下文中一共展示了String::find_first_of方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logFiredEvent
void WidgetDemo::logFiredEvent(const CEGUI::String& logMessage)
{
ListboxItem* item = d_widgetSelectorListbox->getFirstSelectedItem();
if(!item)
return;
CEGUI::String eventsLog = d_widgetsEventsLog->getText();
eventsLog += logMessage;
//Remove line
int pos = std::max<int>(static_cast<int>(eventsLog.length() - 2056), 0);
int len = std::min<int>(static_cast<int>(eventsLog.length()), 2056);
eventsLog = eventsLog.substr(pos, len);
if(len == 2056)
{
int newlinePos = eventsLog.find_first_of("\n");
if(newlinePos != std::string::npos)
eventsLog = eventsLog.substr(newlinePos, std::string::npos);
}
d_widgetsEventsLog->setText(eventsLog);
//Scroll to end
CEGUI::Scrollbar* scrollbar = static_cast<CEGUI::Scrollbar*>(d_widgetsEventsLog->getChild("__auto_vscrollbar__"));
scrollbar->setScrollPosition(scrollbar->getDocumentSize() - scrollbar->getPageSize());
}
示例2: RegisterForSpecificEvents
void MainGui::RegisterForSpecificEvents()
{
CEGUI::WindowManager::WindowIterator wIterator = CEGUI::WindowManager::getSingleton().getIterator();
while(!wIterator.isAtEnd()){
CEGUI::String st = wIterator.getCurrentKey();
int pos = st.find_first_of("@",0);
if(pos > -1){
wIterator.getCurrentValue()->subscribeEvent(CEGUI::PushButton::EventMouseButtonDown, CEGUI::Event::Subscriber(&MainGui::changeMenu,this));
}
wIterator++;
}
}
示例3: 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);
}
示例4: add_string
size_t menu_impl::add_string(std::string const &text, target const &click, target const &hover)
{
//QAction *act = addAction(QString::fromUtf8(text.c_str())) ;
//connect(act, SIGNAL(triggered()), this, SLOT(action_slot())) ;
CEGUI::String skin = base_->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();
auto menuItem = static_cast<CEGUI::MenuItem*>(windowManager.createWindow(menuItemMapping, text + "_MenuItem"));
menuItem->setText(text);
base_->addItem(menuItem);
if (click)
// actions_.insert(act, click) ;
{
menuItem->subscribeEvent(MenuItem::EventClicked,
Event::Subscriber([=](const CEGUI::EventArgs& args)->bool
{
click();
return true;
})
);
}
if (hover)
// hovers_.insert(act, hover) ;
{
menuItem->subscribeEvent(MenuItem::EventMouseEntersArea,
Event::Subscriber([=](const CEGUI::EventArgs& args)->bool
{
hover();
return true;
})
);
}
size_t act = 0;
return (size_t)act ;
}
示例5: initialiseAvailableWidgetsMap
void WidgetDemo::initialiseAvailableWidgetsMap()
{
//Retrieve the widget look types and add a Listboxitem for each widget, to the right scheme in the map
CEGUI::WindowFactoryManager& windowFactorymanager = CEGUI::WindowFactoryManager::getSingleton();
CEGUI::WindowFactoryManager::FalagardMappingIterator falMappingIter = windowFactorymanager.getFalagardMappingIterator();
while(!falMappingIter.isAtEnd())
{
CEGUI::String falagardBaseType = falMappingIter.getCurrentValue().d_windowType;
int slashPos = falagardBaseType.find_first_of('/');
CEGUI::String group = falagardBaseType.substr(0, slashPos);
CEGUI::String name = falagardBaseType.substr(slashPos + 1, falagardBaseType.size() - 1);
if(group.compare("SampleBrowserSkin") != 0)
{
std::map<CEGUI::String, WidgetListType>::iterator iter = d_skinListItemsMap.find(group);
if(iter == d_skinListItemsMap.end())
{
//Create new list
d_skinListItemsMap[group];
}
WidgetListType& widgetList = d_skinListItemsMap.find(group)->second;
addItemToWidgetList(name, widgetList);
}
++falMappingIter;
}
//Add the default types as well
d_skinListItemsMap["No Skin"];
WidgetListType& defaultWidgetsList = d_skinListItemsMap["No Skin"];
addItemToWidgetList("DefaultWindow", defaultWidgetsList);
addItemToWidgetList("DragContainer", defaultWidgetsList);
addItemToWidgetList("VerticalLayoutContainer", defaultWidgetsList);
addItemToWidgetList("HorizontalLayoutContainer", defaultWidgetsList);
addItemToWidgetList("GridLayoutContainer", defaultWidgetsList);
}
示例6: 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);
}
示例7: changeMenu
bool MainGui::changeMenu(const CEGUI::EventArgs & e)
{
Menu * aux;
const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(e);
CEGUI::String senderID = we.window->getName();
int pos = senderID.find_first_of("@",0);
CEGUI::String currentMenu= senderID.substr(0,pos);
CEGUI::String nextMenu= senderID.substr(pos+1,senderID.length());
map<CEGUI::String, Menu*>::iterator it1, it2;
it1 = mapaMenus.find(currentMenu);
it2 = mapaMenus.find(nextMenu);
aux = it1->second;
aux->animateMenu();
aux = it2->second;
aux->animateMenu();
return true;
}