本文整理汇总了C++中ListboxTextItem::setSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ ListboxTextItem::setSelected方法的具体用法?C++ ListboxTextItem::setSelected怎么用?C++ ListboxTextItem::setSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListboxTextItem
的用法示例。
在下文中一共展示了ListboxTextItem::setSelected方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
/*!
* Setup the CEGUI-based user interface. This needs an OGRE::SceneManager.
*
* \return true on success, false otherwise
*/
bool Gui::initialize() {
using namespace CEGUI;
if (!mInputHandler) {
//std::cerr << dc_funcinfo << "ERROR: NULL input handler" << std::endl;
return false;
}
// add resource path for GUI-scheme and layout
mOgreRoot->addResourceLocation("../resources/cegui-skin", "FileSystem");
mOgreRoot->addResourceLocation("../resources", "FileSystem");
// AB: do NOT delete the object: CEGUI does so in CEGUI::System::~System()
new MyCEGUILogger();
mGuiRenderer = new OgreCEGUIRenderer(mRenderWindow);
mGuiSystem = new System(mGuiRenderer);
// load GUI scheme
try {
SchemeManager::getSingleton().loadScheme((utf8*)"DCollideSkin.scheme");
} catch (CEGUI::Exception e) {
//std::cout << dc_funcinfo << "CEGUI exception when loading scheme: " << e.getMessage() << std::endl;
return false;
}
// set default cursor and font
mGuiSystem->setDefaultMouseCursor((utf8*)"DCollide", (utf8*)"MouseArrow");
MouseCursor::getSingleton().setImage("DCollide", "MouseMoveCursor");
mGuiSystem->setDefaultFont((utf8*)"Vera");
// Move CEGUI mouse to (0,0)
CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition();
CEGUI::System::getSingleton().injectMouseMove(-mousePos.d_x,-mousePos.d_y);
// load and enable GUI sheet
try {
mGuiSheet = WindowManager::getSingleton().loadWindowLayout("testapp.layout");
} catch (CEGUI::Exception e) {
//std::cout << dc_funcinfo << "CEGUI exception when loading window layout: " << e.getMessage() << std::endl;
return false;
}
mGuiSystem->setGUISheet(mGuiSheet);
WindowManager::getSingleton().getWindow((utf8*)"QuitButton")
->subscribeEvent(
PushButton::EventClicked,
Event::Subscriber(&Gui::handleQuit, this));
WindowManager::getSingleton().getWindow((utf8*)"LegendButton")
->subscribeEvent(
PushButton::EventClicked,
Event::Subscriber(&Gui::handleLegend, this));
// fill the combobox with all available scenes
Combobox* sceneBox = CEGUI_CAST("SceneSelectionBox", "DCollide/Combobox", CEGUI::Combobox*);
if (!sceneBox) {
//std::cerr << dc_funcinfo << "cannot find TestApp/SceneSelectionBox" << std::endl;
return false;
}
std::list<std::string> sceneTitles = SceneHandler::getSceneHandler()->getAvailableSceneTitles();
unsigned int index = 0; // we use index in the list as ID for the combobox item
colour white(1.0, 1.0, 1.0, 1.0);
for (std::list<std::string>::iterator it = sceneTitles.begin(); it != sceneTitles.end(); ++it) {
ListboxTextItem* item = new ListboxTextItem((utf8*)(*it).c_str(), index);
// make the current selection in the combobox visible
item->setSelectionColours(white);
item->setTooltipText((*it).c_str());
item->setSelectionBrushImage("DCollide", "ListboxSelectionBrush");
if ((*it) == SceneHandler::getDefaultSceneId()) {
item->setSelected(true);
}
sceneBox->addItem(item);
index++;
}
//sceneBox->setText(SceneManager::getDefaultSceneId().c_str());
sceneBox->subscribeEvent(Combobox::EventListSelectionAccepted,
Event::Subscriber(&Gui::handleSceneChange, this));
mLegendWindow = CEGUI_CAST("LegendWindow", "DCollide/FrameWindow", CEGUI::FrameWindow*);
mLegendWindow->hide();
mLegendWindow->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,
Event::Subscriber(&Gui::handleLegend, this));
return true;
}