X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fgui%2Fmenu.hpp;h=60d48dd6d32f98b294c0cc4f31e1ed6a0edf762f;hb=13c4ea0cbf0bdbadc268f49b3cbc797e4f7a746d;hp=3074bbe621690de072089f9bed778fe615a4c507;hpb=a54195a086e58adbbe333c7a683df632289e997f;p=supertux.git diff --git a/src/gui/menu.hpp b/src/gui/menu.hpp index 3074bbe62..60d48dd6d 100644 --- a/src/gui/menu.hpp +++ b/src/gui/menu.hpp @@ -21,6 +21,7 @@ #define SUPERTUX_MENU_H #include +#include #include #include #include @@ -41,7 +42,7 @@ enum MenuItemKind { MN_GOTO, MN_TOGGLE, MN_BACK, - MN_DEACTIVE, + MN_INACTIVE, MN_TEXTFIELD, MN_NUMFIELD, MN_CONTROLFIELD, @@ -92,6 +93,10 @@ class Menu { private: static std::vector last_menus; + + /** Pointers to all currently available menus, used to handle repositioning on window resize */ + static std::list all_menus; + static Menu* previous; static Menu* current_; @@ -103,6 +108,8 @@ public: static void push_current(Menu* pmenu); + static void recalc_pos(); + /** Return the current active menu or NULL if none is active */ static Menu* current() { @@ -139,10 +146,12 @@ private: char mn_input_char; float menu_repeat_time; + bool close; + public: static Font* default_font; static Font* active_font; - static Font* deactive_font; + static Font* inactive_font; static Font* label_font; static Font* field_font; @@ -155,11 +164,12 @@ public: MenuItem* add_label(const std::string& text); MenuItem* add_entry(int id, const std::string& text); MenuItem* add_toggle(int id, const std::string& text, bool toggled = false); - MenuItem* add_deactive(int id, const std::string& text); + MenuItem* add_inactive(int id, const std::string& text); MenuItem* add_back(const std::string& text); MenuItem* add_submenu(const std::string& text, Menu* submenu, int id = -1); MenuItem* add_controlfield(int id, const std::string& text, const std::string& mapping = ""); + MenuItem* add_string_select(int id, const std::string& text); virtual void menu_action(MenuItem* item); @@ -188,6 +198,7 @@ public: void event(const SDL_Event& event); bool is_toggled(int id) const; + void set_toggled(int id, bool toggled); Menu* get_parent() const;