From: Ingo Ruhnke Date: Mon, 5 May 2008 13:44:33 +0000 (+0000) Subject: Added Menu::get_parent() X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=80e0230d849dc160995a54a54a228c285a721d44;p=supertux.git Added Menu::get_parent() SVN-Revision: 5410 --- diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index 6dbb47c23..00500b05f 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -802,6 +802,15 @@ Menu::is_toggled(int id) const return get_item_by_id(id).toggled; } +Menu* +Menu::get_parent() const +{ + if (last_menus.empty()) + return 0; + else + return last_menus.back(); +} + /* Check for menu event */ void Menu::event(const SDL_Event& event) diff --git a/src/gui/menu.hpp b/src/gui/menu.hpp index d6455bd77..b8df21820 100644 --- a/src/gui/menu.hpp +++ b/src/gui/menu.hpp @@ -186,6 +186,8 @@ public: bool is_toggled(int id) const; + Menu* get_parent() const; + protected: void additem(MenuItem* pmenu_item); float get_width() const; diff --git a/src/options_menu.cpp b/src/options_menu.cpp index 63a7a5989..eb381a21d 100644 --- a/src/options_menu.cpp +++ b/src/options_menu.cpp @@ -108,7 +108,10 @@ OptionsMenu::OptionsMenu() add_label(_("Options")); add_hl(); - add_submenu(_("Change Profile"), get_profile_menu()); + + // FIXME: Implement me: if (get_parent() == main_menu) + add_submenu(_("Change Profile"), get_profile_menu()); + add_submenu(_("Select Language"), language_menu.get()); add_toggle(MNID_FULLSCREEN,_("Fullscreen"), config->use_fullscreen); if (sound_manager->is_audio_enabled()) {