4 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef SUPERTUX_MENU_H
21 #define SUPERTUX_MENU_H
29 #include "mousecursor.h"
31 /* Kinds of menu items */
43 MN_HL, /* horizontal line */
55 string_list_type* list;
58 void change_text (const char *text);
59 void change_input(const char *text);
61 static MenuItem* create(MenuItemKind kind, const char *text, int init_toggle, Menu* target_menu);
67 static std::stack<Menu*> last_menus;
68 static Menu* current_;
70 static void push_current(Menu* pmenu);
71 static void pop_current();
73 /** Set the current menu, if pmenu is NULL, hide the current menu */
74 static void set_current(Menu* pmenu);
76 /** Return the current active menu or NULL if none is active */
77 static Menu* current() { return current_; }
80 /* Action done on the menu */
82 MENU_ACTION_NONE = -1,
92 // position of the menu (ie. center of the menu, not top/left)
97 /** input event for the menu (up, down, left, right, etc.) */
98 MenuAction menuaction;
100 /* input implementation variables */
101 int delete_character;
112 std::vector<MenuItem> item;
117 void additem(MenuItem* pmenu_item);
118 void additem(MenuItemKind kind, const std::string& text, int init_toggle, Menu* target_menu);
121 /** Remove all entries from the menu */
124 /** Check, if the value of the active menu item has changed. FIXME:
125 Somebody should document the exact meaning of this function a
130 void draw_item(int index, int menu_width, int menu_height);
131 void set_pos(int x, int y, float rw = 0, float rh = 0);
133 /** translate a SDL_Event into a menu_action */
134 void event(SDL_Event& event);
137 extern Surface* checkbox;
138 extern Surface* checkbox_checked;
139 extern Surface* back;
140 extern Surface* arrow_left;
141 extern Surface* arrow_right;
143 extern Menu* contrib_menu;
144 extern Menu* contrib_subset_menu;
145 extern Menu* main_menu;
146 extern Menu* game_menu;
147 extern Menu* worldmap_menu;
148 extern Menu* options_menu;
149 extern Menu* options_controls_menu;
150 extern Menu* highscore_menu;
151 extern Menu* load_game_menu;
152 extern Menu* save_game_menu;
154 #endif /*SUPERTUX_MENU_H*/
156 /* Local Variables: */