]> git.lizzy.rs Git - dragonfireclient.git/blob - src/gui/guiKeyChangeMenu.h
Replace all uses of core::list with std::list (#12313)
[dragonfireclient.git] / src / gui / 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 #pragma once
23
24 #include "irrlichttypes_extrabloated.h"
25 #include "modalMenu.h"
26 #include "gettext.h"
27 #include "client/keycode.h"
28 #include <string>
29 #include <vector>
30
31 class ISimpleTextureSource;
32
33 struct key_setting
34 {
35         int id;
36         const wchar_t *button_name;
37         KeyPress key;
38         std::string setting_name;
39         gui::IGUIButton *button;
40 };
41
42 class GUIKeyChangeMenu : public GUIModalMenu
43 {
44 public:
45         GUIKeyChangeMenu(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id,
46                         IMenuManager *menumgr, ISimpleTextureSource *tsrc);
47         ~GUIKeyChangeMenu();
48
49         /*
50          Remove and re-add (or reposition) stuff
51          */
52         void regenerateGui(v2u32 screensize);
53
54         void drawMenu();
55
56         bool acceptInput();
57
58         bool OnEvent(const SEvent &event);
59
60         bool pausesGame() { return true; }
61
62 protected:
63         std::wstring getLabelByID(s32 id) { return L""; }
64         std::string getNameByID(s32 id) { return ""; }
65
66 private:
67         void init_keys();
68
69         bool resetMenu();
70
71         void add_key(int id, const wchar_t *button_name, const std::string &setting_name);
72
73         bool shift_down = false;
74
75         key_setting *active_key = nullptr;
76         gui::IGUIStaticText *key_used_text = nullptr;
77         std::vector<key_setting *> key_settings;
78         ISimpleTextureSource *m_tsrc;
79 };