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 MWWorld::Ptr copyItem (const ItemStack& item, size_t count, bool setNewOwner=false);
19  virtual void removeItem (const ItemStack& item, size_t count);
20 
22  virtual MWWorld::Ptr moveItem (const ItemStack& item, size_t count, ItemModel* otherModel);
23 
24  virtual void update();
25 
26  protected:
28  private:
29  std::vector<ItemStack> mItems;
30  };
31 
32 }
33 
34 #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:60
MWWorld::Ptr mActor
Definition: inventoryitemmodel.hpp:27
virtual size_t getItemCount()
Definition: inventoryitemmodel.cpp:24
virtual ModelIndex getIndex(ItemStack item)
Returns an invalid index if the item was not found.
Definition: inventoryitemmodel.cpp:29
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:71
InventoryItemModel(const MWWorld::Ptr &actor)
Definition: inventoryitemmodel.cpp:10
std::vector< ItemStack > mItems
Definition: inventoryitemmodel.hpp:29
virtual MWWorld::Ptr copyItem(const ItemStack &item, size_t count, bool setNewOwner=false)
Definition: inventoryitemmodel.cpp:41
virtual void removeItem(const ItemStack &item, size_t count)
Definition: inventoryitemmodel.cpp:49
virtual ItemStack getItem(ModelIndex index)
Throws for invalid index or out of range index.
Definition: inventoryitemmodel.cpp:15
Definition: inventoryitemmodel.hpp:9
Pointer to a LiveCellRef.
Definition: ptr.hpp:19