#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;
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,
clicked on it) in the last event() call */
int check ();
+ virtual void check_menu() =0;
+
MenuItem& get_item(int index)
{
return *(items[index]);
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;
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