Fix unit test if there isn't a localhost address (for example FreeBSD jails), second...
[oweals/minetest.git] / src / mainmenumanager.h
index ecfb89fd3111091184eaedaf2b97fde710a8c7a2..b14ca56e51c84f912d33a82603a2f000c375c8ae 100644 (file)
@@ -25,9 +25,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 #include "debug.h" // assert
 #include "modalMenu.h"
-#include "guiPauseMenu.h" //For IGameCallback
 #include <list>
 
+class IGameCallback
+{
+public:
+       virtual void exitToOS() = 0;
+       virtual void keyConfig() = 0;
+       virtual void disconnect() = 0;
+       virtual void changePassword() = 0;
+       virtual void changeVolume() = 0;
+
+       virtual void signalKeyConfigChange() = 0;
+};
+
 extern gui::IGUIEnvironment* guienv;
 extern gui::IGUIStaticText *guiroot;
 
@@ -45,7 +56,7 @@ public:
                        assert(*i != menu);
                }
 
-               if(m_stack.size() != 0)
+               if(!m_stack.empty())
                        m_stack.back()->setVisible(false);
                m_stack.push_back(menu);
        }
@@ -73,14 +84,14 @@ public:
                assert(*i == menu);
                m_stack.erase(i);*/
                
-               if(m_stack.size() != 0)
+               if(!m_stack.empty())
                        m_stack.back()->setVisible(true);
        }
 
        // Returns true to prevent further processing
        virtual bool preprocessEvent(const SEvent& event)
        {
-               if(m_stack.size() != 0)
+               if(!m_stack.empty())
                        return m_stack.back()->preprocessEvent(event);
                else
                        return false;
@@ -116,13 +127,19 @@ public:
                disconnect_requested(false),
                changepassword_requested(false),
                changevolume_requested(false),
+               keyconfig_requested(false),
+               shutdown_requested(false),
+               keyconfig_changed(false),
                device(a_device)
        {
        }
 
        virtual void exitToOS()
        {
+               shutdown_requested = true;
+#ifndef __ANDROID__
                device->closeDevice();
+#endif
        }
 
        virtual void disconnect()
@@ -139,10 +156,26 @@ public:
        {
                changevolume_requested = true;
        }
+
+       virtual void keyConfig()
+       {
+               keyconfig_requested = true;
+       }
+
+       virtual void signalKeyConfigChange()
+       {
+               keyconfig_changed = true;
+       }
+
        
        bool disconnect_requested;
        bool changepassword_requested;
        bool changevolume_requested;
+       bool keyconfig_requested;
+       bool shutdown_requested;
+
+       bool keyconfig_changed;
+
        IrrlichtDevice *device;
 };