3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 All kinds of stuff that needs to be exposed from main.cpp
25 #include "modalMenu.h"
32 virtual void exitToOS() = 0;
33 virtual void keyConfig() = 0;
34 virtual void disconnect() = 0;
35 virtual void changePassword() = 0;
36 virtual void changeVolume() = 0;
38 virtual void signalKeyConfigChange() = 0;
41 extern gui::IGUIEnvironment *guienv;
42 extern gui::IGUIStaticText *guiroot;
44 // Handler for the modal menus
46 class MainMenuManager : public IMenuManager
49 virtual void createdMenu(gui::IGUIElement *menu)
51 for (gui::IGUIElement *i : m_stack) {
56 m_stack.back()->setVisible(false);
57 m_stack.push_back(menu);
60 virtual void deletingMenu(gui::IGUIElement *menu)
62 // Remove all entries if there are duplicates
65 removed_entry = false;
66 for(std::list<gui::IGUIElement*>::iterator
68 i != m_stack.end(); ++i)
77 }while(removed_entry);
79 /*core::list<GUIModalMenu*>::Iterator i = m_stack.getLast();
84 m_stack.back()->setVisible(true);
87 // Returns true to prevent further processing
88 virtual bool preprocessEvent(const SEvent& event)
92 GUIModalMenu *mm = dynamic_cast<GUIModalMenu*>(m_stack.back());
93 return mm && mm->preprocessEvent(event);
98 return m_stack.size();
103 for (gui::IGUIElement *i : m_stack) {
104 GUIModalMenu *mm = dynamic_cast<GUIModalMenu*>(i);
105 if (mm && mm->pausesGame())
111 std::list<gui::IGUIElement*> m_stack;
114 extern MainMenuManager g_menumgr;
116 extern bool isMenuActive();
118 class MainGameCallback : public IGameCallback
121 MainGameCallback() = default;
122 virtual ~MainGameCallback() = default;
124 virtual void exitToOS()
126 shutdown_requested = true;
129 virtual void disconnect()
131 disconnect_requested = true;
134 virtual void changePassword()
136 changepassword_requested = true;
139 virtual void changeVolume()
141 changevolume_requested = true;
144 virtual void keyConfig()
146 keyconfig_requested = true;
149 virtual void signalKeyConfigChange()
151 keyconfig_changed = true;
155 bool disconnect_requested = false;
156 bool changepassword_requested = false;
157 bool changevolume_requested = false;
158 bool keyconfig_requested = false;
159 bool shutdown_requested = false;
161 bool keyconfig_changed = false;
164 extern MainGameCallback *g_gamecallback;