-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include <config.h>
-
-#include <sys/types.h>
-#include <ctype.h>
-
-#include <iostream>
-#include <sstream>
-#include <cstdlib>
-#include <cstdio>
-#include <string>
-#include <cassert>
-#include <stdexcept>
-
-#include "app/globals.h"
-#include "menu.h"
-#include "video/screen.h"
-#include "video/drawing_context.h"
-#include "app/setup.h"
-#include "app/gettext.h"
-#include "math/vector.h"
-#include "main.h"
-#include "control/joystickkeyboardcontroller.h"
-
-static const int MENU_REPEAT_INITIAL = 400;
-static const int MENU_REPEAT_RATE = 200;
-static const int FLICK_CURSOR_TIME=500;
-
-extern SDL_Surface* screen;
-
-using namespace SuperTux;
-
-Surface* checkbox;
-Surface* checkbox_checked;
-Surface* back;
-Surface* arrow_left;
-Surface* arrow_right;
-
-std::vector<Menu*> Menu::last_menus;
-Menu* Menu::current_ = 0;
-Font* Menu::default_font;
-Font* Menu::active_font;
-Font* Menu::deactive_font;
-Font* Menu::label_font;
-Font* Menu::field_font;
-
-/* just displays a Yes/No text that can be used to confirm stuff */
-bool confirm_dialog(Surface *background, std::string text)
-{
- //Surface* cap_screen = Surface::CaptureScreen();
- Menu* dialog = new Menu;
- dialog->add_deactive(-1, text);
- dialog->add_hl();
- dialog->add_entry(true, _("Yes"));
- dialog->add_entry(false, _("No"));
- dialog->add_hl();
-
- Menu::set_current(dialog);
-
- DrawingContext context;
-
- while(true)
- {
- SDL_Event event;
-
- if(event.type == SDL_QUIT)
- throw std::runtime_error("received window close event");
-
- while (SDL_PollEvent(&event)) {
- dialog->event(event);
- }
-
- if(background == NULL)
- context.draw_gradient(Color(200,240,220), Color(200,200,220), LAYER_BACKGROUND0);
- else
- context.draw_surface(background, Vector(0,0), LAYER_BACKGROUND0);
-
- dialog->draw(context);
- dialog->action();
-
- switch (dialog->check())
- {
- case true:
- //delete cap_screen;
- Menu::set_current(0);
- delete dialog;
- return true;
- break;
- case false:
- //delete cap_screen;
- Menu::set_current(0);
- delete dialog;
- return false;
- break;
- default:
- break;
- }
-
- mouse_cursor->draw(context);
- context.do_drawing();
- SDL_Delay(25);
- }
-
- return false;
-}
-
-void
-Menu::push_current(Menu* pmenu)
-{
- if (current_)
- last_menus.push_back(current_);
-
- current_ = pmenu;
- current_->effect.start(500);
-}
-
-void
-Menu::pop_current()
-{
- if (last_menus.size() >= 1) {
- current_ = last_menus.back();
- current_->effect.start(500);
-
- last_menus.pop_back();
- }
-}
-
-void
-Menu::set_current(Menu* menu)
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#include "gui/menu.hpp"
+
+#include <math.h>
+
+#include "control/joystickkeyboardcontroller.hpp"
+#include "gui/menu_item.hpp"
+#include "gui/menu_manager.hpp"
+#include "gui/mousecursor.hpp"
+#include "supertux/globals.hpp"
+#include "supertux/mainloop.hpp"
+#include "supertux/resources.hpp"
+#include "supertux/timer.hpp"
+#include "util/gettext.hpp"
+#include "video/drawing_context.hpp"
+#include "video/font.hpp"
+
+static const float MENU_REPEAT_INITIAL = 0.4f;
+static const float MENU_REPEAT_RATE = 0.1f;
+
+extern SDL_Surface* g_screen;
+
+Menu::Menu() :
+ hit_item(),
+ pos_x(),
+ pos_y(),
+ menuaction(),
+ delete_character(),
+ mn_input_char(),
+ menu_repeat_time(),
+ close(false),
+ items(),
+ effect_progress(),
+ effect_start_time(),
+ arrange_left(),
+ active_item(),
+ checkbox(),
+ checkbox_checked(),
+ back(),
+ arrow_left(),
+ arrow_right()