summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index ea33fda3..9b2df34d 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -51,22 +51,17 @@ ItemPopup::ItemPopup():
mItemName->setFont(boldFont);
mItemName->setPosition(getPadding(), getPadding());
- const int fontHeight = getFont()->getHeight();
-
// Item Description
mItemDesc = new TextBox;
mItemDesc->setEditable(false);
- mItemDesc->setPosition(getPadding(), fontHeight);
// Item Effect
mItemEffect = new TextBox;
mItemEffect->setEditable(false);
- mItemEffect->setPosition(getPadding(), (fontHeight << 1) + (getPadding() << 1));
// Item Weight
mItemWeight = new TextBox;
mItemWeight->setEditable(false);
- mItemWeight->setPosition(getPadding(), fontHeight * 3 + (getPadding() << 2));
mIcon = new Icon(0);
@@ -158,28 +153,34 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage)
const int numRowsDesc = mItemDesc->getNumberOfRows();
const int numRowsEffect = mItemEffect->getNumberOfRows();
const int numRowsWeight = mItemWeight->getNumberOfRows();
- const int height = getFont()->getHeight();
+ const int fontHeight = getFont()->getHeight();
+
+ int nameHeight;
+ if (mIcon->getHeight() > 2 * fontHeight)
+ nameHeight = mIcon->getHeight();
+ else
+ nameHeight = 2 * fontHeight;
if (item.getEffect().empty())
{
- setContentSize(minWidth, (numRowsDesc + numRowsWeight + getPadding()) *
- height);
+ setContentSize(minWidth, nameHeight +
+ (numRowsDesc + numRowsWeight + 1) * fontHeight);
- mItemWeight->setPosition(getPadding(), (numRowsDesc + getPadding()) *
- height);
+ mItemWeight->setPosition(getPadding(),
+ nameHeight + (numRowsDesc + 1) * fontHeight);
}
else
{
- setContentSize(minWidth, (numRowsDesc + numRowsEffect + numRowsWeight +
- getPadding()) * height);
+ setContentSize(minWidth, nameHeight + (numRowsDesc + numRowsEffect +
+ numRowsWeight + 1) * fontHeight);
- mItemWeight->setPosition(getPadding(), (numRowsDesc + numRowsEffect +
- getPadding()) * height);
+ mItemWeight->setPosition(getPadding(), nameHeight + (numRowsDesc +
+ numRowsEffect + 1) * fontHeight);
}
- mItemDesc->setPosition(getPadding(), 2 * height);
- mItemEffect->setPosition(getPadding(), (numRowsDesc + getPadding()) * height);
-
+ mItemDesc->setPosition(getPadding(), nameHeight);
+ mItemEffect->setPosition(getPadding(), nameHeight +
+ (numRowsDesc + 1) * fontHeight);
}
gcn::Color ItemPopup::getColor(ItemType type)