Move touchscreen input handling to base GUIModalMenu class
[oweals/minetest.git] / src / gui / guiConfirmRegistration.h
1 /*
2 Minetest
3 Copyright (C) 2018 srifqi, Muhammad Rifqi Priyo Susanto
4                 <muhammadrifqipriyosusanto@gmail.com>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #pragma once
22
23 #include "irrlichttypes_extrabloated.h"
24 #include "modalMenu.h"
25 #include <string>
26
27 class Client;
28
29 class GUIConfirmRegistration : public GUIModalMenu
30 {
31 public:
32         GUIConfirmRegistration(gui::IGUIEnvironment *env, gui::IGUIElement *parent,
33                         s32 id, IMenuManager *menumgr, Client *client,
34                         const std::string &playername, const std::string &password,
35                         const std::string &address, bool *aborted);
36         ~GUIConfirmRegistration();
37
38         void removeChildren();
39         /*
40                 Remove and re-add (or reposition) stuff
41         */
42         void regenerateGui(v2u32 screensize);
43
44         void drawMenu();
45
46         void closeMenu(bool goNext);
47
48         void acceptInput();
49
50         bool processInput();
51
52         bool OnEvent(const SEvent &event);
53 #ifdef __ANDROID__
54         bool getAndroidUIInput();
55 #endif
56
57 private:
58         std::wstring getLabelByID(s32 id) { return L""; }
59         std::string getNameByID(s32 id) { return "password"; }
60
61         Client *m_client = nullptr;
62         const std::string &m_playername;
63         const std::string &m_password;
64         const std::string &m_address;
65         bool *m_aborted = nullptr;
66         std::wstring m_pass_confirm = L"";
67 };