1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/apps/openmw/mwgui/containeritemmodel.hpp

39 lines
1.2 KiB
C++
Raw Normal View History

2013-05-11 16:38:27 +00:00
#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:
2013-05-27 00:18:36 +00:00
ContainerItemModel (const std::vector<MWWorld::Ptr>& itemSources, const std::vector<MWWorld::Ptr>& worldItems);
2013-05-11 16:38:27 +00:00
///< @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 MWWorld::Ptr copyItem (const ItemStack& item, size_t count, bool setNewOwner=false);
2013-05-11 16:38:27 +00:00
virtual void removeItem (const ItemStack& item, size_t count);
virtual void update();
private:
std::vector<MWWorld::Ptr> mItemSources;
2013-05-27 00:18:36 +00:00
std::vector<MWWorld::Ptr> mWorldItems;
2013-05-11 16:38:27 +00:00
std::vector<ItemStack> mItems;
};
}
#endif