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


C++ ListboxTextItem::setTooltipText方法代码示例

本文整理汇总了C++中ListboxTextItem::setTooltipText方法的典型用法代码示例。如果您正苦于以下问题:C++ ListboxTextItem::setTooltipText方法的具体用法?C++ ListboxTextItem::setTooltipText怎么用?C++ ListboxTextItem::setTooltipText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListboxTextItem的用法示例。


在下文中一共展示了ListboxTextItem::setTooltipText方法的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;
}
开发者ID:jacmoe,项目名称:OgreOpcode,代码行数:96,代码来源:gui.cpp


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