Added cast around GLEW_ARB_texture_non_power_of_two, as it might be a char and screw...
[supertux.git] / src / gui / menu.hpp
index 8ac6db2..b00c9c8 100644 (file)
 #include <memory>
 #include <SDL.h>
 
-#include "gui/mousecursor.hpp"
-#include "video/font.hpp"
-
-bool confirm_dialog(Surface* background, std::string text);
+#include "math/vector.hpp"
+#include "video/color.hpp"
+#include "video/surface_ptr.hpp"
 
+class DrawingContext;
 class MenuItem;
 
+bool confirm_dialog(Surface* background, std::string text);
+
 class Menu
 {
   static Color default_color;
@@ -36,30 +38,6 @@ class Menu
   static Color label_color;
   static Color field_color;
 private:
-  static std::vector<Menu*> last_menus;
-
-  /** Pointers to all currently available menus, used to handle repositioning on window resize */
-  static std::list<Menu*>   all_menus;
-
-  static Menu* previous;
-  static Menu* current_;
-
-public:
-  /** Set the current menu, if pmenu is NULL, hide the current menu */
-  static void set_current(Menu* pmenu);
-
-  static void push_current(Menu* pmenu);
-  static void pop_current();
-
-  static void recalc_pos();
-
-  /** Return the current active menu or NULL if none is active */
-  static Menu* current()
-  {
-    return current_;
-  }
-
-private:
   /* Action done on the menu */
   enum MenuAction {
     MENU_ACTION_NONE = -1,
@@ -99,6 +77,8 @@ public:
       clicked on it) in the last event() call */
   int check ();
 
+  virtual void check_menu() =0;
+
   MenuItem& get_item(int index)
   {
     return *(items[index]);
@@ -135,8 +115,7 @@ private:
   int hit_item;
 
   // position of the menu (ie. center of the menu, not top/left)
-  float pos_x;
-  float pos_y;
+  Vector pos;
 
   /** input event for the menu (up, down, left, right, etc.) */
   MenuAction menuaction;
@@ -146,22 +125,24 @@ private:
   char  mn_input_char;
   float menu_repeat_time;
 
+public:
   bool close;
 
-public:
   std::vector<MenuItem*> items;
 
-private:
+public:
   float effect_progress;
   float effect_start_time;
+
+private:
   int arrange_left;
   int active_item;
 
-  std::auto_ptr<Surface> checkbox;
-  std::auto_ptr<Surface> checkbox_checked;
-  std::auto_ptr<Surface> back;
-  std::auto_ptr<Surface> arrow_left;
-  std::auto_ptr<Surface> arrow_right;
+  SurfacePtr checkbox;
+  SurfacePtr checkbox_checked;
+  SurfacePtr back;
+  SurfacePtr arrow_left;
+  SurfacePtr arrow_right;
 };
 
 #endif