Clang format: only show errors on non whitelisted files
[oweals/minetest.git] / src / guiKeyChangeMenu.h
1 /*
2  Minetest
3  Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4  Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
5  Copyright (C) 2013 teddydestodes <derkomtur@schattengang.net>
6
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 2.1 of the License, or
10  (at your option) any later version.
11
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  GNU Lesser General Public License for more details.
16
17  You should have received a copy of the GNU Lesser General Public License along
18  with this program; if not, write to the Free Software Foundation, Inc.,
19  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef GUIKEYCHANGEMENU_HEADER
23 #define GUIKEYCHANGEMENU_HEADER
24
25 #include "irrlichttypes_extrabloated.h"
26 #include "modalMenu.h"
27 #include "client.h"
28 #include "gettext.h"
29 #include "keycode.h"
30 #include <string>
31 #include <vector>
32
33 struct key_setting {
34         int id;
35         const wchar_t *button_name;
36         KeyPress key;
37         std::string setting_name;
38         gui::IGUIButton *button;
39 };
40
41
42 class GUIKeyChangeMenu: public GUIModalMenu
43 {
44 public:
45         GUIKeyChangeMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
46                         s32 id, IMenuManager *menumgr);
47         ~GUIKeyChangeMenu();
48
49         void removeChildren();
50         /*
51          Remove and re-add (or reposition) stuff
52          */
53         void regenerateGui(v2u32 screensize);
54
55         void drawMenu();
56
57         bool acceptInput();
58
59         bool OnEvent(const SEvent& event);
60
61 private:
62
63         void init_keys();
64
65         bool resetMenu();
66
67         void add_key(int id, const wchar_t *button_name, const std::string &setting_name);
68
69         bool shift_down;
70         
71         s32 activeKey;
72         
73         std::vector<KeyPress> key_used;
74         gui::IGUIStaticText *key_used_text;
75         std::vector<key_setting *> key_settings;
76 };
77
78 #endif
79