bool WorkshopState::partButton(const CEGUI::EventArgs & e) { if(typeid(CEGUI::WindowEventArgs) == typeid(e)) { const CEGUI::WindowEventArgs & wea = dynamic_cast<const CEGUI::WindowEventArgs &>(e); _lastSelectedPart = wea.window->getName().c_str(); Logic::GameManager * gameManager = Logic::GameManager::GetInstance(); if(gameManager->getWorkshopInfo()->containsPart(_lastSelectedPart)) { _parts->resetList(); Logic::WorkshopInfo::PartInfo & info = gameManager->getWorkshopInfo()->findPart(_lastSelectedPart); Logic::WorkshopInfo::ComponentInfoVector::iterator i = info.components.begin(); Logic::WorkshopInfo::ComponentInfoVector::iterator end = info.components.end(); CEGUI::ListboxTextItem * item = 0; for(unsigned int j = 0; i != end; ++i, ++j) { _parts->addRow(); item = new CEGUI::ListboxTextItem(i->name); item->setSelectionColours(CEGUI::colour(0.0f, 0.6f, 0.0f)); item->setSelectionBrushImage("MultiColumnSelector", "Selector"); _parts->setItem(item, 0, j); item = new CEGUI::ListboxTextItem( (i->buyed ? (i->selected ? "Selected": "") : Ogre::StringConverter::toString(i->cost)) ); item->setSelectionColours(CEGUI::colour(0.0f, 0.6f, 0.0f)); item->setSelectionBrushImage("MultiColumnSelector", "Selector"); _parts->setItem(item, 1, j); } _properties->setText(""); _money->setText(gameManager->getMoneyAsString()); showDialogPanel(); } } return true; }
bool EntityCreator::actualize_list(const CEGUI::EventArgs& args) { list_box_->resetList(); CEGUI::ListboxTextItem* item; CEGUI::Colour col{1.f, .5f, .1f}; for(auto& ent : registered_entities_) { item = new CEGUI::ListboxTextItem(ent); item->setTextColours(Console::ORANGE_TEXT); item->setSelectionBrushImage("AlfiskoSkin/GenericBrush"); item->setSelectionColours(Console::BLUE_TEXT); list_box_->addItem(item); } return true; }
//--------------------------------------------------------------------- void CompositorDemo_FrameListener::updateDebugRTTWindow(void) { // Clear listbox mDebugRTTListbox->resetList(); // Clear imagesets mDebugRTTStaticImage->setProperty("Image", ""); for (ImageSetList::iterator isIt = mDebugRTTImageSets.begin(); isIt != mDebugRTTImageSets.end(); ++isIt) { CEGUI::ImagesetManager::getSingleton().destroyImageset(*isIt); } mDebugRTTImageSets.clear(); Ogre::set<Ogre::String>::type uniqueTextureNames; // Add an entry for each render texture for all active compositors Ogre::Viewport* vp = mMain->getRenderWindow()->getViewport(0); Ogre::CompositorChain* chain = Ogre::CompositorManager::getSingleton().getCompositorChain(vp); Ogre::CompositorChain::InstanceIterator it = chain->getCompositors(); while (it.hasMoreElements()) { Ogre::CompositorInstance* inst = it.getNext(); if (inst->getEnabled()) { Ogre::CompositionTechnique::TextureDefinitionIterator texIt = inst->getTechnique()->getTextureDefinitionIterator(); while (texIt.hasMoreElements()) { Ogre::CompositionTechnique::TextureDefinition* texDef = texIt.getNext(); // Get instance name of texture (NB only index 0 if MRTs for now) const Ogre::String& instName = inst->getTextureInstanceName(texDef->name, 0); // Create CEGUI texture from name of OGRE texture CEGUI::Texture* tex = mMain->getGuiRenderer()->createTexture(instName.c_str()); // Create imageset // Note that if we use shared textures in compositor, the same texture name // will occur more than once, so we have to cater for this if (uniqueTextureNames.find(instName) == uniqueTextureNames.end()) { CEGUI::Imageset* imgSet = CEGUI::ImagesetManager::getSingleton().createImageset( instName.c_str(), tex); mDebugRTTImageSets.push_back(imgSet); imgSet->defineImage((CEGUI::utf8*)"RttImage", CEGUI::Point(0.0f, 0.0f), CEGUI::Size(tex->getWidth(), tex->getHeight()), CEGUI::Point(0.0f,0.0f)); CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem(texDef->name.c_str(), 0, imgSet); item->setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush"); item->setSelectionColours(CEGUI::colour(0,0,1)); mDebugRTTListbox->addItem(item); uniqueTextureNames.insert(instName); } } } } }
int FileWindow::list(const TCHAR* dir) { typedef std::basic_string<TCHAR> tc_string; typedef std::list< tc_string > tc_string_list; _pFileList->resetList(); _pSelectBox->setText(""); _pOkButton->setEnabled(false); if (dir[0] == 0) { _cwd = _T("C:"); } else { size_t i = 1; while (dir[i] != 0) { ++i; } while (0 < i) { if (dir[i-1] != _T('\\') && dir[i-1] != _T('/')) { break; } --i; } _cwd.assign(dir, i); } { char* s = ::bootes::lib::util::TChar::T2C(_cwd.c_str()); _pDirBox->setText(s); delete s; } WIN32_FIND_DATA find; HANDLE hFind; { tc_string query = _cwd + _T("\\*"); hFind = FindFirstFile(query.c_str(), &find); if (hFind == INVALID_HANDLE_VALUE) { return -1; } } tc_string_list files, dirs; for (BOOL found = TRUE; found; found=FindNextFile(hFind, &find)) { tc_string name(find.cFileName); if (name.compare(_T(".")) == 0) { continue; } if ((find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { name += _T('\\'); dirs.push_back(name); } else if ((find.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) != 0) { continue; } else { std::list< tc_string >::iterator i; for (i = _exts.begin(); i != _exts.end(); ++i) { tc_string& e = *i; if (name.size() < e.size()) { continue; } if (name.compare(name.size() - e.size(), e.size(), e) == 0) { break; } } if (i == _exts.end()) { continue; } files.push_back(name); } } FindClose(hFind); int id = 0; intptr_t data = 1; //dir void* pdata = reinterpret_cast< void* >(data); for (tc_string_list::iterator i = dirs.begin(); i != dirs.end(); ++i) { char* name = ::bootes::lib::util::TChar::T2C(i->c_str()); CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(name, id++, pdata); item->setSelectionColours(CEGUI::ColourRect(CEGUI::colour(1.0f, 0.0f, 0.0f))); _pFileList->addItem(item); delete name; } data = 0; //file pdata = reinterpret_cast< void* >(data); for (tc_string_list::iterator i = files.begin(); i != files.end(); ++i) { char* name = ::bootes::lib::util::TChar::T2C(i->c_str()); CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(name, id++, pdata); _pFileList->addItem(item); delete name; } return id; }