1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 18:49:54 +00:00
openmw-tes3mp/apps/openmw/mwgui/tradewindow.hpp

110 lines
3.3 KiB
C++
Raw Normal View History

#ifndef MWGUI_TRADEWINDOW_H
#define MWGUI_TRADEWINDOW_H
#include "../mwmechanics/trading.hpp"
#include "referenceinterface.hpp"
#include "windowbase.hpp"
2012-05-17 15:15:44 +00:00
2014-09-25 18:28:00 +00:00
namespace Gui
{
2014-09-25 18:28:00 +00:00
class NumericEditBox;
}
2015-01-10 01:50:43 +00:00
namespace MyGUI
{
2015-01-10 01:50:43 +00:00
class ControllerItem;
}
namespace MWGui
{
2013-05-11 16:38:27 +00:00
class ItemView;
class SortFilterItemModel;
class TradeItemModel;
class TradeWindow : public WindowBase, public ReferenceInterface
{
public:
TradeWindow();
2013-05-11 16:38:27 +00:00
void startTrade(const MWWorld::Ptr& actor);
2013-05-11 16:38:27 +00:00
void borrowItem (int index, size_t count);
void returnItem (int index, size_t count);
int getMerchantServices();
virtual void exit();
virtual void resetReference();
2013-05-11 16:38:27 +00:00
private:
ItemView* mItemView;
SortFilterItemModel* mSortModel;
TradeItemModel* mTradeModel;
MWMechanics::Trading mTrading;
2013-05-11 16:38:27 +00:00
static const float sBalanceChangeInitialPause; // in seconds
static const float sBalanceChangeInterval; // in seconds
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;
int mCurrentBalance;
int mCurrentMerchantOffer;
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
void updateOffer();
2013-05-11 16:38:27 +00:00
void onItemSelected (int index);
void sellItem (MyGUI::Widget* sender, int count);
void onFilterChanged(MyGUI::Widget* _sender);
2012-05-17 19:15:48 +00:00
void onOfferButtonClicked(MyGUI::Widget* _sender);
void onCancelButtonClicked(MyGUI::Widget* _sender);
void onMaxSaleButtonClicked(MyGUI::Widget* _sender);
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);
void onRepeatClick(MyGUI::Widget* widget, MyGUI::ControllerItem* controller);
void addRepeatController(MyGUI::Widget* widget);
void onIncreaseButtonTriggered();
void onDecreaseButtonTriggered();
void addOrRemoveGold(int gold, const MWWorld::Ptr& actor);
void updateLabels();
virtual void onReferenceUnavailable();
int getMerchantGold();
void restock();
};
}
#endif