1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 03:54:40 +00:00
OpenMW/apps/openmw/mwgui/containeritemmodel.hpp
2013-05-11 18:38:27 +02:00

38 lines
1.1 KiB
C++

#ifndef MWGUI_CONTAINER_ITEM_MODEL_H
#define MWGUI_CONTAINER_ITEM_MODEL_H
#include "itemmodel.hpp"
namespace MWGui
{
/// @brief The container item model supports multiple item sources, which are needed for
/// making NPCs sell items from containers owned by them
class ContainerItemModel : public ItemModel
{
public:
ContainerItemModel (const std::vector<MWWorld::Ptr>& itemSources);
///< @note The order of elements \a itemSources matters here. The first element has the highest priority for removal,
/// while the last element will be used to add new items to.
ContainerItemModel (const MWWorld::Ptr& source);
virtual ItemStack getItem (ModelIndex index);
virtual ModelIndex getIndex (ItemStack item);
virtual size_t getItemCount();
virtual void copyItem (const ItemStack& item, size_t count);
virtual void removeItem (const ItemStack& item, size_t count);
virtual void update();
private:
std::vector<MWWorld::Ptr> mItemSources;
std::vector<ItemStack> mItems;
};
}
#endif