2012-05-17 13:36:25 +02:00
|
|
|
#ifndef MWGUI_TRADEWINDOW_H
|
|
|
|
#define MWGUI_TRADEWINDOW_H
|
|
|
|
|
|
|
|
#include "container.hpp"
|
2012-05-17 17:15:44 +02:00
|
|
|
|
2014-09-25 20:28:00 +02:00
|
|
|
namespace Gui
|
2012-05-17 13:36:25 +02:00
|
|
|
{
|
2014-09-25 20:28:00 +02:00
|
|
|
class NumericEditBox;
|
2012-05-17 13:36:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
class WindowManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2013-05-11 18:38:27 +02:00
|
|
|
class ItemView;
|
|
|
|
class SortFilterItemModel;
|
|
|
|
class TradeItemModel;
|
|
|
|
|
|
|
|
class TradeWindow : public WindowBase, public ReferenceInterface
|
2012-05-17 13:36:25 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-04-10 14:46:21 -04:00
|
|
|
TradeWindow();
|
2012-05-17 13:36:25 +02:00
|
|
|
|
2013-05-11 18:38:27 +02:00
|
|
|
void startTrade(const MWWorld::Ptr& actor);
|
2012-05-18 15:51:33 +02:00
|
|
|
|
2013-05-11 18:38:27 +02:00
|
|
|
void borrowItem (int index, size_t count);
|
|
|
|
void returnItem (int index, size_t count);
|
|
|
|
|
|
|
|
int getMerchantServices();
|
|
|
|
|
2014-05-26 23:13:37 -04:00
|
|
|
virtual void exit();
|
|
|
|
|
2014-07-07 23:37:59 +02:00
|
|
|
virtual void resetReference();
|
2013-05-11 18:38:27 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
ItemView* mItemView;
|
|
|
|
SortFilterItemModel* mSortModel;
|
|
|
|
TradeItemModel* mTradeModel;
|
|
|
|
|
2013-02-22 21:33:23 +04:00
|
|
|
static const float sBalanceChangeInitialPause; // in seconds
|
|
|
|
static const float sBalanceChangeInterval; // in seconds
|
|
|
|
|
2012-05-17 13:36:25 +02:00
|
|
|
MyGUI::Button* mFilterAll;
|
|
|
|
MyGUI::Button* mFilterWeapon;
|
|
|
|
MyGUI::Button* mFilterApparel;
|
|
|
|
MyGUI::Button* mFilterMagic;
|
|
|
|
MyGUI::Button* mFilterMisc;
|
|
|
|
|
2012-05-17 21:15:48 +02:00
|
|
|
MyGUI::Button* mIncreaseButton;
|
|
|
|
MyGUI::Button* mDecreaseButton;
|
|
|
|
MyGUI::TextBox* mTotalBalanceLabel;
|
2014-09-25 20:28:00 +02:00
|
|
|
Gui::NumericEditBox* mTotalBalance;
|
2012-05-17 21:15:48 +02:00
|
|
|
|
|
|
|
MyGUI::Widget* mBottomPane;
|
|
|
|
|
|
|
|
MyGUI::Button* mMaxSaleButton;
|
|
|
|
MyGUI::Button* mCancelButton;
|
|
|
|
MyGUI::Button* mOfferButton;
|
|
|
|
MyGUI::TextBox* mPlayerGold;
|
|
|
|
MyGUI::TextBox* mMerchantGold;
|
|
|
|
|
2013-05-11 18:38:27 +02:00
|
|
|
int mItemToSell;
|
|
|
|
|
2012-05-17 21:56:16 +02:00
|
|
|
int mCurrentBalance;
|
2012-11-08 13:38:20 +01:00
|
|
|
int mCurrentMerchantOffer;
|
2012-05-17 21:56:16 +02:00
|
|
|
|
2013-05-11 18:38:27 +02: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 11:26:16 +02:00
|
|
|
void updateOffer();
|
|
|
|
|
2013-05-11 18:38:27 +02:00
|
|
|
void onItemSelected (int index);
|
|
|
|
void sellItem (MyGUI::Widget* sender, int count);
|
|
|
|
|
2012-05-17 13:36:25 +02:00
|
|
|
void onFilterChanged(MyGUI::Widget* _sender);
|
2012-05-17 21:15:48 +02:00
|
|
|
void onOfferButtonClicked(MyGUI::Widget* _sender);
|
|
|
|
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
2013-03-04 12:21:38 +01:00
|
|
|
void onMaxSaleButtonClicked(MyGUI::Widget* _sender);
|
2013-02-10 08:50:36 +04: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 20:28:00 +02:00
|
|
|
void onBalanceValueChanged(int value);
|
2014-09-11 00:25:09 +02:00
|
|
|
void onRepeatClick(MyGUI::Widget* widget, MyGUI::ControllerItem* controller);
|
|
|
|
|
|
|
|
void addRepeatController(MyGUI::Widget* widget);
|
2013-02-10 08:50:36 +04:00
|
|
|
|
|
|
|
void onIncreaseButtonTriggered();
|
|
|
|
void onDecreaseButtonTriggered();
|
2012-05-17 21:56:16 +02:00
|
|
|
|
2014-01-08 23:37:46 +01:00
|
|
|
void addOrRemoveGold(int gold, const MWWorld::Ptr& actor);
|
|
|
|
|
2012-05-17 21:56:16 +02:00
|
|
|
void updateLabels();
|
2012-05-27 01:14:33 +02:00
|
|
|
|
|
|
|
virtual void onReferenceUnavailable();
|
2013-03-04 12:21:38 +01:00
|
|
|
|
|
|
|
int getMerchantGold();
|
2014-12-20 20:17:14 +01:00
|
|
|
|
|
|
|
void restock();
|
2012-05-17 13:36:25 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|