@ -57,7 +57,7 @@ namespace MWGui
{
if (mDragAndDrop->mIsOnDragAndDrop)
if (!dynamic_cast<PickpocketItemModel*>(mModel))
if (mModel && mModel->allowedToInsertItems())
dropItem();
return;
}
@ -126,7 +126,7 @@ namespace MWGui
void ContainerWindow::onBackgroundSelected()
if (mDragAndDrop->mIsOnDragAndDrop && !dynamic_cast<PickpocketItemModel*>(mModel))
if (mDragAndDrop->mIsOnDragAndDrop && mModel && mModel->allowedToInsertItems())
@ -119,6 +119,11 @@ namespace MWGui
return ret;
bool ItemModel::allowedToInsertItems() const
return true;
ProxyItemModel::ProxyItemModel()
: mSourceModel(NULL)
@ -70,6 +70,9 @@ namespace MWGui
virtual MWWorld::Ptr copyItem (const ItemStack& item, size_t count, bool setNewOwner=false) = 0;
virtual void removeItem (const ItemStack& item, size_t count) = 0;
/// Is the player allowed to insert items into this model? (default true)
virtual bool allowedToInsertItems() const;
private:
ItemModel(const ItemModel&);
ItemModel& operator=(const ItemModel&);
@ -64,4 +64,10 @@ namespace MWGui
/// \todo check if player is detected
bool PickpocketItemModel::allowedToInsertItems() const
// don't allow "reverse pickpocket" (yet)
return false;
@ -15,6 +15,7 @@ namespace MWGui
virtual size_t getItemCount();
virtual void update();
virtual void removeItem (const ItemStack& item, size_t count);
std::vector<ItemStack> mHiddenItems;