[Supertux-Commit] r5410 - in trunk/supertux/src: . gui

grumbel at millhouse.dreamhost.com grumbel at millhouse.dreamhost.com
Mon May 5 06:44:34 PDT 2008


Author: grumbel
Date: 2008-05-05 06:44:33 -0700 (Mon, 05 May 2008)
New Revision: 5410

Modified:
   trunk/supertux/src/gui/menu.cpp
   trunk/supertux/src/gui/menu.hpp
   trunk/supertux/src/options_menu.cpp
Log:
Added Menu::get_parent()

Modified: trunk/supertux/src/gui/menu.cpp
===================================================================
--- trunk/supertux/src/gui/menu.cpp	2008-05-05 13:34:01 UTC (rev 5409)
+++ trunk/supertux/src/gui/menu.cpp	2008-05-05 13:44:33 UTC (rev 5410)
@@ -802,6 +802,15 @@
   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)

Modified: trunk/supertux/src/gui/menu.hpp
===================================================================
--- trunk/supertux/src/gui/menu.hpp	2008-05-05 13:34:01 UTC (rev 5409)
+++ trunk/supertux/src/gui/menu.hpp	2008-05-05 13:44:33 UTC (rev 5410)
@@ -186,6 +186,8 @@
 
   bool is_toggled(int id) const;
 
+  Menu* get_parent() const;
+
 protected:
   void additem(MenuItem* pmenu_item);
   float get_width() const;

Modified: trunk/supertux/src/options_menu.cpp
===================================================================
--- trunk/supertux/src/options_menu.cpp	2008-05-05 13:34:01 UTC (rev 5409)
+++ trunk/supertux/src/options_menu.cpp	2008-05-05 13:44:33 UTC (rev 5410)
@@ -108,7 +108,10 @@
 
   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()) {




More information about the Supertux-Commit mailing list