cleanup
[waspsaliva.git] / src / gui / guiKeyChangeMenu.h
blob1c0f40247fee1f008cf7b85428259469d476a125
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>
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.
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.
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.
22 #pragma once
24 #include "irrlichttypes_extrabloated.h"
25 #include "modalMenu.h"
26 #include "gettext.h"
27 #include "client/keycode.h"
28 #include <string>
29 #include <vector>
31 class ISimpleTextureSource;
33 struct key_setting
35 int id;
36 const wchar_t *button_name;
37 KeyPress key;
38 std::string setting_name;
39 gui::IGUIButton *button;
42 class GUIKeyChangeMenu : public GUIModalMenu
44 public:
45 GUIKeyChangeMenu(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id,
46 IMenuManager *menumgr, ISimpleTextureSource *tsrc);
47 ~GUIKeyChangeMenu();
49 void removeChildren();
51 Remove and re-add (or reposition) stuff
53 void regenerateGui(v2u32 screensize);
55 void drawMenu();
57 bool acceptInput();
59 bool OnEvent(const SEvent &event);
61 bool pausesGame() { return true; }
63 protected:
64 std::wstring getLabelByID(s32 id) { return L""; }
65 std::string getNameByID(s32 id) { return ""; }
67 private:
68 void init_keys();
70 bool resetMenu();
72 void add_key(int id, const wchar_t *button_name, const std::string &setting_name);
74 bool shift_down = false;
76 key_setting *active_key = nullptr;
77 gui::IGUIStaticText *key_used_text = nullptr;
78 std::vector<key_setting *> key_settings;
79 ISimpleTextureSource *m_tsrc;