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


C++ cegui::Listbox类代码示例

本文整理汇总了C++中cegui::Listbox的典型用法代码示例。如果您正苦于以下问题:C++ Listbox类的具体用法?C++ Listbox怎么用?C++ Listbox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Listbox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RemoveOnline

/***********************************************************
remove people online
***********************************************************/
void CommunityBox::RemoveOnline(const std::string & listname, const std::string &_offline)
{
	if(listname == "online")
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist"));


		std::map<std::string, CEGUI::ListboxItem *>::iterator itmap = _onlines.find(_offline);
		if(itmap != _onlines.end())
		{
			lb->removeItem(itmap->second);
			_onlines.erase(itmap);
		}

		UpdateFriendOnlineStatus(_offline);
	}

	if(listname == "IRC")
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/IRClist"));

		CEGUI::ListboxItem *it = lb->findItemWithText(_offline, NULL);
		if(it != NULL)
			lb->removeItem(it);
	}
}
开发者ID:leloulight,项目名称:lbanet,代码行数:31,代码来源:CommunityBox.cpp

示例2: HandleWorldSelected

/***********************************************************
handle world selected event
***********************************************************/
bool ChooseWorldGUI::HandleWorldSelected (const CEGUI::EventArgs& e)
{
	try
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("ChooseWorldList"));
		if(lb)
		{
			size_t idx = lb->getItemIndex(lb->getFirstSelectedItem());
			if(idx < _wlist.size())
			{
				CEGUI::MultiLineEditbox * eb = static_cast<CEGUI::MultiLineEditbox *> (
					CEGUI::WindowManager::getSingleton().getWindow("ChooseWorldDescription"));
				if(eb)
				{
					eb->setText(_wlist[idx].Description);
				}

				_selectedworld = _wlist[idx].WorldName;
			}
		}
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init the world list: ") + ex.getMessage().c_str());
		_root = NULL;
	}

	return true;
}
开发者ID:leloulight,项目名称:lbanet,代码行数:33,代码来源:ChooseWorldGUI.cpp

示例3: HandleAddFriend

/***********************************************************
handle event when add friend clicked
***********************************************************/
bool CommunityBox::HandleAddFriend(const CEGUI::EventArgs& e)
{
	CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
		CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"));

	// check if we accept pending friend
	const CEGUI::ListboxTextItem * it = static_cast<const CEGUI::ListboxTextItem *>(lb->getFirstSelectedItem());
	if(it)
	{
		long fid = (long)it->getID();
		T_friendmap::iterator itm = _friends.find(fid);
		if(itm != _friends.end())
		{
			if(itm->second.first.ToAccept)
			{
				ThreadSafeWorkpile::getInstance()->AcceptFriend(fid);
				return true;
			}
		}
	}

	// if not then we add a new friend
	_myChooseName->show();
	CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
		(CEGUI::WindowManager::getSingleton().getWindow("Chat/choosePlayerName/edit"));
	bed->activate();
	return true;
}
开发者ID:leloulight,项目名称:lbanet,代码行数:31,代码来源:CommunityBox.cpp

示例4: handleDSActivation

bool GUIManager::handleDSActivation ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  ListboxItem *item = static_cast<ListboxItem *>(lb->getFirstSelectedItem());
  if (item != NULL) {
    DataManager *dm = static_cast<DataManager *>(item->getUserData());
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    std::vector<unsigned int> const & dims = dm->getDimensions();
    unsigned int dim = dims[int(sb->getScrollPosition()*(dims.size()-1))];
    float scrollPos = sb->getScrollPosition();
    dm->activate(dim);
    // Enable global scrollbar
    CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
    sb = static_cast<CEGUI::Scrollbar *>(wm.getWindow("Sheet/DimensionSlider"));
    sb->enable();
    CEGUI::WindowEventArgs w(sb);
    sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
    // Set the global scrollbar to the right position.
    sb->setScrollPosition(scrollPos);
    CEGUI::Window *desc = wm.getWindow("Sheet/DimensionText");
    desc->show();
  }
  // TODO handle else-error
  return true;
}
开发者ID:Nvveen,项目名称:Revolution,代码行数:27,代码来源:GUIManager.cpp

示例5: SetWorldList

/***********************************************************
set the list of available worlds
***********************************************************/
void ChooseWorldGUI::SetWorldList(const std::vector<LbaNet::WorldDesc> &list)
{
	_wlist = list;

	try
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("ChooseWorldList"));
		if(lb)
		{
			lb->resetList();

			std::vector<LbaNet::WorldDesc>::const_iterator it = _wlist.begin();
			std::vector<LbaNet::WorldDesc>::const_iterator end = _wlist.end();
			for(int cc=0; it != end; ++it, ++cc)
			{
				MyListItemCW * item = new MyListItemCW(it->WorldName);
				lb->addItem(item);
				if(cc == _selectedworld)
					lb->setItemSelectState(item, true);
			}
		}
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init the world list: ") + ex.getMessage().c_str());
		_root = NULL;
	}
}
开发者ID:Rincevent,项目名称:lbanet,代码行数:32,代码来源:ChooseWorldGUI.cpp

