From a6998fbdfaf84aa1920564d97e3421ed28c9a893 Mon Sep 17 00:00:00 2001 From: Bjørn Date: Sun, 12 Apr 2009 18:04:33 +0200 Subject: Cleaned up the ItemPopup class a bit Removed methods updateColors, getItemName and getNumRows. The last one was also removed from some other classes. --- src/gui/itempopup.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/gui/itempopup.cpp') 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; -- cgit v1.2.3-60-g2f50