Removed some obsolete stuff from supertux/globals.hpp
[supertux.git] / src / gui / menu_manager.hpp
index 85ba2ec..2be6983 100644 (file)
@@ -1,5 +1,5 @@
 //  SuperTux
-//  Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.de>
+//  Copyright (C) 2009 Ingo Ruhnke <grumbel@gmail.com>
 //
 //  This program is free software: you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
 #ifndef HEADER_SUPERTUX_GUI_MENU_MANAGER_HPP
 #define HEADER_SUPERTUX_GUI_MENU_MANAGER_HPP
 
-#include <vector>
 #include <list>
 #include <memory>
+#include <vector>
 
-class Menu;
+#include "SDL.h"
+
+class Dialog;
 class DrawingContext;
+class Menu;
+class MenuTransition;
 
 class MenuManager
 {
@@ -31,52 +35,42 @@ private:
 public:
   static MenuManager& instance();
 
-public:
-  std::vector<std::unique_ptr<Menu> > m_menu_stack;
-
-  bool close;
-  float effect_progress;
-  float effect_start_time;
+private:
+  std::unique_ptr<Dialog> m_dialog;
+  bool m_has_next_dialog;
+  std::unique_ptr<Dialog> m_next_dialog;
 
-  friend class Menu;
+  std::vector<std::unique_ptr<Menu> > m_menu_stack;
+  std::unique_ptr<MenuTransition> m_transition;
 
 public:
   MenuManager();
   ~MenuManager();
 
+  void event(const SDL_Event& event);
+  void process_input();
+  void refresh();
+
   void draw(DrawingContext& context);
-  bool check_menu();
 
-  void set_menu(int id);
-  void clear_menu_stack();
+  void set_dialog(std::unique_ptr<Dialog> dialog);
 
-  void push_menu(std::unique_ptr<Menu> menu);
+  void set_menu(int id);
+  void set_menu(std::unique_ptr<Menu> menu);
   void push_menu(int id);
+  void push_menu(std::unique_ptr<Menu> menu);
   void pop_menu();
+  void clear_menu_stack();
 
-  void recalc_pos();
-
-  /** Return the current active menu or NULL if none is active */
-  Menu* current() const
-  {
-    if (m_menu_stack.empty())
-    {
-      return nullptr;
-    }
-    else
-    {
-      return m_menu_stack.back().get();
-    }
-  }
-
+  void on_window_resize();
   bool is_active() const
   {
     return !m_menu_stack.empty();
   }
 
 private:
-  /** Set the current menu, if pmenu is NULL, hide the current menu */
-  void set_menu(std::unique_ptr<Menu> menu);
+  Menu* current_menu() const;
+  void transition(Menu* from, Menu* to);
 
 private:
   MenuManager(const MenuManager&);