Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7627


Ignore:
Timestamp:
Nov 9, 2010, 9:53:34 PM (14 years ago)
Author:
dafrick
Message:

Now we have the level description as tooltip. Unforunately for this to work i had to write two additional wrappers for CEGUI lua functions, so I guess it's time to start investigating why some CEGUI functions work in lua and some don't.

Location:
code/branches/releasetodo
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/releasetodo/data/gui/scripts/MultiplayerMenu.lua

    r7626 r7627  
    8181    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/MultiplayerListbox"))
    8282    listbox:resetList()
     83    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
    8384    local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
    8485    local size = orxonox.LevelManager:getInstance():getNumberOfLevels()
     
    105106        P.itemList[k] = listbox:getListboxItemFromIndex(k-1)
    106107        --TODO: The description as tooltip would be nice.
    107         --local lItem = tolua.cast("CEGUI::ListboxItem", P.itemList[k])
     108        --local lItem = P.itemList[k]
    108109        --lItem:setTooltipText(v:getDescription())
     110        orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription())
    109111    end
    110112end
  • code/branches/releasetodo/data/gui/scripts/SingleplayerMenu.lua

    r7626 r7627  
    1919    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox"))
    2020    listbox:resetList()
     21    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
    2122    local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
    2223    local size = orxonox.LevelManager:getInstance():getNumberOfLevels()
     
    4546        --local lItem = tolua.cast("CEGUI::ListboxItem", P.itemList[k])
    4647        --lItem:setTooltipText(v:getDescription())
     48        orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription())
    4749    end
    4850end
  • code/branches/releasetodo/src/libraries/core/GUIManager.cc

    r7403 r7627  
    4343#include <CEGUIWindow.h>
    4444#include <CEGUIWindowManager.h>
     45#include <CEGUI/elements/CEGUIListbox.h>
     46#include <CEGUI/elements/CEGUIListboxItem.h>
    4547#include <ogreceguirenderer/OgreCEGUIRenderer.h>
    4648
     
    440442        window->subscribeScriptedEvent(event, function);
    441443    }
     444
     445    void GUIManager::setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& tooltip)
     446    {
     447        item->setTooltipText(tooltip);
     448    }
     449
     450    void GUIManager::setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled)
     451    {
     452        listbox->setItemTooltipsEnabled(enabled);
     453    }
     454
     455   
    442456}
  • code/branches/releasetodo/src/libraries/core/GUIManager.h

    r7403 r7627  
    106106        // TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
    107107        static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
     108        static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); //tolua_export
     109        static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); //tolua_export
    108110
    109111        static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export
Note: See TracChangeset for help on using the changeset viewer.