Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
guiKeyChangeMenu.h
Go to the documentation of this file.
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
25#include "modalMenu.h"
26#include "gettext.h"
27#include "client/keycode.h"
28#include <string>
29#include <vector>
30
32
34{
35 int id;
36 std::wstring button_name;
38 std::string setting_name;
39 gui::IGUIButton *button;
40};
41
43{
44public:
45 GUIKeyChangeMenu(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id,
46 IMenuManager *menumgr, ISimpleTextureSource *tsrc);
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
62protected:
63 std::wstring getLabelByID(s32 id) { return L""; }
64 std::string getNameByID(s32 id) { return ""; }
65
66private:
67 void init_keys();
68
69 bool resetMenu();
70
71 void add_key(int id, std::wstring button_name, const std::string &setting_name);
72
73 bool shift_down = false;
74
76 gui::IGUIStaticText *key_used_text = nullptr;
77 std::vector<key_setting *> key_settings;
79};
Definition: guiKeyChangeMenu.h:43
void add_key(int id, std::wstring button_name, const std::string &setting_name)
Definition: guiKeyChangeMenu.cpp:373
std::string getNameByID(s32 id)
Definition: guiKeyChangeMenu.h:64
bool resetMenu()
Definition: guiKeyChangeMenu.cpp:260
bool acceptInput()
Definition: guiKeyChangeMenu.cpp:225
void regenerateGui(v2u32 screensize)
Definition: guiKeyChangeMenu.cpp:105
ISimpleTextureSource * m_tsrc
Definition: guiKeyChangeMenu.h:78
bool pausesGame()
Definition: guiKeyChangeMenu.h:60
key_setting * active_key
Definition: guiKeyChangeMenu.h:75
~GUIKeyChangeMenu()
Definition: guiKeyChangeMenu.cpp:94
bool OnEvent(const SEvent &event)
Definition: guiKeyChangeMenu.cpp:269
gui::IGUIStaticText * key_used_text
Definition: guiKeyChangeMenu.h:76
bool shift_down
Definition: guiKeyChangeMenu.h:73
std::vector< key_setting * > key_settings
Definition: guiKeyChangeMenu.h:77
void drawMenu()
Definition: guiKeyChangeMenu.cpp:212
std::wstring getLabelByID(s32 id)
Definition: guiKeyChangeMenu.h:63
void init_keys()
Definition: guiKeyChangeMenu.cpp:384
Definition: modalMenu.h:48
Definition: modalMenu.h:37
Definition: texturesource.h:34
Definition: keycode.h:39
core::vector2d< u32 > v2u32
Definition: irr_v2d.h:29
Definition: guiKeyChangeMenu.h:34
std::string setting_name
Definition: guiKeyChangeMenu.h:38
std::wstring button_name
Definition: guiKeyChangeMenu.h:36
int id
Definition: guiKeyChangeMenu.h:35
gui::IGUIButton * button
Definition: guiKeyChangeMenu.h:39
KeyPress key
Definition: guiKeyChangeMenu.h:37