diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-17 15:41:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-17 15:41:43 +0300 |
commit | 0e13c0b844c2a6a4e80965837cbcefd3b02c444f (patch) | |
tree | 36900fc366d7f4f4059b3c8d7a60c289032ac22f /src/gui/widgets | |
parent | 13ffce92ad6ef7831a7d944a03bbe9520ac55453 (diff) | |
download | plus-0e13c0b844c2a6a4e80965837cbcefd3b02c444f.tar.gz plus-0e13c0b844c2a6a4e80965837cbcefd3b02c444f.tar.bz2 plus-0e13c0b844c2a6a4e80965837cbcefd3b02c444f.tar.xz plus-0e13c0b844c2a6a4e80965837cbcefd3b02c444f.zip |
Use public item popup in shoplistbox.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 20 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.h | 2 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 8efc5241f..728e1dc29 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -50,14 +50,12 @@ ShopListBox::ShopListBox(const Widget2 *const widget, ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), mShopItems(nullptr), - mItemPopup(new ItemPopup), mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mWarningColor(getThemeColor(Theme::SHOP_WARNING)), mPriceCheck(true), mProtectItems(false) { mRowHeight = getFont()->getHeight(); - mItemPopup->postInit(); mHighlightColor = getThemeColor(Theme::HIGHLIGHT); mForegroundColor = getThemeColor(Theme::LISTBOX); } @@ -68,14 +66,12 @@ ShopListBox::ShopListBox(const Widget2 *const widget, ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), mShopItems(shopListModel), - mItemPopup(new ItemPopup), mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mWarningColor(getThemeColor(Theme::SHOP_WARNING)), mPriceCheck(true), mProtectItems(false) { mRowHeight = std::max(getFont()->getHeight(), ITEM_ICON_SIZE); - mItemPopup->postInit(); mHighlightColor = getThemeColor(Theme::HIGHLIGHT); mForegroundColor = getThemeColor(Theme::LISTBOX); } @@ -194,12 +190,12 @@ void ShopListBox::setPriceCheck(const bool check) void ShopListBox::mouseMoved(MouseEvent &event) { - if (!mItemPopup || !mRowHeight) + if (!itemPopup || !mRowHeight) return; if (!mShopItems) { - mItemPopup->hide(); + itemPopup->hide(); return; } @@ -207,19 +203,19 @@ void ShopListBox::mouseMoved(MouseEvent &event) if (index < 0 || index >= mShopItems->getNumberOfElements()) { - mItemPopup->hide(); + itemPopup->hide(); } else { const Item *const item = mShopItems->at(index); if (item) { - mItemPopup->setItem(item); - mItemPopup->position(viewport->getMouseX(), viewport->getMouseY()); + itemPopup->setItem(item); + itemPopup->position(viewport->getMouseX(), viewport->getMouseY()); } else { - mItemPopup->setVisible(false); + itemPopup->setVisible(false); } } } @@ -246,8 +242,8 @@ void ShopListBox::mouseReleased(MouseEvent& event) void ShopListBox::mouseExited(MouseEvent& event A_UNUSED) { - if (!mItemPopup) + if (!itemPopup) return; - mItemPopup->hide(); + itemPopup->hide(); } diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index ddb4407c7..808528cc5 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -92,8 +92,6 @@ class ShopListBox final : public ListBox */ ShopItems *mShopItems; - ItemPopup *mItemPopup; - Color mBackgroundColor; Color mWarningColor; |