summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-26 14:04:24 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-26 14:04:24 +0300
commit209a5bb20f9ae861f078622804a81cfee2af2945 (patch)
treeb204495badeaa1c31bdfcde2091e289d5be12b78 /src/gui
parent1a9330a5f6cd753b4155ac74db104cb0ffa095c9 (diff)
downloadmv-209a5bb20f9ae861f078622804a81cfee2af2945.tar.gz
mv-209a5bb20f9ae861f078622804a81cfee2af2945.tar.bz2
mv-209a5bb20f9ae861f078622804a81cfee2af2945.tar.xz
mv-209a5bb20f9ae861f078622804a81cfee2af2945.zip
Show tooltips in inventory buttons.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/inventorywindow.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index d99717c9b..e85207ec5 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -212,6 +212,15 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) :
mWeightBar->setColor(getThemeColor(Theme::WEIGHT_BAR),
getThemeColor(Theme::WEIGHT_BAR_OUTLINE));
+ // TRANSLATORS: outfits button tooltip
+ mOutfitButton->setDescription(_("Outfits"));
+ // TRANSLATORS: cart button tooltip
+ mCartButton->setDescription(_("Cart"));
+ // TRANSLATORS: shop button tooltip
+ mShopButton->setDescription(_("Shop"));
+ // TRANSLATORS: equipment button tooltip
+ mEquipmentButton->setDescription(_("Equipment"));
+
place(0, 0, mWeightBar, 4);
mSlotsBarCell = &place(4, 0, mSlotsBar, 4);
mSortDropDownCell = &place(8, 0, mSortDropDown, 3);
@@ -628,18 +637,29 @@ void InventoryWindow::mouseMoved(MouseEvent &event)
return;
const Widget *const src = event.getSource();
+ if (!src)
+ {
+ textPopup->hide();
+ return;
+ }
+ const int x = event.getX();
+ const int y = event.getY();
+ const Rect &rect = mDimension;
if (src == mSlotsBar || src == mWeightBar)
{
- const int x = event.getX();
- const int y = event.getY();
- const Rect &rect = mDimension;
textPopup->show(rect.x + x, rect.y + y, strprintf(_("Money: %s"),
Units::formatCurrency(PlayerInfo::getAttribute(
Attributes::MONEY)).c_str()));
}
else
{
- textPopup->hide();
+ const Button *const btn = dynamic_cast<const Button *const>(src);
+ if (!btn)
+ {
+ textPopup->hide();
+ return;
+ }
+ textPopup->show(x + rect.x, y + rect.y, btn->getDescription());
}
}