Only refresh menu items that have been created in the JoystickMenu to avoid crash
[supertux.git] / src / control / keyboard_manager.hpp
index 15d8043..9ddaba3 100644 (file)
@@ -1,6 +1,6 @@
 //  SuperTux
 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>,
-//                2007-2014 Ingo Ruhnke <grumbel@gmx.de>
+//                2007-2014 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
 #include "util/reader_fwd.hpp"
 #include "util/writer_fwd.hpp"
 
-class JoystickKeyboardController;
+class InputManager;
+class KeyboardConfig;
 
 class KeyboardManager final
 {
 private:
-  friend class KeyboardMenu;
-  typedef std::map<SDL_Keycode, Controller::Control> KeyMap;
+  InputManager* m_parent;
+  KeyboardConfig& m_keyboard_config;
 
 public:
-  KeyboardManager(JoystickKeyboardController* parent);
+  int wait_for_key;
+
+public:
+  KeyboardManager(InputManager* parent, KeyboardConfig& keyboard_config);
   ~KeyboardManager();
 
   void process_key_event(const SDL_KeyboardEvent& event);
@@ -43,18 +47,6 @@ public:
   void process_console_key_event(const SDL_KeyboardEvent& event);
   void process_menu_key_event(const SDL_KeyboardEvent& event);
 
-  SDL_Keycode reversemap_key(Controller::Control c);
-  void bind_key(SDL_Keycode key, Controller::Control c);
-
-  void read(const lisp::Lisp* keymap_lisp);
-  void write(Writer& writer);
-
-private:
-  JoystickKeyboardController* m_parent;
-  KeyMap keymap;
-  bool jump_with_up_kbd;
-  int wait_for_key;
-
 private:
   KeyboardManager(const KeyboardManager&) = delete;
   KeyboardManager& operator=(const KeyboardManager&) = delete;