1// SuperTux
2// Copyright (C) 2006 Matthias Braun <matze@braunis.de>,
3// 2007-2014 Ingo Ruhnke <grumbel@gmail.com>
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18#ifndef HEADER_SUPERTUX_CONTROL_KEYBOARD_MANAGER_HPP
19#define HEADER_SUPERTUX_CONTROL_KEYBOARD_MANAGER_HPP
20
21#include <boost/optional.hpp>
22
23#include "control/controller.hpp"
24
25class InputManager;
26class KeyboardConfig;
27struct SDL_KeyboardEvent;
28struct SDL_TextInputEvent;
29
30class KeyboardManager final
31{
32public:
33 KeyboardManager(InputManager* parent, KeyboardConfig& keyboard_config);
34
35 void process_key_event(const SDL_KeyboardEvent& event);
36 void process_text_input_event(const SDL_TextInputEvent& event);
37 void process_console_key_event(const SDL_KeyboardEvent& event);
38 void process_menu_key_event(const SDL_KeyboardEvent& event);
39
40 void bind_next_event_to(Control id);
41
42private:
43 InputManager* m_parent;
44 KeyboardConfig& m_keyboard_config;
45 boost::optional<Control> m_wait_for_key;
46 bool m_lock_text_input;
47
48private:
49 KeyboardManager(const KeyboardManager&) = delete;
50 KeyboardManager& operator=(const KeyboardManager&) = delete;
51};
52
53#endif
54
55/* EOF */
56