summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-26 00:30:06 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-26 00:30:06 +0300
commitc90660f93d2f2b367a55726bd6f8943b82b73efb (patch)
tree0c7066492c102a98b7bdc9d23a8e37111f13a53e /src/gui/inventorywindow.cpp
parent5544b7e2e0b8fcdb9f0ac3762751f34a3383ef84 (diff)
downloadplus-c90660f93d2f2b367a55726bd6f8943b82b73efb.tar.gz
plus-c90660f93d2f2b367a55726bd6f8943b82b73efb.tar.bz2
plus-c90660f93d2f2b367a55726bd6f8943b82b73efb.tar.xz
plus-c90660f93d2f2b367a55726bd6f8943b82b73efb.zip
Show money popup in inventory window if mouse over weight or count bars.
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 11c15a012..fd1916a58 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -34,6 +34,7 @@
#include "gui/outfitwindow.h"
#include "gui/setup.h"
#include "gui/shopwindow.h"
+#include "gui/textpopup.h"
#include "gui/tradewindow.h"
#include "gui/viewport.h"
@@ -123,6 +124,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
mNameFilterCell(nullptr),
mFilterCell(nullptr),
mSlotsBarCell(nullptr),
+ mTextPopup(new TextPopup),
mSplit(false),
mCompactMode(false)
{
@@ -273,6 +275,8 @@ InventoryWindow::~InventoryWindow()
invInstances.front()->updateDropButton();
delete mSortModel;
mSortModel = nullptr;
+ delete mTextPopup;
+ mTextPopup = nullptr;
}
void InventoryWindow::action(const gcn::ActionEvent &event)
@@ -549,6 +553,30 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
}
}
+void InventoryWindow::mouseMoved(gcn::MouseEvent &event)
+{
+ Window::mouseMoved(event);
+ gcn::Widget *const src = event.getSource();
+ if (src == mSlotsBar || src == mWeightBar)
+ {
+ const int x = event.getX();
+ const int y = event.getY();
+ const gcn::Rectangle &rect = mDimension;
+ mTextPopup->show(rect.x + x, rect.y + y, strprintf(_("Money: %s"),
+ Units::formatCurrency(PlayerInfo::getAttribute(
+ PlayerInfo::MONEY)).c_str()));
+ }
+ else
+ {
+ mTextPopup->hide();
+ }
+}
+
+void InventoryWindow::mouseExited(gcn::MouseEvent &event)
+{
+ mTextPopup->hide();
+}
+
void InventoryWindow::keyPressed(gcn::KeyEvent &event)
{
if (static_cast<KeyEvent*>(&event)->getActionId()