1ff3d40451b4227754796ce77fb78d63ab51ff84
[oweals/minetest.git] / src / guiKeyChangeMenu.h
1 /*
2  Minetest-c55
3  Copyright (C) 2010-11 celeron55, Perttu Ahola <celeron55@gmail.com>
4  Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
5  Copyright (C) 2011 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 General Public License as published by
9  the Free Software Foundation; either version 2 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 General Public License for more details.
16
17  You should have received a copy of the GNU 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 "common_irrlicht.h"
26 #include "utility.h"
27 #include "modalMenu.h"
28 #include "client.h"
29 #include "gettext.h"
30 #include "keycode.h"
31 #include <string>
32
33 class GUIKeyChangeMenu: public GUIModalMenu
34 {
35 public:
36         GUIKeyChangeMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
37                         s32 id, IMenuManager *menumgr);
38         ~GUIKeyChangeMenu();
39
40         void removeChildren();
41         /*
42          Remove and re-add (or reposition) stuff
43          */
44         void regenerateGui(v2u32 screensize);
45
46         void drawMenu();
47
48         bool acceptInput();
49
50         bool OnEvent(const SEvent& event);
51
52 private:
53
54         void init_keys();
55
56         bool resetMenu();
57
58         gui::IGUIButton *forward;
59         gui::IGUIButton *backward;
60         gui::IGUIButton *left;
61         gui::IGUIButton *right;
62         gui::IGUIButton *use;
63         gui::IGUIButton *sneak;
64         gui::IGUIButton *jump;
65         gui::IGUIButton *dropbtn;
66         gui::IGUIButton *inventory;
67         gui::IGUIButton *fly;
68         gui::IGUIButton *fast;
69         gui::IGUIButton *range;
70         gui::IGUIButton *dump;
71         gui::IGUIButton *chat;
72         gui::IGUIButton *cmd;
73         gui::IGUIButton *console;
74
75         s32 activeKey;
76         KeyPress key_forward;
77         KeyPress key_backward;
78         KeyPress key_left;
79         KeyPress key_right;
80         KeyPress key_use;
81         KeyPress key_sneak;
82         KeyPress key_jump;
83         KeyPress key_drop;
84         KeyPress key_inventory;
85         KeyPress key_fly;
86         KeyPress key_fast;
87         KeyPress key_range;
88         KeyPress key_chat;
89         KeyPress key_cmd;
90         KeyPress key_console;
91         KeyPress key_dump;
92 };
93
94 #endif
95