本文整理汇总了C++中cegui::Listbox::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ Listbox::addItem方法的具体用法?C++ Listbox::addItem怎么用?C++ Listbox::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Listbox
的用法示例。
在下文中一共展示了Listbox::addItem方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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
}
示例8: AddOnline
/***********************************************************
add people online
***********************************************************/
void CommunityBox::AddOnline(const std::string & listname, const std::string &_online,
const std::string &_status, const std::string &color)
{
if(listname == "online")
{
CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist"));
std::string dis = "[colour='" + color + "']" + _online;
if(_status != "")
dis += " (" + _status + ")";
std::map<std::string, CEGUI::ListboxItem *>::iterator itmap = _onlines.find(_online);
if(itmap != _onlines.end())
{
itmap->second->setText(dis);
lb->invalidate();
}
else
{
CEGUI::ListboxItem *it = new MyComListItem(dis);
lb->addItem(it);
_onlines[_online] = it;
}
if(IsFriend(_online))
UpdateFriend(_online);
}
if(listname == "IRC")
{
CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
CEGUI::WindowManager::getSingleton().getWindow("Community/IRClist"));
CEGUI::ListboxItem *it = lb->findItemWithText(_online, NULL);
if(it == NULL)
lb->addItem(new MyComListItem(_online));
}
}
示例9: SetTeleportList
/***********************************************************
set the list of people begin online
***********************************************************/
void TeleportBox::SetTeleportList(const std::map<std::string, TPInfo> &_lists)
{
CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
CEGUI::WindowManager::getSingleton().getWindow("TeleportList"));
lb->resetList();
_tplist = _lists;
std::map<std::string, TPInfo>::const_iterator it = _lists.begin();
std::map<std::string, TPInfo>::const_iterator end = _lists.end();
for(; it != end; ++it)
{
lb->addItem(new MyTeleListItem(it->first));
}
}
示例10: UpdateParticipants
void MenuState::UpdateParticipants(std::vector<std::string> participants)
{
CEGUI::Listbox *participantsBox =
static_cast<CEGUI::Listbox*>(wmgr->getWindow("LIGHTCYCLEMENU/Lobby/Participants"));
participantsBox->resetList();
std::string scores = ("LIGHTCYCLEGAME/Score/");
std::vector<std::string>::iterator itr = participants.begin();
int i = 1;
for(itr, i; itr != participants.end(); ++itr, i++)
{
CEGUI::ListboxTextItem *newItem = 0;
newItem = new CEGUI::ListboxTextItem(*itr, CEGUI::HTF_WORDWRAP_LEFT_ALIGNED);
participantsBox->addItem(newItem);
}
}
示例11: UpdateFriend
/***********************************************************
add people friend
***********************************************************/
void CommunityBox::UpdateFriend(const LbaNet::FriendInfo & frd)
{
//RemoveFriend(frd.Name);
CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"));
bool connected = false;
std::string color = "FF777777";
std::map<std::string, CEGUI::ListboxItem *>::iterator iton = _onlines.find(frd.Name);
if(iton != _onlines.end())
{
connected = true;
color = "FF33FF33";
}
std::string dis = "[colour='" + color + "']";
if(frd.ToAccept)
dis += "(Request) ";
dis += frd.Name;
if(frd.Pending)
dis += " (Pending)";
//check if already exist just update the text
T_friendmap::iterator it = _friends.find(frd.Id);
if(it != _friends.end())
{
it->second.second->setText(dis);
lb->invalidate();
}
else
{
CEGUI::ListboxItem *item = new MyComListItem(dis);
item->setID((unsigned int)frd.Id);
lb->addItem(item);
_friends[frd.Id] = std::make_pair<LbaNet::FriendInfo, CEGUI::ListboxItem *>(frd, item);
}
}
示例12: populateDatalists
void GUIManager::populateDatalists ( std::vector<DataManager *> const & list )
{
CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
auto populate = [&]( std::string const & name,
DataManagerType const & type ) {
CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(wm.getWindow(
"Sheet/DatasetFrame/TabControl/"+name+"/Listbox"));
unsigned int i = 0;
for (DataManager *p : list) {
if (p != NULL && p->type == type) {
ListboxItem *item = new ListboxItem(p->name, i);
item->setUserData(p);
lb->addItem(item);
}
i++;
}
};
populate("HTab", DM_Height);
populate("PTab", DM_Pattern);
populate("CTab", DM_Color);
}
示例13: RunSuitePressed
bool MainGameScreen::RunSuitePressed(const CEGUI::EventArgs& pEventArgs)
{
CEGUI::Spinner* SystemSpinner = static_cast<CEGUI::Spinner*> (GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/SystemSpinner"));
CEGUI::Spinner* SeedSpinner = static_cast<CEGUI::Spinner*> (GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/SeedSpinner"));
CEGUI::Spinner* SizeSpinner = static_cast<CEGUI::Spinner*> (GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/SizeSpinner"));
vector<int> Systems;
Systems.push_back(SystemSpinner->getCurrentValue());
GAME->getPath()->getTester()->CreateTestSuite(SeedSpinner->getCurrentValue(), SizeSpinner->getCurrentValue());
GAME->getPath()->getTester()->RunPathTestSuites(Systems);
GroupProfile* TestResults = GAME->getPath()->getTester()->getCurrentGroupProfile();
CEGUI::Window* RawWindow = GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/DataList");
CEGUI::Listbox* DataListbox = (CEGUI::Listbox*) RawWindow;
DataListbox->resetList();
char buffer[64] ;
CEGUI::ListboxTextItem* newItem;
sprintf(buffer, "TotalPathSteps %i", TestResults->TotalPathSteps);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "TotalPathLength %f", TestResults->TotalPathLength);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "TotalGraphReads %i", TestResults->TotalGraphReads);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "TotalNodesExpanded %i", TestResults->TotalNodesExpanded);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "TotalCacheHits %i", TestResults->TotalCacheHits);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "TotalTimeCost %i", TestResults->TotalTimeCost);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "GraphReadEfficency %f", TestResults->GraphReadEfficency);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "NodeSearchEfficency %f", TestResults->NodeSearchEfficency);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "CacheEfficency %f", TestResults->CacheEfficency);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
sprintf(buffer, "TimeCostEfficency %f", TestResults->TimeCostEfficency);
newItem = new CEGUI::ListboxTextItem(buffer);
DataListbox->addItem(newItem);
}
示例14: USize
//.........这里部分代码省略.........
text2->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0)));
text2->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15,0),CEGUI::UDim(0.46,0)));
text2->setProperty("FrameEnabled","False");
text2->setProperty("BackgroundEnabled", "False");
text2->setProperty("HorzFormatting", "LeftAligned");
CEGUI::ToggleButton* cb = static_cast<CEGUI::ToggleButton*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Checkbox","CBAutoReload"));
cb->setPosition(CEGUI::UVector2(CEGUI::UDim(0.08,0),CEGUI::UDim(0.52,0)));
CEGUI::Window* resetButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","resetButton");
resetButton->setText("[font='DickVanDyke'] Reset Records ");
resetButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0)));
resetButton->setXPosition(UDim(0.40f, 0.0f));
resetButton->setYPosition(UDim(0.85f, 0.0f));
resetButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::resetRecords,this));
CEGUI::Window* configButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","configButton");
configButton->setText("[font='DickVanDyke'] Restore Config ");
configButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0)));
configButton->setXPosition(UDim(0.40f, 0.0f));
configButton->setYPosition(UDim(0.77f, 0.0f));
configButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::resetConfig,this));
CEGUI::Window* text3 = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","FullscreenText");
text3->setText("[font='DickVanDyke'] Fullscreen");
text3->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0)));
text3->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15,0),CEGUI::UDim(0.57,0)));
text3->setProperty("FrameEnabled","False");
text3->setProperty("BackgroundEnabled", "False");
text3->setProperty("HorzFormatting", "LeftAligned");
CEGUI::ToggleButton* cbFullscreen = static_cast<CEGUI::ToggleButton*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Checkbox","CBFullscreen"));
cbFullscreen->setPosition(CEGUI::UVector2(CEGUI::UDim(0.08,0),CEGUI::UDim(0.62,0)));
cbFullscreen->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,CEGUI::Event::Subscriber(&IntroState::tbFullscreenChanged,this));
CEGUI::Window* text4 = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","ResolutionText");
text4->setText("[font='DickVanDyke'] Resolution");
text4->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0)));
text4->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0),CEGUI::UDim(0.35,0)));
text4->setProperty("FrameEnabled","False");
text4->setProperty("BackgroundEnabled", "False");
text4->setProperty("HorzFormatting", "LeftAligned");
CEGUI::Listbox* lbRes = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Listbox","lbRes"));
lbRes->setSize(CEGUI::USize(CEGUI::UDim(0.3,0),CEGUI::UDim(0.3,0)));
lbRes->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5, 0),CEGUI::UDim(0.40, 0)));
lbRes->subscribeEvent(Listbox::EventSelectionChanged,CEGUI::Event::Subscriber(&IntroState::changeResolution,this));
const CEGUI::Image* sel_img = &CEGUI::ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush");
CEGUI::ListboxTextItem* itm;
itm = new CEGUI::ListboxTextItem("800x600",0);
itm->setFont("DickVanDyke-28");
itm->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
itm->setSelectionBrushImage(sel_img);
lbRes->addItem(itm);
CEGUI::ListboxTextItem* itm2;
itm2 = new CEGUI::ListboxTextItem("1200x800",1);
itm2->setFont("DickVanDyke-28");
itm2->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
itm2->setSelectionBrushImage(sel_img);
lbRes->addItem(itm2);
CEGUI::ListboxTextItem* itm3;
itm3 = new CEGUI::ListboxTextItem("1920x1020",2);
itm3->setFont("DickVanDyke-28");
itm3->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
itm3->setSelectionBrushImage(sel_img);
lbRes->addItem(itm3);
sheetBG->addChild(text4);
sheetBG->addChild(lbRes);
sheetBG->addChild(cb);
sheetBG->addChild(text2);
sheetBG->addChild(cbFullscreen);
sheetBG->addChild(text3);
sheetBG->addChild(sbText);
sheetBG->addChild(sb);
sheetBG->addChild(applyButton);
sheetBG->addChild(backButton);
sheetBG->addChild(resetButton);
sheetBG->addChild(configButton);
sheetBG->addChild(text);
sheet->addChild(sheetBG);
if(_fullscreen){
cbFullscreen->setSelected(true);
}else{
cbFullscreen->setSelected(false);
}
return true;
}