From 3f815d7ae9767416b6205e521cc3f06bc4299fcf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Aug 2014 14:34:57 +0300 Subject: Use public text popup in inventory window. --- src/gui/windows/inventorywindow.cpp | 12 ++++++------ src/gui/windows/inventorywindow.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index d148d4d7d..53e847af0 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -103,11 +103,9 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mNameFilterCell(nullptr), mFilterCell(nullptr), mSlotsBarCell(nullptr), - mTextPopup(new TextPopup), mSplit(false), mCompactMode(false) { - mTextPopup->postInit(); mSlotsBar->setColor(getThemeColor(Theme::SLOTS_BAR), getThemeColor(Theme::SLOTS_BAR_OUTLINE)); @@ -284,7 +282,6 @@ InventoryWindow::~InventoryWindow() mSortDropDown->hideDrop(false); delete2(mSortModel); - mTextPopup = nullptr; } void InventoryWindow::storeSortOrder() const @@ -565,25 +562,28 @@ void InventoryWindow::mouseClicked(MouseEvent &event) void InventoryWindow::mouseMoved(MouseEvent &event) { Window::mouseMoved(event); + if (!textPopup) + return; + const Widget *const src = event.getSource(); if (src == mSlotsBar || src == mWeightBar) { const int x = event.getX(); const int y = event.getY(); const Rect &rect = mDimension; - mTextPopup->show(rect.x + x, rect.y + y, strprintf(_("Money: %s"), + textPopup->show(rect.x + x, rect.y + y, strprintf(_("Money: %s"), Units::formatCurrency(PlayerInfo::getAttribute( Attributes::MONEY)).c_str())); } else { - mTextPopup->hide(); + textPopup->hide(); } } void InventoryWindow::mouseExited(MouseEvent &event A_UNUSED) { - mTextPopup->hide(); + textPopup->hide(); } void InventoryWindow::keyPressed(KeyEvent &event) diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 84cbcd4bb..509b74390 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -189,7 +189,6 @@ class InventoryWindow final : public Window, LayoutCell *mNameFilterCell; LayoutCell *mFilterCell; LayoutCell *mSlotsBarCell; - TextPopup *mTextPopup; bool mSplit; bool mCompactMode; -- cgit v1.2.3-70-g09d2