示例6: OnUpdateTwitter

//新品推荐
bool OnUpdateTwitter(const CEGUI::EventArgs& e)
{
    CEGUI::Window* twitter = WEArgs(e).window;
    CEGUI::Listbox*  lb = WListBox(twitter->getChildRecursive(SHOPCITY_TWITTER_CHILDLISTBOX_NAME));
#ifdef _DEBUG
    OutputDebugStr(lb->getName().c_str());
    OutputDebugStr("\n");
    OutputDebugStr(twitter->getChildAtIdx(0)->getName().c_str());
    OutputDebugStr("n");
#endif
    //清空
    lb->resetList();

    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    //新品推荐显示
    SCGData::MapNewestA& resdta = dt->GetNewestVec();
    SCGData::VecGDPTA& vecDTA = resdta[eCityType];
    for(uint i = 0 ; i < vecDTA.size() ; ++i)
    {
        CGoodsList::tagGoods2* ptg2 = CGoodsList::GetProperty(vecDTA[i].index);
        if(ptg2)
        {
            string str  = ptg2->BaseProperty.strName.c_str();
            //CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(str.c_str(),vecDTA[i].index);//索引关联Item ID
            CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str()),vecDTA[i].index);//索引关联Item ID
            lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
            lb->addItem(lti);
        }
    }
    return true;
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例7: HandleChatMessage

	void MenuState::HandleChatMessage(std::string text)
	{
		CEGUI::Listbox *chatBox = static_cast<CEGUI::Listbox*>(wmgr->getWindow("LIGHTCYCLEMENU/Lobby/ListBox"));
		CEGUI::ListboxTextItem *newItem = 0;
		newItem = new CEGUI::ListboxTextItem(text, CEGUI::HTF_WORDWRAP_LEFT_ALIGNED);
		chatBox->addItem(newItem);
		chatBox->ensureItemIsVisible(newItem);
	}
开发者ID:Grogist,项目名称:LightCycle,代码行数:8,代码来源:MenuState.cpp

示例8: outputConsoleText

void DeveloperConsole::outputConsoleText(const CEGUI::String& text, CEGUI::Colour color) {
    CEGUI::Listbox* listbox = static_cast<CEGUI::Listbox*>(mConsoleWindow->getChild("History"));
    
    CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(text);
    item->setTextColours(color);
    listbox->addItem(item);
    listbox->ensureItemIsVisible(item);
}
开发者ID:Naftoreiclag,项目名称:VS8C,代码行数:8,代码来源:DeveloperConsole.cpp

示例9:

bool 
IntroState::changeResolution(const CEGUI::EventArgs &e){
  CEGUI::Listbox* lb = static_cast<CEGUI::Listbox*>(static_cast<const CEGUI::WindowEventArgs&>(e).window->getRootWindow()->getChild("background_options")->getChild("lbRes"));
  string sel=lb->getFirstSelectedItem()->getText().c_str();
  _resWidth=Ogre::StringConverter::parseInt(Ogre::StringUtil::split(sel,"x")[0]);
  _resHeigt=Ogre::StringConverter::parseInt(Ogre::StringUtil::split(sel,"x")[1]);
  cout << _resWidth << endl;
  cout << _resHeigt << endl;
  return true;
}
开发者ID:RubenCardos,项目名称:CrackShot,代码行数:10,代码来源:IntroState.cpp

示例10: listDir

void
MenuState::createGUI()
{
  //Limpiar interfaz del estado anterior-------------------
  CEGUI::Window* sheet=CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

  //-------------------------------------------------------
  CEGUI::Window* sheetBG =  CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","backgroundMenu");
  sheetBG->setPosition(CEGUI::UVector2(cegui_reldim(0),cegui_reldim(0)));
  sheetBG->setSize( CEGUI::USize(cegui_reldim(1),cegui_reldim(1)));
  sheetBG->setProperty("Image","BackgroundImageMenu");
  sheetBG->setProperty("FrameEnabled","False");
  sheetBG->setProperty("BackgroundEnabled", "False");


  CEGUI::ListboxTextItem* itm;


  CEGUI::Listbox* editBox = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Listbox","listbox"));
  editBox->setSize(CEGUI::USize(CEGUI::UDim(0.6,0),CEGUI::UDim(0.6,0)));
  editBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.20, 0),CEGUI::UDim(0.10, 0)));

  const CEGUI::Image* sel_img = &CEGUI::ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush");
  
  std::vector<string> files = listDir("./data/Levels/*"); // ./Para directorio actual ./Carpeta/* para otra carpeta
  for(unsigned int i=0;i<files.size();i++){
    string aux=files[i];
    if(Ogre::StringUtil::endsWith(aux,".txt")){
      cout << "================ File: " << aux <<"================"<< endl;
      _recorridos.push_back(aux);
      string file=Ogre::StringUtil::split(aux,"/")[3];
      cout<<"File: " << file << endl;
      file=Ogre::StringUtil::replaceAll(file,".txt","");
      cout<<"File: " << file << endl;
      itm = new CEGUI::ListboxTextItem(file,0);
      itm->setFont("DickVanDyke-28");
      itm->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
      itm->setSelectionBrushImage(sel_img);
      editBox->addItem(itm);
    }
    
  }
  //---------------------------------------------------

  CEGUI::Window* playButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","playButton");
  playButton->setText("[font='DickVanDyke'] Start");
  playButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.07,0)));
  playButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.4,0),CEGUI::UDim(0.8,0)));
  playButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&MenuState::playB,this));

  sheetBG->addChild(playButton);
  sheetBG->addChild(editBox);
  sheet->addChild(sheetBG);

}
开发者ID:RubenCardos,项目名称:CrackShot,代码行数:55,代码来源:MenuState.cpp

