]> git.lizzy.rs Git - minetest-m13.git/blob - src/guiKeyChangeMenu.h
Update to 4.6 base
[minetest-m13.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 enum
34 {
35         GUI_ID_BACK_BUTTON = 101, GUI_ID_ABORT_BUTTON, GUI_ID_SCROLL_BAR,
36         //buttons
37         GUI_ID_KEY_FORWARD_BUTTON,
38         GUI_ID_KEY_BACKWARD_BUTTON,
39         GUI_ID_KEY_LEFT_BUTTON,
40         GUI_ID_KEY_RIGHT_BUTTON,
41         GUI_ID_KEY_USE_BUTTON,
42         GUI_ID_KEY_FLY_BUTTON,
43         GUI_ID_KEY_FAST_BUTTON,
44         GUI_ID_KEY_JUMP_BUTTON,
45         GUI_ID_KEY_CHAT_BUTTON,
46         GUI_ID_KEY_CMD_BUTTON,
47         GUI_ID_KEY_SNEAK_BUTTON,
48         GUI_ID_KEY_DROP_BUTTON,
49         GUI_ID_KEY_INVENTORY_BUTTON,
50         GUI_ID_KEY_DUMP_BUTTON,
51         GUI_ID_KEY_RANGE_BUTTON
52 };
53
54 class GUIKeyChangeMenu: public GUIModalMenu
55 {
56 public:
57         GUIKeyChangeMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
58                         s32 id, IMenuManager *menumgr);
59         ~GUIKeyChangeMenu();
60
61         void removeChildren();
62         /*
63          Remove and re-add (or reposition) stuff
64          */
65         void regenerateGui(v2u32 screensize);
66
67         void drawMenu();
68
69         bool acceptInput();
70
71         bool OnEvent(const SEvent& event);
72
73 private:
74
75         void init_keys();
76
77         bool resetMenu();
78
79         gui::IGUIButton *forward;
80         gui::IGUIButton *backward;
81         gui::IGUIButton *left;
82         gui::IGUIButton *right;
83         gui::IGUIButton *use;
84         gui::IGUIButton *sneak;
85         gui::IGUIButton *jump;
86         gui::IGUIButton *dropbtn;
87         gui::IGUIButton *inventory;
88         gui::IGUIButton *fly;
89         gui::IGUIButton *fast;
90         gui::IGUIButton *range;
91         gui::IGUIButton *dump;
92         gui::IGUIButton *chat;
93         gui::IGUIButton *cmd;
94
95         s32 activeKey;
96         KeyPress key_forward;
97         KeyPress key_backward;
98         KeyPress key_left;
99         KeyPress key_right;
100         KeyPress key_use;
101         KeyPress key_sneak;
102         KeyPress key_jump;
103         KeyPress key_drop;
104         KeyPress key_inventory;
105         KeyPress key_fly;
106         KeyPress key_fast;
107         KeyPress key_range;
108         KeyPress key_chat;
109         KeyPress key_cmd;
110         KeyPress key_dump;
111 };
112
113 #endif
114