Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/GUIManager.cc @ 8422

Last change on this file since 8422 was 8419, checked in by rgrieder, 14 years ago

Fixed a bug. But that doesn't really change anything ;(
CEGUI still renders on top of the overlays.

  • Property svn:eol-style set to native
File size: 23.0 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Reto Grieder
24 *      Benjamin Knecht
25 *   Co-authors:
26 *      ...
27 *
28 */
29
30#include "GUIManager.h"
31
32#include <memory>
33#include <boost/bind.hpp>
34#include <OgreRenderQueue.h>
35#include <OgreRenderWindow.h>
36
37#include <CEGUIDefaultLogger.h>
38#include <CEGUIExceptions.h>
39#include <CEGUIInputEvent.h>
40#include <CEGUIMouseCursor.h>
41#include <CEGUIResourceProvider.h>
42#include <CEGUISystem.h>
43#include <CEGUIWindow.h>
44#include <CEGUIWindowManager.h>
45#include <elements/CEGUIListbox.h>
46#include <elements/CEGUIListboxItem.h>
47
48#ifdef ORXONOX_OLD_CEGUI
49#  include <CEGUILua.h>
50#  include <ogreceguirenderer/OgreCEGUIRenderer.h>
51extern "C" {
52#  include <lauxlib.h>
53}
54#else
55#  include <ScriptingModules/LuaScriptModule/CEGUILua.h>
56#  include <RendererModules/Ogre/CEGUIOgreImageCodec.h>
57#  include <RendererModules/Ogre/CEGUIOgreRenderer.h>
58#  include <RendererModules/Ogre/CEGUIOgreResourceProvider.h>
59#  include <OgreCamera.h>
60#  include <OgreRenderQueueListener.h>
61#  include <OgreSceneManager.h>
62#endif
63
64#include "util/Clock.h"
65#include "util/Convert.h"
66#include "util/Debug.h"
67#include "util/Exception.h"
68#include "util/OrxAssert.h"
69#include "ConfigValueIncludes.h"
70#include "Core.h"
71#include "CoreIncludes.h"
72#include "Game.h"
73#include "GraphicsManager.h"
74#include "LuaState.h"
75#include "PathConfig.h"
76#include "Resource.h"
77#include "command/ConsoleCommand.h"
78#include "input/InputManager.h"
79#include "input/InputState.h"
80#include "input/KeyBinderManager.h"
81
82namespace orxonox
83{
84    static void key_esc()
85        { GUIManager::getInstance().keyESC(); }
86    SetConsoleCommand("keyESC", &key_esc);
87
88    class CEGUILogger : public CEGUI::DefaultLogger
89    {
90    public:
91        void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)
92        {
93            int orxonoxLevel = CEGUI::Standard;
94            switch (level)
95            {
96                case CEGUI::Errors:      orxonoxLevel = 1; break;
97                case CEGUI::Warnings:    orxonoxLevel = 2; break;
98                case CEGUI::Standard:    orxonoxLevel = 4; break;
99                case CEGUI::Informative: orxonoxLevel = 5; break;
100                case CEGUI::Insane:      orxonoxLevel = 6; break;
101                default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!");
102            }
103            OutputHandler::getOutStream(orxonoxLevel)
104                << "CEGUI: " << message << std::endl;
105
106            CEGUI::DefaultLogger::logEvent(message, level);
107        }
108    };
109
110#ifdef ORXONOX_OLD_CEGUI
111    /** Class with the same memory layout as CEGUI::LuaScriptModule. <br>
112        We need this to fix a problem with an uninitialised member variable
113        in CEGUI < 0.7 <br>
114        Notice the "public" modifier for the otherwise private variables.
115    */
116    class LuaScriptModuleWorkaround : public CEGUI::ScriptModule
117    {
118    public:
119        LuaScriptModuleWorkaround();
120        ~LuaScriptModuleWorkaround();
121
122    public:
123        bool d_ownsState;
124        lua_State* d_state;
125        CEGUI::String d_errFuncName;
126        int d_errFuncIndex;
127        CEGUI::String d_activeErrFuncName;
128        int d_activeErrFuncIndex;
129    };
130#else
131    /// RenderQueueListener based class used to hook into the ogre rendering system
132    class RQListener : public Ogre::RenderQueueListener
133    {
134    public:
135        /// Callback from Ogre invoked before other stuff in our target queue is rendered
136        void renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue)
137        {
138            if (id == Ogre::RENDER_QUEUE_OVERLAY && invocation.empty())
139                CEGUI::System::getSingleton().renderGUI();
140        }
141    };
142#endif
143
144    static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
145
146    GUIManager* GUIManager::singletonPtr_s = 0;
147    /*static*/ const std::string GUIManager::defaultScheme_ = "TaharezGreen";
148
149    SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, false);
150    SetConsoleCommand("hideGUI", &GUIManager::hideGUI);
151    SetConsoleCommand("toggleGUI", &GUIManager::toggleGUI).defaultValue(1, false).defaultValue(2, false);
152
153    /**
154    @brief
155        Constructs the GUIManager by starting up CEGUI
156
157        Creates the interface to Ogre, sets up the CEGUI renderer and the Lua script module together with the Lua engine.
158        The log is set up and connected to the CEGUILogger.
159        After Lua setup tolua++-elements are linked to Lua-state to give Lua access to C++-code.
160        Finally initial Lua code is executed (maybe we can do this with the CEGUI startup script automatically).
161    @return true if success, otherwise false
162    */
163    GUIManager::GUIManager(const std::pair<int, int>& mousePosition)
164        : destroyer_(*this, &GUIManager::cleanup)
165        , guiRenderer_(NULL)
166        , resourceProvider_(NULL)
167#ifndef ORXONOX_OLD_CEGUI
168        , rqListener_(NULL)
169        , imageCodec_(NULL)
170#endif
171        , luaState_(NULL)
172        , scriptModule_(NULL)
173        , guiSystem_(NULL)
174        , ceguiLogger_(NULL)
175        , rootWindow_(NULL)
176        , hudRootWindow_(NULL)
177        , menuRootWindow_(NULL)
178        , camera_(NULL)
179    {
180        RegisterRootObject(GUIManager);
181        this->setConfigValues();
182
183        using namespace CEGUI;
184
185        COUT(3) << "Initialising CEGUI." << std::endl;
186
187        // Note: No SceneManager specified yet
188#ifdef ORXONOX_OLD_CEGUI
189        guiRenderer_ = new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000);
190        resourceProvider_ = guiRenderer_->createResourceProvider();
191#else
192        guiRenderer_ = &OgreRenderer::create(*GraphicsManager::getInstance().getRenderWindow());
193        // We use our own RenderQueueListener so we can draw UNDER overlays
194        guiRenderer_->setFrameControlExecutionEnabled(false);
195        rqListener_ = new RQListener();
196        resourceProvider_ = &OgreRenderer::createOgreResourceProvider();
197        imageCodec_ = &OgreRenderer::createOgreImageCodec();
198#endif
199        resourceProvider_->setDefaultResourceGroup("General");
200
201        // Setup scripting
202        luaState_ = new LuaState();
203        rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua");
204        // This is necessary to ensure that input events also use the right resource info when triggering lua functions
205        luaState_->setDefaultResourceInfo(this->rootFileInfo_);
206#ifdef ORXONOX_OLD_CEGUI
207        scriptModule_ = new LuaScriptModule(luaState_->getInternalLuaState());
208        // Ugly workaround: older CEGUILua versions don't initialise the member
209        // d_activeErrFuncIndex at all. That leads to "error in error handling"
210        // problems when a Lua error occurs.
211        // We fix this by setting the member manually.
212        reinterpret_cast<LuaScriptModuleWorkaround*>(scriptModule_)->d_activeErrFuncIndex = LUA_NOREF;
213        luaState_->doString("ORXONOX_OLD_CEGUI = true");
214#else
215        scriptModule_ = &LuaScriptModule::create(luaState_->getInternalLuaState());
216#endif
217        scriptModule_->setDefaultPCallErrorHandler(LuaState::ERROR_HANDLER_NAME);
218
219        // Create our own logger to specify the filepath
220        std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
221        ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
222        // Set the log level according to ours (translate by subtracting 1)
223        ceguiLogger->setLoggingLevel(
224            static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
225        this->ceguiLogger_ = ceguiLogger.release();
226
227        // Create the CEGUI system singleton
228#ifdef ORXONOX_OLD_CEGUI
229        guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_);
230        // Add functions that have been renamed in newer versions
231        luaState_->doString("CEGUI.SchemeManager.create = CEGUI.SchemeManager.loadScheme");
232        luaState_->doString("CEGUI.Window.getUnclippedOuterRect = CEGUI.Window.getUnclippedPixelRect");
233#else
234        guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_);
235#endif
236
237        // Align CEGUI mouse with OIS mouse
238        guiSystem_->injectMousePosition((float)mousePosition.first, (float)mousePosition.second);
239
240        // Initialise the Lua framework and load the schemes
241        this->luaState_->doFile("InitialiseGUI.lua");
242
243        // Create the root nodes
244        this->rootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("MenuWidgets/StaticImage", "AbsoluteRootWindow");
245        this->rootWindow_->setProperty("FrameEnabled", "False");
246        this->hudRootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "HUDRootWindow");
247        this->menuRootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "MenuRootWindow");
248        // And connect them
249        CEGUI::System::getSingleton().setGUISheet(this->rootWindow_);
250        this->rootWindow_->addChildWindow(this->hudRootWindow_);
251        this->rootWindow_->addChildWindow(this->menuRootWindow_);
252
253        // No background to start with (sets the alpha value to 0)
254        this->setBackgroundImage("");
255
256        // Set up the sheet manager in the Lua framework
257        this->luaState_->doFile("SheetManager.lua");
258    }
259
260    void GUIManager::cleanup()
261    {
262        using namespace CEGUI;
263
264#ifdef ORXONOX_OLD_CEGUI
265        delete guiSystem_;
266        delete guiRenderer_;
267        delete scriptModule_;
268#else
269        System::destroy();
270        OgreRenderer::destroyOgreResourceProvider(*resourceProvider_);
271        OgreRenderer::destroyOgreImageCodec(*imageCodec_);
272        OgreRenderer::destroy(*guiRenderer_);
273        LuaScriptModule::destroy(*scriptModule_);
274        delete ceguiLogger_;
275        delete rqListener_;
276#endif
277        delete luaState_;
278    }
279
280    void GUIManager::setConfigValues(void)
281    {
282        SetConfigValue(guiScheme_, GUIManager::defaultScheme_) .description("Changes the current GUI scheme.") .callback(this, &GUIManager::changedGUIScheme);
283    }
284
285    void GUIManager::changedGUIScheme(void)
286    {
287
288    }
289
290    /**
291    @brief
292        used to tick the GUI
293    @param time
294        clock which provides time value for the GUI System
295
296        Ticking the GUI means updating it with a certain regularity.
297        The elapsed time since the last call is given in the time value provided by the clock.
298        This time value is then used to provide a fluent animation of the GUI.
299    */
300    void GUIManager::preUpdate(const Clock& time)
301    {
302        assert(guiSystem_);
303        this->protectedCall(boost::bind(&CEGUI::System::injectTimePulse, _1, time.getDeltaTime()));
304    }
305
306    /**
307    @brief
308        Tells the GUIManager which SceneManager to use
309    @param camera
310        The current camera on which the GUI should be displayed on.
311
312        In fact the GUIManager needs the SceneManager and not the Camera to display the GUI.
313        This means the GUI is not bound to a camera but rather to the SceneManager.
314        Hiding the GUI when needed can therefore not be resolved by just NOT setting the current camera.
315    */
316    void GUIManager::setCamera(Ogre::Camera* camera)
317    {
318#ifdef ORXONOX_OLD_CEGUI
319        if (camera == NULL)
320            this->guiRenderer_->setTargetSceneManager(0);
321        else
322            this->guiRenderer_->setTargetSceneManager(camera->getSceneManager());
323#else
324        if (camera_ != NULL && camera_->getSceneManager() != NULL)
325            camera_->getSceneManager()->removeRenderQueueListener(rqListener_);
326        if (camera != NULL && camera->getSceneManager() != NULL)
327            camera->getSceneManager()->addRenderQueueListener(rqListener_);
328#endif
329        this->camera_ = camera;
330    }
331
332    /**
333    @brief
334        Executes Lua code
335    @param str
336        reference to string object holding the Lua code which is to be executed
337    */
338    void GUIManager::executeCode(const std::string& str)
339    {
340        this->luaState_->doString(str, rootFileInfo_);
341    }
342
343    /** Loads a GUI sheet by Lua script
344    @param name
345        The name of the GUI (like the script name, but without the extension)
346    */
347    void GUIManager::loadGUI(const std::string& name)
348    {
349        this->executeCode("loadSheet(\"" + name + "\")");
350    }
351
352    /**
353    @brief
354        Displays specified GUI on screen
355    @param name
356        The name of the GUI
357    @param bHidePrevious
358        If true all displayed GUIs on the stack, that are below this GUI are hidden.
359    @param bNoInput
360        If true the GUI is transparent to input.
361
362        The function executes the Lua function with the same name in case the GUIManager is ready.
363    */
364    /*static*/ void GUIManager::showGUI(const std::string& name, bool bHidePrevious, bool bNoInput)
365    {
366        GUIManager::getInstance().executeCode("showMenuSheet(\"" + name + "\", " + multi_cast<std::string>(bHidePrevious) + ", " + multi_cast<std::string>(bNoInput) + ")");
367    }
368
369    /**
370    @brief
371        Hack-ish. Needed for GUIOverlay.
372    */
373    void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr, bool bHidePrevious, bool bNoInput)
374    {
375        this->executeCode("showMenuSheet(\"" + name + "\", " + multi_cast<std::string>(bHidePrevious) + ", " + multi_cast<std::string>(bNoInput) + ", " + ptr + ")");
376    }
377
378    /**
379    @brief
380        Hides specified GUI.
381    @param name
382        The name of the GUI.
383    */
384    /*static*/ void GUIManager::hideGUI(const std::string& name)
385    {
386        GUIManager::getInstance().executeCode("hideMenuSheet(\"" + name + "\")");
387    }
388
389    /**
390    @brief
391        Toggles specified GUI.
392        If the GUI with the input name is already shown and on the top, it is hidden, else it is shown.
393    */
394    /*static*/ void GUIManager::toggleGUI(const std::string& name, bool bHidePrevious, bool bNoInput)
395    {
396        GUIManager::getInstance().executeCode("getGUIFirstActive(\"" + name + "\", " + multi_cast<std::string>(bHidePrevious) + ", " + multi_cast<std::string>(bNoInput) + ")");
397    }
398
399    /**
400    @brief
401        Helper method to toggle a specified GUI.
402        Is called by lua.
403    */
404    void GUIManager::toggleGUIHelper(const std::string& name, bool bHidePrevious, bool bNoInput, bool show)
405    {
406        if(show)
407            GUIManager::showGUI(name, bHidePrevious, bNoInput);
408        else
409            GUIManager::hideGUI(name);
410    }
411
412    const std::string& GUIManager::createInputState(const std::string& name, TriBool::Value showCursor, TriBool::Value useKeyboard, bool bBlockJoyStick)
413    {
414        InputState* state = InputManager::getInstance().createInputState(name);
415        if (!state)
416            return BLANKSTRING;
417
418        /* Table that maps isFullScreen() and showCursor to mouseExclusive
419        isFullscreen / showCursor | True  | False | Dontcare
420        ----------------------------------------------------
421        true                      | True  | True  | Dontcare
422        ----------------------------------------------------
423        false                     | False | True  | Dontcare
424        */
425
426#ifdef ORXONOX_PLATFORM_APPLE
427        // There is no non exclusive mode on OS X yet
428        state->setMouseExclusive(TriBool::True);
429#else
430        if (showCursor == TriBool::Dontcare)
431            state->setMouseExclusive(TriBool::Dontcare);
432        else if (GraphicsManager::getInstance().isFullScreen() || showCursor == TriBool::False)
433            state->setMouseExclusive(TriBool::True);
434        else
435            state->setMouseExclusive(TriBool::False);
436#endif
437
438        if (showCursor == TriBool::True)
439            state->setMouseHandler(this);
440        else if (showCursor == TriBool::False)
441            state->setMouseHandler(&InputHandler::EMPTY);
442
443        if (useKeyboard == TriBool::True)
444            state->setKeyHandler(this);
445        else if (useKeyboard == TriBool::False)
446            state->setKeyHandler(&InputHandler::EMPTY);
447
448        if (bBlockJoyStick)
449            state->setJoyStickHandler(&InputHandler::EMPTY);
450
451        return state->getName();
452    }
453
454    void GUIManager::keyESC()
455    {
456        this->executeCode("keyESC()");
457    }
458
459    void GUIManager::setBackgroundImage(const std::string& imageSet, const std::string imageName)
460    {
461        if (imageSet.empty() || imageName.empty())
462            this->setBackgroundImage("");
463        else
464            this->setBackgroundImage("set: " + imageSet + " image: " + imageName);
465    }
466
467    void GUIManager::setBackgroundImage(const std::string& image)
468    {
469        if (image.empty())
470            this->rootWindow_->setProperty("Alpha", "0.0");
471        else
472            this->rootWindow_->setProperty("Alpha", "1.0");
473        this->rootWindow_->setProperty("Image", image);
474    }
475
476    void GUIManager::buttonPressed(const KeyEvent& evt)
477    {
478        this->protectedCall(boost::bind(&CEGUI::System::injectKeyDown, _1, evt.getKeyCode()));
479        this->protectedCall(boost::bind(&CEGUI::System::injectChar, _1, evt.getText()));
480    }
481
482    void GUIManager::buttonReleased(const KeyEvent& evt)
483    {
484        this->protectedCall(boost::bind(&CEGUI::System::injectKeyUp, _1, evt.getKeyCode()));
485    }
486
487    /**
488    @brief
489        Function receiving a mouse button pressed event.
490    @param id
491        ID of the mouse button which got pressed
492
493        This function is inherited by MouseHandler and injects the event into CEGUI.
494        It is for CEGUI to process the event.
495    */
496    void GUIManager::buttonPressed(MouseButtonCode::ByEnum id)
497    {
498        this->protectedCall(boost::bind(&CEGUI::System::injectMouseButtonDown, _1, convertButton(id)));
499    }
500
501    /**
502    @brief
503        Function receiving a mouse button released event.
504    @param id
505        ID of the mouse button which got released
506
507        This function is inherited by MouseHandler and injects the event into CEGUI.
508        It is for CEGUI to process the event.
509    */
510    void GUIManager::buttonReleased(MouseButtonCode::ByEnum id)
511    {
512        this->protectedCall(boost::bind(&CEGUI::System::injectMouseButtonUp, _1, convertButton(id)));
513    }
514
515    void GUIManager::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
516    {
517        this->protectedCall(boost::bind(&CEGUI::System::injectMousePosition, _1, (float)abs.x, (float)abs.y));
518    }
519
520    void GUIManager::mouseScrolled(int abs, int rel)
521    {
522        this->protectedCall(boost::bind(&CEGUI::System::injectMouseWheelChange, _1, (float)rel));
523    }
524
525    /**
526        @brief Indicates that the mouse left the application's window.
527    */
528    void GUIManager::mouseLeft()
529    {
530        this->protectedCall(boost::bind(&CEGUI::System::injectMouseLeaves, _1));
531    }
532
533    /**
534    @brief
535        converts mouse event code to CEGUI event code
536    @param button
537        code of the mouse button as we use it in Orxonox
538    @return
539        code of the mouse button as it is used by CEGUI
540
541        Simple conversion from mouse event code in Orxonox to the one used in CEGUI.
542     */
543    static inline CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button)
544    {
545        switch (button)
546        {
547        case MouseButtonCode::Left:
548            return CEGUI::LeftButton;
549
550        case MouseButtonCode::Right:
551            return CEGUI::RightButton;
552
553        case MouseButtonCode::Middle:
554            return CEGUI::MiddleButton;
555
556        case MouseButtonCode::Button3:
557            return CEGUI::X1Button;
558
559        case MouseButtonCode::Button4:
560            return CEGUI::X2Button;
561
562        default:
563            return CEGUI::NoButton;
564        }
565    }
566
567    /** Executes a CEGUI function normally, but catches CEGUI::ScriptException.
568        When a ScriptException occurs, the error message will be displayed and
569        the program carries on.
570    @remarks
571        The exception behaviour may pose problems if the code is not written
572        exception-safe (and you can forget about that in Lua). The program might
573        be left in an undefined state. But otherwise one script error would
574        terminate the whole program...
575    @note
576        Your life gets easier if you use boost::bind to create the object/function.
577    @param function
578        Any callable object/function that takes this->guiSystem_ as its only parameter.
579    @return
580        True if input was handled, false otherwise. A caught exception yields true.
581    */
582    template <typename FunctionType>
583    bool GUIManager::protectedCall(FunctionType function)
584    {
585        try
586        {
587            return function(this->guiSystem_);
588        }
589        catch (CEGUI::ScriptException& ex)
590        {
591            // Display the error and proceed. See @remarks why this can be dangerous.
592            COUT(1) << ex.getMessage() << std::endl;
593            return true;
594        }
595    }
596
597    /**
598    @brief
599        Subscribe the input function to the input event for the input window.
600        This is a helper to be used in lua, because subscribeScriptedEvent() doesn't work in lua.
601    @param window
602        The window for which the event is subscribed.
603    @param event
604        The type of event to which we subscribe.
605    @param function
606        The function that is called when the event occurs.
607    */
608    void GUIManager::subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function)
609    {
610        window->subscribeScriptedEvent(event, function);
611    }
612
613    /**
614    @brief
615        Set the input tooltip text for the input ListboxItem.
616    @param item
617        The ListboxItem for which the tooltip should be set.
618    @param tooltip
619        The tooltip text that should be set.
620    */
621    void GUIManager::setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& tooltip)
622    {
623        item->setTooltipText(tooltip);
624    }
625
626    /**
627    @brief
628        Set whether the tooltips for the input Listbox are enabled.
629    @param listbox
630        The Listbox for which to enable (or disable) tooltips.
631    @param enabled
632        Whether to enable or disable the tooltips.
633    */
634    void GUIManager::setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled)
635    {
636        listbox->setItemTooltipsEnabled(enabled);
637    }
638
639    /**
640        @brief Callback of window event listener, called if the window is resized. Sets the display size of CEGUI.
641    */
642    void GUIManager::windowResized(unsigned int newWidth, unsigned int newHeight)
643    {
644        this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight));
645    }
646
647    /**
648        @brief Notify CEGUI if the windows loses the focus (stops highlighting of menu items, etc).
649    */
650    void GUIManager::windowFocusChanged(bool bFocus)
651    {
652        if (!bFocus)
653            this->mouseLeft();
654    }
655
656}
Note: See TracBrowser for help on using the repository browser.