示例11: outputText

void ConsoleBox::outputText(std::string _msg, bool _leftAligned, unsigned int _timeStamp, unsigned int _colour)
{
  CEGUI::Listbox *outputWindow = dynamic_cast<CEGUI::Listbox*>(window);
  //static_cast<CEGUI::Listbox*>(window->getChildRecursive("ChatBox"));
  assert(outputWindow);

  CEGUI::ListboxTextItem *newItem=0;
  newItem = new CEGUI::ListboxTextItem(Log::getTimeString(_timeStamp) + ' ' + _msg, _leftAligned?CEGUI::HTF_WORDWRAP_LEFT_ALIGNED:CEGUI::HTF_WORDWRAP_RIGHT_ALIGNED);
  newItem->setTextColours(_colour);
  outputWindow->addItem(newItem);
}
开发者ID:deek0146,项目名称:framework2d,代码行数:11,代码来源:ConsoleBox.cpp

示例12: OutputText

void GameConsoleWindow::OutputText(CEGUI::String inMsg, CEGUI::Colour colour)
{
	// Get a pointer to the ChatBox so we don't have to use this ugly getChild function every time.
	CEGUI::Listbox *outputWindow = static_cast<CEGUI::Listbox*>(m_ConsoleWindow->getChild(sNamePrefix + "History"));
 
	CEGUI::ListboxTextItem* newItem=0; // This will hold the actual text and will be the listbox segment / item
 
	newItem = ::new CEGUI::ListboxTextItem(inMsg); // instance new item
        newItem->setTextColours(colour); // Set the text color
	outputWindow->addItem(newItem); // Add the new ListBoxTextItem to the ListBox
}
开发者ID:xcasadio,项目名称:casaengine,代码行数:11,代码来源:GameConsoleWindow.cpp

示例13: ClearFriends

/***********************************************************
clear the friend list
***********************************************************/
void CommunityBox::ClearFriends()
{
	CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
		CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"));

	T_friendmap::iterator it = _friends.begin();
	T_friendmap::iterator end = _friends.end();
	for(; it != end; ++it)
		lb->removeItem(it->second.second);

	_friends.clear();
}
开发者ID:leloulight,项目名称:lbanet,代码行数:15,代码来源:CommunityBox.cpp

示例14: OnShopCityTwitterMouseDoubleClicked

//双击推荐列表,打开购买页面
bool OnShopCityTwitterMouseDoubleClicked(const CEGUI::EventArgs& e)
{
    CEGUI::Listbox* twitterList = WListBox(WEArgs(e).window);
    CEGUI::ListboxItem* lbi = twitterList->getFirstSelectedItem();
    if(lbi)
    {
        uint index = lbi->getID();//获取索引,索引关联物品索引
        CEGUI::Window* buyPage = GetWindow(SHOPCITY_BUY_PAGE_NAME);
        buyPage->setID(index);//购买界面ID与物品索引关联
        //打开购买界面
        FireUIEvent(SHOPCITY_BUY_PAGE_NAME,EVENT_OPEN);
    }
    return true;
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例15: HandleGoButton

/***********************************************************
handle GO button pressed
***********************************************************/
bool TeleportBox::HandleGoButton (const CEGUI::EventArgs& e)
{
    CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
        CEGUI::WindowManager::getSingleton().getWindow("TeleportList"));

	MyTeleListItem * it = static_cast<MyTeleListItem *> (lb->getFirstSelectedItem());
	if(it != NULL)
	{
		InternalWorkpile::getInstance()->AddEvent(new TeleportEvent(_tplist[it->getText().c_str()].NewMap, _tplist[it->getText().c_str()].Spawning));
		HandleClose(e);
	}

	return true;
}
开发者ID:leloulight,项目名称:lbanet,代码行数:17,代码来源:TeleportBox.cpp


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