diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-09 23:58:34 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-09 23:58:34 +0200 |
commit | 9b680f95087290315c24a04535f1626acd8ec9a7 (patch) | |
tree | fbfd4e40e8eeaf0c077266a95e701e01688279e2 /src/gui/itempopup.cpp | |
parent | 4893acb9cdbd83349f88668ca932f7fddd3e8288 (diff) | |
download | mana-9b680f95087290315c24a04535f1626acd8ec9a7.tar.gz mana-9b680f95087290315c24a04535f1626acd8ec9a7.tar.bz2 mana-9b680f95087290315c24a04535f1626acd8ec9a7.tar.xz mana-9b680f95087290315c24a04535f1626acd8ec9a7.zip |
Actually use ItemType instead of short
Plus some random cleanups.
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r-- | src/gui/itempopup.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 6226acab..278b06e2 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -31,8 +31,6 @@ #include "graphics.h" #include "units.h" -#include "resources/iteminfo.h" - #include "utils/gettext.h" #include "utils/stringutils.h" @@ -52,11 +50,13 @@ ItemPopup::ItemPopup(): 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, getFont()->getHeight())); + mItemDescScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight)); mItemDescScroll->setOpaque(false); - mItemDescScroll->setPosition(2, getFont()->getHeight()); + mItemDescScroll->setPosition(2, fontHeight); // Item Effect mItemEffect = new TextBox; @@ -65,10 +65,10 @@ ItemPopup::ItemPopup(): mItemEffectScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mItemEffectScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mItemEffectScroll->setDimension(gcn::Rectangle(0, 0, 196, getFont()->getHeight())); + mItemEffectScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight)); mItemEffectScroll->setOpaque(false); - mItemEffectScroll->setPosition(2, (2 * getFont()->getHeight()) + - (2 * getPadding())); + mItemEffectScroll->setPosition(2, (2 * fontHeight) + + (2 * getPadding())); // Item Weight mItemWeight = new TextBox; @@ -77,10 +77,9 @@ ItemPopup::ItemPopup(): mItemWeightScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mItemWeightScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mItemWeightScroll->setDimension(gcn::Rectangle(0, 0, 196, getFont()->getHeight())); + mItemWeightScroll->setDimension(gcn::Rectangle(0, 0, 196, fontHeight)); mItemWeightScroll->setOpaque(false); - mItemWeightScroll->setPosition(2, (3 * getFont()->getHeight()) + - (4 * getPadding())); + mItemWeightScroll->setPosition(2, 3 * fontHeight + 4 * getPadding()); add(mItemName); add(mItemDescScroll); @@ -131,14 +130,14 @@ void ItemPopup::setItem(const ItemInfo &item) const int numRowsWeight = mItemWeight->getNumberOfRows(); const int height = getFont()->getHeight(); - mItemDescScroll->setDimension(gcn::Rectangle(2, 0, minWidth, numRowsDesc * - height)); + mItemDescScroll->setDimension(gcn::Rectangle(2, 0, minWidth, + numRowsDesc * height)); - mItemEffectScroll->setDimension(gcn::Rectangle(2, 0, minWidth, numRowsEffect - * height)); + mItemEffectScroll->setDimension(gcn::Rectangle(2, 0, minWidth, + numRowsEffect * height)); - mItemWeightScroll->setDimension(gcn::Rectangle(2, 0, minWidth, numRowsWeight - * height)); + mItemWeightScroll->setDimension(gcn::Rectangle(2, 0, minWidth, + numRowsWeight * height)); if (item.getEffect().empty()) { @@ -164,7 +163,7 @@ void ItemPopup::updateColors() graphics->setColor(guiPalette->getColor(Palette::TEXT)); } -gcn::Color ItemPopup::getColor(short type) +gcn::Color ItemPopup::getColor(ItemType type) { switch (type) { @@ -204,7 +203,7 @@ std::string ItemPopup::getItemName() const return mItemName->getCaption(); } -unsigned int ItemPopup::getNumRows() +unsigned int ItemPopup::getNumRows() const { return mItemDesc->getNumberOfRows() + mItemEffect->getNumberOfRows() + mItemWeight->getNumberOfRows(); |