Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 6, 2011, 2:30:24 PM (14 years ago)
Author:
dafrick
Message:

Adding toggleGUI functionality, not yet used, though. Toggling of QuestGUI needs another approach.

Location:
code/branches/usability/src/libraries/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/src/libraries/core/GUIManager.cc

    r7994 r8033  
    105105    SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, false);
    106106    SetConsoleCommand("hideGUI", &GUIManager::hideGUI);
     107    SetConsoleCommand("toggleGUI", &GUIManager::toggleGUI).defaultValue(1, false).defaultValue(2, false);
    107108
    108109    /**
     
    282283    {
    283284        GUIManager::getInstance().executeCode("hideMenuSheet(\"" + name + "\")");
     285    }
     286
     287    /**
     288    @brief
     289        Toggles specified GUI.
     290        If the GUI with the input name is already shown and on the top, it is hidden, else it is shown.
     291    */
     292    /*static*/ void GUIManager::toggleGUI(const std::string& name, bool bHidePrevious, bool bNoInput)
     293    {
     294        GUIManager::getInstance().executeCode("getGUIFirstActive(\"" + name + "\", " + multi_cast<std::string>(bHidePrevious) + ", " + multi_cast<std::string>(bNoInput) + ")");
     295    }
     296
     297    /**
     298    @brief
     299        Helper method to toggle a specified GUI.
     300        Is called by lua.
     301    */
     302    void GUIManager::toggleGUIHelper(const std::string& name, bool bHidePrevious, bool bNoInput, bool show)
     303    {
     304        if(show)
     305            GUIManager::showGUI(name, bHidePrevious, bNoInput);
     306        else
     307            GUIManager::hideGUI(name);
    284308    }
    285309
  • code/branches/usability/src/libraries/core/GUIManager.h

    r7874 r8033  
    8888        void showGUIExtra(const std::string& name, const std::string& ptr, bool bHidePrevious = false, bool bNoInput = false);
    8989        static void hideGUI(const std::string& name);
     90        static void toggleGUI(const std::string& name, bool bHidePrevious = false, bool bNoInput = false);
     91        void toggleGUIHelper(const std::string& name, bool bHidePrevious, bool bNoInput, bool show); // tolua_export
    9092        void keyESC();
    9193        void setBackgroundImage(const std::string& imageSet, const std::string imageName); // tolua_export
Note: See TracChangeset for help on using the changeset viewer.