summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-04-20 20:32:12 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-20 20:32:55 +0200
commitb926bec4ff23e43729e88ea36c3cba9509b66f7c (patch)
treea68850498d170640f57e2d0f74716b6a61f700c9 /src/gui/itempopup.cpp
parenta1dbbdf1ca8560de8cff703d21c0063610261196 (diff)
downloadmana-b926bec4ff23e43729e88ea36c3cba9509b66f7c.tar.gz
mana-b926bec4ff23e43729e88ea36c3cba9509b66f7c.tar.bz2
mana-b926bec4ff23e43729e88ea36c3cba9509b66f7c.tar.xz
mana-b926bec4ff23e43729e88ea36c3cba9509b66f7c.zip
Reduced the weight of a few gui windows and popups which wrapped their
TextBoxes in ScrollAreas, but never needed to scroll (and disabled both the horizontal and vertical scrollbars, which makes using a scrollarea kind of pointless to begin with). Signed-off-by: Ira Rice <irarice@gmail.com> Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp63
1 files changed, 18 insertions, 45 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index a4229324..1aa61f5b 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -25,7 +25,6 @@
#include "gui/gui.h"
#include "gui/palette.h"
-#include "gui/widgets/scrollarea.h"
#include "gui/widgets/textbox.h"
#include "graphics.h"
@@ -43,48 +42,29 @@ ItemPopup::ItemPopup():
// Item Name
mItemName = new gcn::Label;
mItemName->setFont(boldFont);
- mItemName->setPosition(2, 2);
+ mItemName->setPosition(getPadding(), getPadding());
+
+ const int fontHeight = getFont()->getHeight();
// Item Description
mItemDesc = new TextBox;
mItemDesc->setEditable(false);
- mItemDescScroll = new ScrollArea(mItemDesc);
-
- const int fontHeight = getFont()->getHeight();
-
- mItemDescScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemDescScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemDescScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight));
- mItemDescScroll->setOpaque(false);
- mItemDescScroll->setPosition(2, fontHeight);
+ mItemDesc->setPosition(getPadding(), fontHeight);
// Item Effect
mItemEffect = new TextBox;
mItemEffect->setEditable(false);
- mItemEffectScroll = new ScrollArea(mItemEffect);
-
- mItemEffectScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemEffectScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemEffectScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight));
- mItemEffectScroll->setOpaque(false);
- mItemEffectScroll->setPosition(2, (2 * fontHeight) +
- (2 * getPadding()));
+ mItemEffect->setPosition(getPadding(), 2 * fontHeight + 2 * getPadding());
// Item Weight
mItemWeight = new TextBox;
mItemWeight->setEditable(false);
- mItemWeightScroll = new ScrollArea(mItemWeight);
-
- mItemWeightScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemWeightScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemWeightScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight));
- mItemWeightScroll->setOpaque(false);
- mItemWeightScroll->setPosition(2, 3 * fontHeight + 4 * getPadding());
+ mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding());
add(mItemName);
- add(mItemDescScroll);
- add(mItemEffectScroll);
- add(mItemWeightScroll);
+ add(mItemDesc);
+ add(mItemEffect);
+ add(mItemWeight);
loadPopupConfiguration();
}
@@ -123,34 +103,27 @@ void ItemPopup::setItem(const ItemInfo &item)
const int numRowsDesc = mItemDesc->getNumberOfRows();
const int numRowsEffect = mItemEffect->getNumberOfRows();
- const int numRowsWeight = mItemWeight->getNumberOfRows();
+ //const int numRowsWeight = mItemWeight->getNumberOfRows();
const int height = getFont()->getHeight();
- mItemDescScroll->setDimension(gcn::Rectangle(2, 0, minWidth,
- numRowsDesc * height));
-
- mItemEffectScroll->setDimension(gcn::Rectangle(2, 0, minWidth,
- numRowsEffect * height));
-
- mItemWeightScroll->setDimension(gcn::Rectangle(2, 0, minWidth,
- numRowsWeight * height));
-
if (item.getEffect().empty())
{
setContentSize(minWidth, (numRowsDesc + 3) * height);
- mItemWeightScroll->setPosition(2, (numRowsDesc + 2) * height);
+ mItemWeight->setPosition(getPadding(), (numRowsDesc + getPadding()) *
+ height);
}
else
{
- setContentSize(minWidth, (numRowsDesc + numRowsEffect + 3) * height);
+ setContentSize(minWidth, (numRowsDesc + numRowsEffect + getPadding()) *
+ height);
- mItemWeightScroll->setPosition(2, (numRowsDesc + numRowsEffect + 2) *
- height);
+ mItemWeight->setPosition(getPadding(), (numRowsDesc + numRowsEffect +
+ getPadding()) * height);
}
- mItemDescScroll->setPosition(2, 20);
- mItemEffectScroll->setPosition(2, (numRowsDesc + 2) * height);
+ mItemDesc->setPosition(getPadding(), 2 * height);
+ mItemEffect->setPosition(getPadding(), (numRowsDesc + getPadding()) * height);
}
gcn::Color ItemPopup::getColor(ItemType type)