OpenMW
Public Member Functions | Private Member Functions | Private Attributes
MWGui::TradeItemModel Class Reference

An item model that allows 'borrowing' items from another item model. Used for previewing barter offers. Also filters items that the merchant does not sell. More...

#include <tradeitemmodel.hpp>

List of all members.

Public Member Functions

 TradeItemModel (ItemModel *sourceModel, const MWWorld::Ptr &merchant)
virtual ItemStack getItem (ModelIndex index)
 throws for invalid index
virtual size_t getItemCount ()
virtual void update ()
void borrowItemFromUs (ModelIndex itemIndex, size_t count)
void borrowItemToUs (ModelIndex itemIndex, ItemModel *source, size_t count)
void returnItemBorrowedToUs (ModelIndex itemIndex, size_t count)
void returnItemBorrowedFromUs (ModelIndex itemIndex, ItemModel *source, size_t count)
void transferItems ()
 Permanently transfers items that were borrowed to us from another model to this model.
void abort ()
 Aborts trade.
std::vector< ItemStackgetItemsBorrowedToUs ()

Private Member Functions

void borrowImpl (const ItemStack &item, std::vector< ItemStack > &out)
void unborrowImpl (const ItemStack &item, size_t count, std::vector< ItemStack > &out)

Private Attributes

std::vector< ItemStackmItems
std::vector< ItemStackmBorrowedToUs
std::vector< ItemStackmBorrowedFromUs
MWWorld::Ptr mMerchant

Detailed Description

An item model that allows 'borrowing' items from another item model. Used for previewing barter offers. Also filters items that the merchant does not sell.


Constructor & Destructor Documentation

MWGui::TradeItemModel::TradeItemModel ( ItemModel sourceModel,
const MWWorld::Ptr merchant 
)

Member Function Documentation

Aborts trade.

void MWGui::TradeItemModel::borrowImpl ( const ItemStack item,
std::vector< ItemStack > &  out 
) [private]
void MWGui::TradeItemModel::borrowItemFromUs ( ModelIndex  itemIndex,
size_t  count 
)
void MWGui::TradeItemModel::borrowItemToUs ( ModelIndex  itemIndex,
ItemModel source,
size_t  count 
)
Note:
itemIndex points to an item in source

throws for invalid index

Implements MWGui::ItemModel.

Implements MWGui::ItemModel.

void MWGui::TradeItemModel::returnItemBorrowedFromUs ( ModelIndex  itemIndex,
ItemModel source,
size_t  count 
)
void MWGui::TradeItemModel::returnItemBorrowedToUs ( ModelIndex  itemIndex,
size_t  count 
)

Permanently transfers items that were borrowed to us from another model to this model.

void MWGui::TradeItemModel::unborrowImpl ( const ItemStack item,
size_t  count,
std::vector< ItemStack > &  out 
) [private]
void MWGui::TradeItemModel::update ( ) [virtual]

Implements MWGui::ItemModel.


Member Data Documentation

std::vector<ItemStack> MWGui::TradeItemModel::mItems [private]

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