]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/guiInventoryMenu.h
fixed server sending wrong position of node removal
[dragonfireclient.git] / src / guiInventoryMenu.h
index 0032ce66aa64b15403b7d7db952a26ff906b827e..45a5e236a42ebbcb987e7c9f7ed76cfab2469b8c 100644 (file)
@@ -24,12 +24,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "common_irrlicht.h"
 #include "inventory.h"
 #include "utility.h"
+#include "modalMenu.h"
 
-void drawInventoryItem(gui::IGUIEnvironment* env,
+void drawInventoryItem(video::IVideoDriver *driver,
+               gui::IGUIFont *font,
                InventoryItem *item, core::rect<s32> rect,
-               const core::rect<s32> *clip=0);
+               const core::rect<s32> *clip);
 
-class GUIInventoryMenu : public gui::IGUIElement
+class GUIInventoryMenu : public GUIModalMenu
 {
        struct ItemSpec
        {
@@ -71,35 +73,23 @@ class GUIInventoryMenu : public gui::IGUIElement
 public:
        GUIInventoryMenu(gui::IGUIEnvironment* env,
                        gui::IGUIElement* parent, s32 id,
-                       Inventory *inventory);
+                       Inventory *inventory,
+                       Queue<InventoryAction*> *actions,
+                       IMenuManager *menumgr);
        ~GUIInventoryMenu();
 
+       void removeChildren();
        /*
                Remove and re-add (or reposition) stuff
        */
-       void resizeGui();
+       void regenerateGui(v2u32 screensize);
        
        ItemSpec getItemAtPos(v2s32 p) const;
        void drawList(const ListDrawSpec &s);
-       void draw();
-
-       void launch()
-       {
-               setVisible(true);
-               Environment->setFocus(this);
-       }
-
-       bool canTakeFocus(gui::IGUIElement *e)
-       {
-               return (e && (e == this || isMyChild(e)));
-       }
+       void drawMenu();
 
        bool OnEvent(const SEvent& event);
        
-       // Actions returned by this are sent to the server.
-       // Server replies by updating the inventory.
-       InventoryAction* getNextAction();
-       
 private:
        v2s32 getBasePos() const
        {
@@ -113,11 +103,9 @@ class GUIInventoryMenu : public gui::IGUIElement
        core::array<ListDrawSpec> m_draw_positions;
 
        Inventory *m_inventory;
-       v2u32 m_screensize_old;
 
        ItemSpec *m_selected_item;
-       
-       Queue<InventoryAction*> m_actions;
+       Queue<InventoryAction*> *m_actions;
 };
 
 #endif