LocalPlayer::accelerateHorizontal: cleanups
[oweals/minetest.git] / src / modalMenu.h
index 2c512d3ca08eb4fc921272a46f65ca5e00f97800..7dbf36fbc7455e3be8204e85de5083e22a23020a 100644 (file)
@@ -31,8 +31,8 @@ class IMenuManager
 {
 public:
        // A GUIModalMenu calls these when this class is passed as a parameter
-       virtual void createdMenu(GUIModalMenu *menu) = 0;
-       virtual void deletingMenu(GUIModalMenu *menu) = 0;
+       virtual void createdMenu(gui::IGUIElement *menu) = 0;
+       virtual void deletingMenu(gui::IGUIElement *menu) = 0;
 };
 
 /*
@@ -43,22 +43,18 @@ public:
 class GUIModalMenu : public gui::IGUIElement
 {
 public:
-       GUIModalMenu(gui::IGUIEnvironment* env,
-                       gui::IGUIElement* parent, s32 id,
+       GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id,
                        IMenuManager *menumgr):
                IGUIElement(gui::EGUIET_ELEMENT, env, parent, id,
                                core::rect<s32>(0,0,100,100))
        {
-               //m_force_regenerate_gui = false;
-               
                m_menumgr = menumgr;
-               m_allow_focus_removal = false;
-               m_screensize_old = v2u32(0,0);
 
                setVisible(true);
                Environment->setFocus(this);
                m_menumgr->createdMenu(this);
        }
+
        virtual ~GUIModalMenu()
        {
                m_menumgr->deletingMenu(this);
@@ -78,7 +74,7 @@ public:
        {
                if(!IsVisible)
                        return;
-                       
+
                video::IVideoDriver* driver = Environment->getVideoDriver();
                v2u32 screensize = driver->getScreenSize();
                if(screensize != m_screensize_old /*|| m_force_regenerate_gui*/)
@@ -90,12 +86,14 @@ public:
 
                drawMenu();
        }
-       
+
        /*
                This should be called when the menu wants to quit.
 
                WARNING: THIS DEALLOCATES THE MENU FROM MEMORY. Return
                immediately if you call this from the menu itself.
+
+               (More precisely, this decrements the reference count.)
        */
        void quitMenu()
        {
@@ -106,7 +104,7 @@ public:
                this->remove();
 #ifdef HAVE_TOUCHSCREENGUI
                if (g_touchscreengui)
-                       g_touchscreengui->Show();
+                       g_touchscreengui->show();
 #endif
        }
 
@@ -140,7 +138,7 @@ private:
        IMenuManager *m_menumgr;
        // This might be necessary to expose to the implementation if it
        // wants to launch other menus
-       bool m_allow_focus_removal;
+       bool m_allow_focus_removal = false;
 };