diff options
author | Stefan Dombrowski <stefan@uni-bonn.de> | 2010-08-18 23:32:46 +0200 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-08-18 15:43:25 -0600 |
commit | 362a539125dff292614618d5ebf61e0c71dfae9f (patch) | |
tree | cdaac3a04b2b5a8d2bef520c6817f3404fcbda6a /src/gui/itempopup.cpp | |
parent | 4b30182fc569f99925d6c73b9235fa728afa4ce8 (diff) | |
download | mana-362a539125dff292614618d5ebf61e0c71dfae9f.tar.gz mana-362a539125dff292614618d5ebf61e0c71dfae9f.tar.bz2 mana-362a539125dff292614618d5ebf61e0c71dfae9f.tar.xz mana-362a539125dff292614618d5ebf61e0c71dfae9f.zip |
Fixing overlapping icons in item popups
The bug could not be reproduced by everyone. Many thanks to
Jaxad0127 for testing it on an affected system.
This patch resolves http://bugs.manasource.org/view.php?id=191
Signed-off-by: Jared Adams <jaxad0127@gmail.com>
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r-- | src/gui/itempopup.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 0cde9395..b71ca529 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -50,22 +50,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(), 2 * fontHeight + 2 * getPadding()); // Item Weight mItemWeight = new TextBox; mItemWeight->setEditable(false); - mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding()); mIcon = new Icon(0); @@ -147,28 +142,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) |