OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tradewindow.hpp
Go to the documentation of this file.
1 #ifndef MWGUI_TRADEWINDOW_H
2 #define MWGUI_TRADEWINDOW_H
3 
4 #include "../mwmechanics/trading.hpp"
5 
6 #include "referenceinterface.hpp"
7 #include "windowbase.hpp"
8 
9 namespace Gui
10 {
11  class NumericEditBox;
12 }
13 
14 namespace MyGUI
15 {
16  class ControllerItem;
17 }
18 
19 namespace MWGui
20 {
21  class ItemView;
22  class SortFilterItemModel;
23  class TradeItemModel;
24 
25  class TradeWindow : public WindowBase, public ReferenceInterface
26  {
27  public:
28  TradeWindow();
29 
30  void startTrade(const MWWorld::Ptr& actor);
31 
32  void borrowItem (int index, size_t count);
33  void returnItem (int index, size_t count);
34 
35  int getMerchantServices();
36 
37  virtual void exit();
38 
39  virtual void resetReference();
40 
41  private:
46 
47  static const float sBalanceChangeInitialPause; // in seconds
48  static const float sBalanceChangeInterval; // in seconds
49 
50  MyGUI::Button* mFilterAll;
51  MyGUI::Button* mFilterWeapon;
52  MyGUI::Button* mFilterApparel;
53  MyGUI::Button* mFilterMagic;
54  MyGUI::Button* mFilterMisc;
55 
56  MyGUI::Button* mIncreaseButton;
57  MyGUI::Button* mDecreaseButton;
58  MyGUI::TextBox* mTotalBalanceLabel;
60 
61  MyGUI::Widget* mBottomPane;
62 
63  MyGUI::Button* mMaxSaleButton;
64  MyGUI::Button* mCancelButton;
65  MyGUI::Button* mOfferButton;
66  MyGUI::TextBox* mPlayerGold;
67  MyGUI::TextBox* mMerchantGold;
68 
70 
73 
74  void sellToNpc(const MWWorld::Ptr& item, int count, bool boughtItem);
75  void buyFromNpc(const MWWorld::Ptr& item, int count, bool soldItem);
76 
77  void updateOffer();
78 
79  void onItemSelected (int index);
80  void sellItem (MyGUI::Widget* sender, int count);
81 
82  void onFilterChanged(MyGUI::Widget* _sender);
83  void onOfferButtonClicked(MyGUI::Widget* _sender);
84  void onCancelButtonClicked(MyGUI::Widget* _sender);
85  void onMaxSaleButtonClicked(MyGUI::Widget* _sender);
86  void onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
87  void onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
88  void onBalanceButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
89  void onBalanceValueChanged(int value);
90  void onRepeatClick(MyGUI::Widget* widget, MyGUI::ControllerItem* controller);
91 
92  void addRepeatController(MyGUI::Widget* widget);
93 
96 
97  void addOrRemoveGold(int gold, const MWWorld::Ptr& actor);
98 
99  void updateLabels();
100 
101  virtual void onReferenceUnavailable();
102 
103  int getMerchantGold();
104 
105  void restock();
106  };
107 }
108 
109 #endif
Definition: tradewindow.hpp:25
A variant of the EditBox that only allows integer inputs.
Definition: numericeditbox.hpp:12
void addOrRemoveGold(int gold, const MWWorld::Ptr &actor)
Definition: tradewindow.cpp:252
void sellToNpc(const MWWorld::Ptr &item, int count, bool boughtItem)
only used for adjusting the gold balance
Definition: tradewindow.cpp:480
static const float sBalanceChangeInitialPause
Definition: tradewindow.hpp:47
int getMerchantServices()
Definition: tradewindow.cpp:170
Definition: itemview.hpp:11
void onBalanceValueChanged(int value)
Definition: tradewindow.cpp:408
virtual void onReferenceUnavailable()
called when reference has become unavailable
Definition: tradewindow.cpp:490
MyGUI::Button * mFilterWeapon
Definition: tradewindow.hpp:51
An item model that allows 'borrowing' items from another item model. Used for previewing barter offer...
Definition: tradeitemmodel.hpp:13
void onRepeatClick(MyGUI::Widget *widget, MyGUI::ControllerItem *controller)
Definition: tradewindow.cpp:395
MyGUI::TextBox * mPlayerGold
Definition: tradewindow.hpp:66
void returnItem(int index, size_t count)
Definition: tradewindow.cpp:243
int mCurrentMerchantOffer
Definition: tradewindow.hpp:72
void onFilterChanged(MyGUI::Widget *_sender)
Definition: tradewindow.cpp:146
MyGUI::TextBox * mTotalBalanceLabel
Definition: tradewindow.hpp:58
void onDecreaseButtonPressed(MyGUI::Widget *_sender, int _left, int _top, MyGUI::MouseButton _id)
Definition: tradewindow.cpp:389
void buyFromNpc(const MWWorld::Ptr &item, int count, bool soldItem)
only used for adjusting the gold balance
Definition: tradewindow.cpp:485
void onMaxSaleButtonClicked(MyGUI::Widget *_sender)
Definition: tradewindow.cpp:368
ItemView * mItemView
Definition: tradewindow.hpp:42
TradeItemModel * mTradeModel
Definition: tradewindow.hpp:44
void updateLabels()
Definition: tradewindow.cpp:435
SortFilterItemModel * mSortModel
Definition: tradewindow.hpp:43
MyGUI::Button * mCancelButton
Definition: tradewindow.hpp:64
TradeWindow()
Definition: tradewindow.cpp:53
int getMerchantGold()
Definition: tradewindow.cpp:497
virtual void resetReference()
Definition: tradewindow.cpp:503
void onCancelButtonClicked(MyGUI::Widget *_sender)
Definition: tradewindow.cpp:363
void restock()
Definition: tradewindow.cpp:103
MyGUI::Widget * mBottomPane
Definition: tradewindow.hpp:61
void onDecreaseButtonTriggered()
Definition: tradewindow.cpp:428
void updateOffer()
Definition: tradewindow.cpp:456
Definition: sortfilteritemmodel.hpp:9
MyGUI::Button * mFilterMisc
Definition: tradewindow.hpp:54
void sellItem(MyGUI::Widget *sender, int count)
Definition: tradewindow.cpp:208
void onIncreaseButtonTriggered()
Definition: tradewindow.cpp:418
MyGUI::Button * mOfferButton
Definition: tradewindow.hpp:65
Gui::NumericEditBox * mTotalBalance
Definition: tradewindow.hpp:59
MyGUI::TextBox * mMerchantGold
Definition: tradewindow.hpp:67
MyGUI::Button * mFilterAll
Definition: tradewindow.hpp:50
int mItemToSell
Definition: tradewindow.hpp:69
void borrowItem(int index, size_t count)
Definition: tradewindow.cpp:235
Definition: windowbase.hpp:16
MyGUI::Button * mFilterApparel
Definition: tradewindow.hpp:52
MyGUI::Button * mMaxSaleButton
Definition: tradewindow.hpp:63
void onIncreaseButtonPressed(MyGUI::Widget *_sender, int _left, int _top, MyGUI::MouseButton _id)
Definition: tradewindow.cpp:383
MyGUI::Button * mIncreaseButton
Definition: tradewindow.hpp:56
this class is intended for GUI interfaces that access an MW-Reference for example dialogue window acc...
Definition: referenceinterface.hpp:12
int mCurrentBalance
Definition: tradewindow.hpp:71
void addRepeatController(MyGUI::Widget *widget)
Definition: tradewindow.cpp:374
void onBalanceButtonReleased(MyGUI::Widget *_sender, int _left, int _top, MyGUI::MouseButton _id)
Definition: tradewindow.cpp:403
MyGUI::Button * mFilterMagic
Definition: tradewindow.hpp:53
MyGUI::Button * mDecreaseButton
Definition: tradewindow.hpp:57
virtual void exit()
Gracefully exits the window.
Definition: tradewindow.cpp:175
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
void onItemSelected(int index)
Definition: tradewindow.cpp:182
void onOfferButtonClicked(MyGUI::Widget *_sender)
Definition: tradewindow.cpp:266
void startTrade(const MWWorld::Ptr &actor)
Definition: tradewindow.cpp:117
Definition: trading.hpp:8
static const float sBalanceChangeInterval
Definition: tradewindow.hpp:48
MWMechanics::Trading mTrading
Definition: tradewindow.hpp:45