OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
MWGui::ContainerItemModel Class Reference

The container item model supports multiple item sources, which are needed for making NPCs sell items from containers owned by them. More...

#include <containeritemmodel.hpp>

Inheritance diagram for MWGui::ContainerItemModel:
Collaboration diagram for MWGui::ContainerItemModel:

Public Member Functions

 ContainerItemModel (const std::vector< MWWorld::Ptr > &itemSources, const std::vector< MWWorld::Ptr > &worldItems)
 
 ContainerItemModel (const MWWorld::Ptr &source)
 
virtual ItemStack getItem (ModelIndex index)
 Throws for invalid index or out of range index. More...
 
virtual ModelIndex getIndex (ItemStack item)
 Returns an invalid index if the item was not found. More...
 
virtual size_t getItemCount ()
 
virtual MWWorld::Ptr copyItem (const ItemStack &item, size_t count, bool setNewOwner=false)
 
virtual void removeItem (const ItemStack &item, size_t count)
 
virtual void update ()
 Rebuild the item model, this will invalidate existing model indices. More...
 
- Public Member Functions inherited from MWGui::ItemModel
 ItemModel ()
 
virtual ~ItemModel ()
 
virtual MWWorld::Ptr moveItem (const ItemStack &item, size_t count, ItemModel *otherModel)
 
virtual bool allowedToInsertItems () const
 Is the player allowed to insert items into this model? (default true) More...
 

Private Attributes

std::vector< MWWorld::PtrmItemSources
 
std::vector< MWWorld::PtrmWorldItems
 
std::vector< ItemStackmItems
 

Additional Inherited Members

- Public Types inherited from MWGui::ItemModel
typedef int ModelIndex
 

Detailed Description

The container item model supports multiple item sources, which are needed for making NPCs sell items from containers owned by them.

Constructor & Destructor Documentation

MWGui::ContainerItemModel::ContainerItemModel ( const std::vector< MWWorld::Ptr > &  itemSources,
const std::vector< MWWorld::Ptr > &  worldItems 
)
Note
The order of elements itemSources matters here. The first element has the highest priority for removal, while the last element will be used to add new items to.
MWGui::ContainerItemModel::ContainerItemModel ( const MWWorld::Ptr source)

Member Function Documentation

MWWorld::Ptr MWGui::ContainerItemModel::copyItem ( const ItemStack item,
size_t  count,
bool  setNewOwner = false 
)
virtual
Parameters
setNewOwnerIf true, set the copied item's owner to the actor we are copying to, otherwise reset owner to ""

Implements MWGui::ItemModel.

Here is the call graph for this function:

ItemModel::ModelIndex MWGui::ContainerItemModel::getIndex ( ItemStack  item)
virtual

Returns an invalid index if the item was not found.

Implements MWGui::ItemModel.

ItemStack MWGui::ContainerItemModel::getItem ( ModelIndex  index)
virtual

Throws for invalid index or out of range index.

Implements MWGui::ItemModel.

size_t MWGui::ContainerItemModel::getItemCount ( )
virtual

The number of items in the model, this specifies the range of indices you can pass to the getItem function (but this range is only valid until the next call to update())

Implements MWGui::ItemModel.

void MWGui::ContainerItemModel::removeItem ( const ItemStack item,
size_t  count 
)
virtual

Implements MWGui::ItemModel.

Here is the call graph for this function:

void MWGui::ContainerItemModel::update ( )
virtual

Rebuild the item model, this will invalidate existing model indices.

Implements MWGui::ItemModel.

Here is the call graph for this function:

Member Data Documentation

std::vector<ItemStack> MWGui::ContainerItemModel::mItems
private
std::vector<MWWorld::Ptr> MWGui::ContainerItemModel::mItemSources
private
std::vector<MWWorld::Ptr> MWGui::ContainerItemModel::mWorldItems
private

The documentation for this class was generated from the following files: