2012-05-17 11:36:25 +00:00
|
|
|
#ifndef MWGUI_TRADEWINDOW_H
|
|
|
|
#define MWGUI_TRADEWINDOW_H
|
|
|
|
|
2016-06-04 16:28:47 +00:00
|
|
|
#include "../mwmechanics/trading.hpp"
|
|
|
|
|
2015-01-10 00:21:17 +00:00
|
|
|
#include "referenceinterface.hpp"
|
|
|
|
#include "windowbase.hpp"
|
2012-05-17 15:15:44 +00:00
|
|
|
|
2014-09-25 18:28:00 +00:00
|
|
|
namespace Gui
|
2012-05-17 11:36:25 +00:00
|
|
|
{
|
2014-09-25 18:28:00 +00:00
|
|
|
class NumericEditBox;
|
2012-05-17 11:36:25 +00:00
|
|
|
}
|
|
|
|
|
2015-01-10 01:50:43 +00:00
|
|
|
namespace MyGUI
|
2012-05-17 11:36:25 +00:00
|
|
|
{
|
2015-01-10 01:50:43 +00:00
|
|
|
class ControllerItem;
|
2012-05-17 11:36:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2013-05-11 16:38:27 +00:00
|
|
|
class ItemView;
|
|
|
|
class SortFilterItemModel;
|
|
|
|
class TradeItemModel;
|
|
|
|
|
|
|
|
class TradeWindow : public WindowBase, public ReferenceInterface
|
2012-05-17 11:36:25 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-04-10 18:46:21 +00:00
|
|
|
TradeWindow();
|
2012-05-17 11:36:25 +00:00
|
|
|
|
2013-05-11 16:38:27 +00:00
|
|
|
void startTrade(const MWWorld::Ptr& actor);
|
2012-05-18 13:51:33 +00:00
|
|
|
|
2013-05-11 16:38:27 +00:00
|
|
|
void borrowItem (int index, size_t count);
|
|
|
|
void returnItem (int index, size_t count);
|
|
|
|
|
|
|
|
int getMerchantServices();
|
|
|
|
|
2014-05-27 03:13:37 +00:00
|
|
|
virtual void exit();
|
|
|
|
|
2014-07-07 21:37:59 +00:00
|
|
|
virtual void resetReference();
|
2013-05-11 16:38:27 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
ItemView* mItemView;
|
|
|
|
SortFilterItemModel* mSortModel;
|
|
|
|
TradeItemModel* mTradeModel;
|
2016-06-04 16:28:47 +00:00
|
|
|
MWMechanics::Trading mTrading;
|
2013-05-11 16:38:27 +00:00
|
|
|
|
2013-02-22 17:33:23 +00:00
|
|
|
static const float sBalanceChangeInitialPause; // in seconds
|
|
|
|
static const float sBalanceChangeInterval; // in seconds
|
|
|
|
|
2012-05-17 11:36:25 +00:00
|
|
|
MyGUI::Button* mFilterAll;
|
|
|
|
MyGUI::Button* mFilterWeapon;
|
|
|
|
MyGUI::Button* mFilterApparel;
|
|
|
|
MyGUI::Button* mFilterMagic;
|
|
|
|
MyGUI::Button* mFilterMisc;
|
|
|
|
|
2012-05-17 19:15:48 +00:00
|
|
|
MyGUI::Button* mIncreaseButton;
|
|
|
|
MyGUI::Button* mDecreaseButton;
|
|
|
|
MyGUI::TextBox* mTotalBalanceLabel;
|
2014-09-25 18:28:00 +00:00
|
|
|
Gui::NumericEditBox* mTotalBalance;
|
2012-05-17 19:15:48 +00:00
|
|
|
|
|
|
|
MyGUI::Widget* mBottomPane;
|
|
|
|
|
|
|
|
MyGUI::Button* mMaxSaleButton;
|
|
|
|
MyGUI::Button* mCancelButton;
|
|
|
|
MyGUI::Button* mOfferButton;
|
|
|
|
MyGUI::TextBox* mPlayerGold;
|
|
|
|
MyGUI::TextBox* mMerchantGold;
|
|
|
|
|
2013-05-11 16:38:27 +00:00
|
|
|
int mItemToSell;
|
|
|
|
|
2012-05-17 19:56:16 +00:00
|
|
|
int mCurrentBalance;
|
2012-11-08 12:38:20 +00:00
|
|
|
int mCurrentMerchantOffer;
|
2012-05-17 19:56:16 +00:00
|
|
|
|
2013-05-11 16:38:27 +00:00
|
|
|
void sellToNpc(const MWWorld::Ptr& item, int count, bool boughtItem); ///< only used for adjusting the gold balance
|
|
|
|
void buyFromNpc(const MWWorld::Ptr& item, int count, bool soldItem); ///< only used for adjusting the gold balance
|
|
|
|
|
2014-09-22 09:26:16 +00:00
|
|
|
void updateOffer();
|
|
|
|
|
2013-05-11 16:38:27 +00:00
|
|
|
void onItemSelected (int index);
|
|
|
|
void sellItem (MyGUI::Widget* sender, int count);
|
|
|
|
|
2012-05-17 11:36:25 +00:00
|
|
|
void onFilterChanged(MyGUI::Widget* _sender);
|
2012-05-17 19:15:48 +00:00
|
|
|
void onOfferButtonClicked(MyGUI::Widget* _sender);
|
|
|
|
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
2013-03-04 11:21:38 +00:00
|
|
|
void onMaxSaleButtonClicked(MyGUI::Widget* _sender);
|
2013-02-10 04:50:36 +00:00
|
|
|
void onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
|
|
|
void onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
|
|
|
void onBalanceButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
2014-09-25 18:28:00 +00:00
|
|
|
void onBalanceValueChanged(int value);
|
2014-09-10 22:25:09 +00:00
|
|
|
void onRepeatClick(MyGUI::Widget* widget, MyGUI::ControllerItem* controller);
|
|
|
|
|
|
|
|
void addRepeatController(MyGUI::Widget* widget);
|
2013-02-10 04:50:36 +00:00
|
|
|
|
|
|
|
void onIncreaseButtonTriggered();
|
|
|
|
void onDecreaseButtonTriggered();
|
2012-05-17 19:56:16 +00:00
|
|
|
|
2014-01-08 22:37:46 +00:00
|
|
|
void addOrRemoveGold(int gold, const MWWorld::Ptr& actor);
|
|
|
|
|
2012-05-17 19:56:16 +00:00
|
|
|
void updateLabels();
|
2012-05-26 23:14:33 +00:00
|
|
|
|
|
|
|
virtual void onReferenceUnavailable();
|
2013-03-04 11:21:38 +00:00
|
|
|
|
|
|
|
int getMerchantGold();
|
2014-12-20 19:17:14 +00:00
|
|
|
|
|
|
|
void restock();
|
2012-05-17 11:36:25 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|