diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-15 19:37:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-15 19:37:39 +0300 |
commit | 413637151f0eb471ff6b28feddc028c374f96401 (patch) | |
tree | 82658c6d0e159bd34f23a8aaaa38ef11242346a4 /src/gui | |
parent | c08b18e37eee7edce70dcc1aaba2afd2b968d330 (diff) | |
download | manaplus-413637151f0eb471ff6b28feddc028c374f96401.tar.gz manaplus-413637151f0eb471ff6b28feddc028c374f96401.tar.bz2 manaplus-413637151f0eb471ff6b28feddc028c374f96401.tar.xz manaplus-413637151f0eb471ff6b28feddc028c374f96401.zip |
Add type into ShopListBox.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/selldialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.h | 15 | ||||
-rw-r--r-- | src/gui/windows/buydialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 4 |
5 files changed, 25 insertions, 8 deletions
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp index c0b7fdd24..dbeab87ca 100644 --- a/src/gui/widgets/selldialog.cpp +++ b/src/gui/widgets/selldialog.cpp @@ -96,7 +96,8 @@ void SellDialog::postInit() mShopItemList = CREATEWIDGETR(ShopListBox, this, mShopItems, - mShopItems); + mShopItems, + ShopListBoxType::Unknown); mShopItemList->setProtectItems(true); mScrollArea = new ScrollArea(this, mShopItemList, getOptionBool("showbackground"), "sell_background.xml"); diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 5d083a30f..3ce06ba0d 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -46,12 +46,14 @@ const int ITEM_ICON_SIZE = 32; ShopListBox::ShopListBox(const Widget2 *const widget, - ListModel *const listModel) : + ListModel *const listModel, + const ShopListBoxTypeT type) : ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), mShopItems(nullptr), mBackgroundColor(getThemeColor(ThemeColorId::BACKGROUND)), mWarningColor(getThemeColor(ThemeColorId::SHOP_WARNING)), + mType(type), mPriceCheck(true), mProtectItems(false) { @@ -62,12 +64,14 @@ ShopListBox::ShopListBox(const Widget2 *const widget, ShopListBox::ShopListBox(const Widget2 *const widget, ListModel *const listModel, - ShopItems *const shopListModel) : + ShopItems *const shopListModel, + const ShopListBoxTypeT type) : ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), mShopItems(shopListModel), mBackgroundColor(getThemeColor(ThemeColorId::BACKGROUND)), mWarningColor(getThemeColor(ThemeColorId::SHOP_WARNING)), + mType(type), mPriceCheck(true), mProtectItems(false) { diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index cc4504c82..471f6eadc 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -25,6 +25,8 @@ #include "gui/widgets/listbox.h" +#include "enums/gui/shoplistboxtype.h" + class ShopItems; /** @@ -41,14 +43,16 @@ class ShopListBox final : public ListBox * Constructor. */ ShopListBox(const Widget2 *const widget, - ListModel *const listModel); + ListModel *const listModel, + const ShopListBoxTypeT type); /** * Constructor with shopitems */ ShopListBox(const Widget2 *const widget, ListModel *const listModel, - ShopItems *const shopListModel); + ShopItems *const shopListModel, + const ShopListBoxTypeT type); A_DELETE_COPY(ShopListBox) @@ -84,6 +88,12 @@ class ShopListBox final : public ListBox void setProtectItems(bool p) { mProtectItems = p; } + void setType(const ShopListBoxTypeT type) + { mType = type; } + + ShopListBoxType getType() const + { return mType; } + private: int mPlayerMoney; @@ -95,6 +105,7 @@ class ShopListBox final : public ListBox Color mBackgroundColor; Color mWarningColor; + ShopListBoxTypeT mType; bool mPriceCheck; bool mProtectItems; diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 7ae527e63..f2e5cc46d 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -274,7 +274,8 @@ void BuyDialog::init() mShopItems = new ShopItems; - CREATEWIDGETV(mShopItemList, ShopListBox, this, mShopItems, mShopItems); + CREATEWIDGETV(mShopItemList, ShopListBox, this, + mShopItems, mShopItems, ShopListBoxType::Unknown); mScrollArea = new ScrollArea(this, mShopItemList, getOptionBool("showbackground"), "buy_background.xml"); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index e98d9ce1a..a2793640c 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -108,9 +108,9 @@ ShopWindow::ShopWindow() : mSellShopItems(new ShopItems), mTradeItem(nullptr), mBuyShopItemList(CREATEWIDGETR(ShopListBox, - this, mBuyShopItems, mBuyShopItems)), + this, mBuyShopItems, mBuyShopItems, ShopListBoxType::BuyShop)), mSellShopItemList(CREATEWIDGETR(ShopListBox, - this, mSellShopItems, mSellShopItems)), + this, mSellShopItems, mSellShopItems, ShopListBoxType::SellShop)), mCurrentShopItemList(nullptr), mScrollArea(new ScrollArea(this, mBuyShopItemList, getOptionBool("showbuybackground"), "shop_buy_background.xml")), |