OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
inventoryitemmodel.hpp
Go to the documentation of this file.
1 #ifndef MWGUI_INVENTORY_ITEM_MODEL_H
2 #define MWGUI_INVENTORY_ITEM_MODEL_H
3 
4 #include "itemmodel.hpp"
5 
6 namespace MWGui
7 {
8 
10  {
11  public:
12  InventoryItemModel (const MWWorld::Ptr& actor);
13 
14  virtual ItemStack getItem (ModelIndex index);
15  virtual ModelIndex getIndex (ItemStack item);
16  virtual size_t getItemCount();
17 
18  virtual bool onTakeItem(const MWWorld::Ptr &item, int count);
19 
20  virtual MWWorld::Ptr copyItem (const ItemStack& item, size_t count, bool setNewOwner=false);
21  virtual void removeItem (const ItemStack& item, size_t count);
22 
24  virtual MWWorld::Ptr moveItem (const ItemStack& item, size_t count, ItemModel* otherModel);
25 
26  virtual void update();
27 
28  protected:
30  private:
31  std::vector<ItemStack> mItems;
32  };
33 
34 }
35 
36 #endif
The base class that all item models should derive from.
Definition: itemmodel.hpp:43
virtual MWWorld::Ptr moveItem(const ItemStack &item, size_t count, ItemModel *otherModel)
Move items from this model to otherModel.
Definition: inventoryitemmodel.cpp:85
virtual bool onTakeItem(const MWWorld::Ptr &item, int count)
Definition: inventoryitemmodel.cpp:122
MWWorld::Ptr mActor
Definition: inventoryitemmodel.hpp:29
virtual size_t getItemCount()
Definition: inventoryitemmodel.cpp:32
virtual ModelIndex getIndex(ItemStack item)
Returns an invalid index if the item was not found.
Definition: inventoryitemmodel.cpp:37
A single item stack managed by an item model.
Definition: itemmodel.hpp:12
virtual void update()
Rebuild the item model, this will invalidate existing model indices.
Definition: inventoryitemmodel.cpp:96
InventoryItemModel(const MWWorld::Ptr &actor)
Definition: inventoryitemmodel.cpp:18
std::vector< ItemStack > mItems
Definition: inventoryitemmodel.hpp:31
virtual MWWorld::Ptr copyItem(const ItemStack &item, size_t count, bool setNewOwner=false)
Definition: inventoryitemmodel.cpp:49
virtual void removeItem(const ItemStack &item, size_t count)
Definition: inventoryitemmodel.cpp:56
virtual ItemStack getItem(ModelIndex index)
Throws for invalid index or out of range index.
Definition: inventoryitemmodel.cpp:23
Definition: inventoryitemmodel.hpp:9
Pointer to a LiveCellRef.
Definition: ptr.hpp:19