From 6d9dbf93e6c0247cb9b19d3f52a1837a5833b22d Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Thu, 26 Aug 2010 16:55:05 +0200 Subject: Merged testing branch into master. --- src/gui/itempopup.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/gui/itempopup.cpp') diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index c926670a..ea33fda3 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -61,12 +61,12 @@ ItemPopup::ItemPopup(): // Item Effect mItemEffect = new TextBox; mItemEffect->setEditable(false); - mItemEffect->setPosition(getPadding(), 2 * fontHeight + 2 * getPadding()); + mItemEffect->setPosition(getPadding(), (fontHeight << 1) + (getPadding() << 1)); // Item Weight mItemWeight = new TextBox; mItemWeight->setEditable(false); - mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding()); + mItemWeight->setPosition(getPadding(), fontHeight * 3 + (getPadding() << 2)); mIcon = new Icon(0); @@ -121,18 +121,27 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage) mIcon->setImage(0); } - mItemType = item.getType(); + //mItemType = item.getType(); mItemName->setCaption(item.getName()); mItemName->adjustSize(); - mItemName->setForegroundColor(getColor(mItemType)); + mItemName->setForegroundColor(Theme::UNKNOWN_ITEM); // TODO mItemName->setPosition(getPadding() + space, getPadding()); - mItemDesc->setTextWrapped(item.getDescription(), 196); - mItemEffect->setTextWrapped(item.getEffect(), 196); +#define ITEMPOPUP_WRAP_WIDTH 196 + + mItemDesc->setTextWrapped(item.getDescription(), ITEMPOPUP_WRAP_WIDTH); + { + const std::vector &effect = item.getEffect(); + std::string temp = ""; + for (std::vector::const_iterator it = effect.begin(), + it_end = effect.end(); it != it_end; ++it) + temp += temp.empty() ? *it : "\n" + *it; + mItemEffect->setTextWrapped(temp, ITEMPOPUP_WRAP_WIDTH); + } mItemWeight->setTextWrapped(strprintf(_("Weight: %s"), Units::formatWeight(item.getWeight()).c_str()), - 196); + ITEMPOPUP_WRAP_WIDTH); int minWidth = mItemName->getWidth() + space; -- cgit v1.2.3-70-g09d2