summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-17 14:34:57 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-17 14:34:57 +0300
commit3f815d7ae9767416b6205e521cc3f06bc4299fcf (patch)
tree005e0fe233e3fb7ed29782c322c9818caef39c7a
parent5613e19f91676fddbdedb371a6fe07786268bb92 (diff)
downloadmv-3f815d7ae9767416b6205e521cc3f06bc4299fcf.tar.gz
mv-3f815d7ae9767416b6205e521cc3f06bc4299fcf.tar.bz2
mv-3f815d7ae9767416b6205e521cc3f06bc4299fcf.tar.xz
mv-3f815d7ae9767416b6205e521cc3f06bc4299fcf.zip
Use public text popup in inventory window.
-rw-r--r--src/gui/windows/inventorywindow.cpp12
-rw-r--r--src/gui/windows/inventorywindow.h1
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;