diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-08-25 23:42:21 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-08-25 23:42:21 +0200 |
commit | 19f6ce87e69b42fb69a4739ce363e1346cd569ea (patch) | |
tree | 48a04a477ede925fd946ac62d36ccc92cf3df4e1 /src/gui/itempopup.cpp | |
parent | 88e7a96bffe9758bb4f0916f6841b98f2cfccbfb (diff) | |
parent | 011135415f7f9c5cfeb220540621dfd1c46e6db9 (diff) | |
download | mana-client-19f6ce87e69b42fb69a4739ce363e1346cd569ea.tar.gz mana-client-19f6ce87e69b42fb69a4739ce363e1346cd569ea.tar.bz2 mana-client-19f6ce87e69b42fb69a4739ce363e1346cd569ea.tar.xz mana-client-19f6ce87e69b42fb69a4739ce363e1346cd569ea.zip |
Merge branch 'equipment-fix' of github.com:Bertram25/mana
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r-- | src/gui/itempopup.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 60943756..d65764a5 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -123,6 +123,34 @@ ItemPopup::~ItemPopup() } } +void ItemPopup::setEquipmentText(const std::string& text) +{ + mItemEquipSlot = text; +} + +void ItemPopup::setNoItem() +{ + mIcon->setImage(0); + + std::string caption = _("No item"); + if (!mItemEquipSlot.empty()) + { + caption += " ("; + caption += mItemEquipSlot; + caption += ")"; + } + mItemName->setCaption(caption); + mItemName->adjustSize(); + + mItemName->setForegroundColor(Theme::getThemeColor(Theme::GENERIC)); + mItemName->setPosition(getPadding(), getPadding()); + + mItemDesc->setText(std::string()); + mItemEffect->setText(std::string()); + + setContentSize(mItemName->getWidth() + 2 * getPadding(), 0); +} + void ItemPopup::setItem(const ItemInfo &item, bool showImage) { if (item.getName() == mItemName->getCaption()) @@ -157,7 +185,11 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage) mItemType = item.getItemType(); - mItemName->setCaption(item.getName()); + std::string caption = item.getName(); + if (!mItemEquipSlot.empty()) + caption += " (" + mItemEquipSlot + ")"; + + mItemName->setCaption(caption); mItemName->adjustSize(); mItemName->setForegroundColor(getColorFromItemType(mItemType)); mItemName->setPosition(getPadding() + space, getPadding()); @@ -226,5 +258,6 @@ void ItemPopup::mouseMoved(gcn::MouseEvent &event) // When the mouse moved on top of the popup, hide it setVisible(false); + mItemEquipSlot.clear(); } |