mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-08 09:37:53 +00:00
38 lines
1.1 KiB
C++
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
|