summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
authorBjørn <bjorn@horst-dieter.(none)>2009-04-12 18:04:33 +0200
committerBjørn <bjorn@horst-dieter.(none)>2009-04-12 19:06:37 +0200
commita6998fbdfaf84aa1920564d97e3421ed28c9a893 (patch)
tree592fb9e78946a4f539e7c1dd3210b50f68e4f961 /src/gui/itempopup.cpp
parentacbafa84774d4addeb4da0206762d64febf26d3e (diff)
downloadMana-a6998fbdfaf84aa1920564d97e3421ed28c9a893.tar.gz
Mana-a6998fbdfaf84aa1920564d97e3421ed28c9a893.tar.bz2
Mana-a6998fbdfaf84aa1920564d97e3421ed28c9a893.tar.xz
Mana-a6998fbdfaf84aa1920564d97e3421ed28c9a893.zip
Cleaned up the ItemPopup class a bit
Removed methods updateColors, getItemName and getNumRows. The last one was also removed from some other classes.
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 6c994aca..a4229324 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -98,13 +98,16 @@ void ItemPopup::setItem(const ItemInfo &item)
if (item.getName() == mItemName->getCaption())
return;
+ mItemType = item.getType();
+
mItemName->setCaption(item.getName());
- mItemName->setWidth(boldFont->getWidth(item.getName()));
+ mItemName->adjustSize();
+ mItemName->setForegroundColor(getColor(mItemType));
+
mItemDesc->setTextWrapped(item.getDescription(), 196);
mItemEffect->setTextWrapped(item.getEffect(), 196);
mItemWeight->setTextWrapped(_("Weight: ") +
Units::formatWeight(item.getWeight()), 196);
- mItemType = item.getType();
int minWidth = mItemName->getWidth();
@@ -150,12 +153,6 @@ void ItemPopup::setItem(const ItemInfo &item)
mItemEffectScroll->setPosition(2, (numRowsDesc + 2) * height);
}
-void ItemPopup::updateColors()
-{
- mItemName->setForegroundColor(getColor(mItemType));
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
-}
-
gcn::Color ItemPopup::getColor(ItemType type)
{
switch (type)
@@ -191,17 +188,6 @@ gcn::Color ItemPopup::getColor(ItemType type)
}
}
-std::string ItemPopup::getItemName() const
-{
- return mItemName->getCaption();
-}
-
-unsigned int ItemPopup::getNumRows() const
-{
- return mItemDesc->getNumberOfRows() + mItemEffect->getNumberOfRows() +
- mItemWeight->getNumberOfRows();
-}
-
void ItemPopup::view(int x, int y)
{
const int distance = 20;