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


C++ String::find_first_of方法代码示例

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

示例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++;
	}
}
开发者ID:agudpp,项目名称:CordobaZombie,代码行数:13,代码来源:MainGui.cpp

示例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);
}
开发者ID:yaroslav-tarasov,项目名称:test_osg,代码行数:49,代码来源:vis_settings_panel_impl.cpp

示例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 ;
}
开发者ID:wangfeilong321,项目名称:test_osg,代码行数:45,代码来源:menu_impl.cpp

示例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);
}
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:41,代码来源:WidgetDemo.cpp

示例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);
}
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:40,代码来源:WidgetDemo.cpp

示例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;
}
开发者ID:agudpp,项目名称:CordobaZombie,代码行数:23,代码来源:MainGui.cpp


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