3 Copyright (C) 2010 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 General Public License as published by
7 the Free Software Foundation; either version 2 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 General Public License for more details.
15 You should have received a copy of the GNU 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.
21 #ifndef GUIINVENTORYMENU_HEADER
22 #define GUIINVENTORYMENU_HEADER
24 #include "common_irrlicht.h"
25 #include "inventory.h"
27 #include "modalMenu.h"
29 void drawInventoryItem(video::IVideoDriver *driver,
31 InventoryItem *item, core::rect<s32> rect,
32 const core::rect<s32> *clip);
34 class GUIInventoryMenu : public GUIModalMenu
42 ItemSpec(const std::string &a_inventoryname,
43 const std::string &a_listname,
46 inventoryname = a_inventoryname;
47 listname = a_listname;
55 std::string inventoryname;
65 ListDrawSpec(const std::string &a_inventoryname,
66 const std::string &a_listname,
67 v2s32 a_pos, v2s32 a_geom)
69 inventoryname = a_inventoryname;
70 listname = a_listname;
75 std::string inventoryname;
86 DrawSpec(const std::string &a_type,
87 const std::string &a_name,
88 const std::string &a_subname,
106 GUIInventoryMenu(gui::IGUIEnvironment* env,
107 gui::IGUIElement* parent, s32 id,
108 IMenuManager *menumgr,
111 InventoryManager *invmgr
115 void setDrawSpec(core::array<DrawSpec> &init_draw_spec)
117 m_init_draw_spec = init_draw_spec;
120 void removeChildren();
122 Remove and re-add (or reposition) stuff
124 void regenerateGui(v2u32 screensize);
126 ItemSpec getItemAtPos(v2s32 p) const;
127 void drawList(const ListDrawSpec &s);
130 bool OnEvent(const SEvent& event);
133 v2s32 getBasePos() const
135 return padding + AbsoluteRect.UpperLeftCorner;
144 InventoryContext *m_c;
145 InventoryManager *m_invmgr;
147 core::array<DrawSpec> m_init_draw_spec;
148 core::array<ListDrawSpec> m_draw_spec;
150 ItemSpec *m_selected_item;