summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index b3002290..c76c3750 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -41,8 +41,10 @@
ItemPopup::ItemPopup():
Popup()
{
+ mItemType = "";
+
// Item Name
- mItemName = new gcn::Label("Label");
+ mItemName = new gcn::Label("");
mItemName->setFont(boldFont);
mItemName->setPosition(2, 2);
@@ -104,12 +106,12 @@ void ItemPopup::setItem(const ItemInfo &item)
return;
mItemName->setCaption(item.getName());
- mItemName->setForegroundColor(getColor(item.getType()));
mItemName->setWidth(boldFont->getWidth(item.getName()));
mItemDesc->setTextWrapped(item.getDescription(), 196);
mItemEffect->setTextWrapped(item.getEffect(), 196);
mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) +
_(" grams"), 196);
+ mItemType = item.getType();
int minWidth = mItemName->getWidth();
@@ -162,6 +164,12 @@ void ItemPopup::setItem(const ItemInfo &item)
(2 * getFont()->getHeight()));
}
+void ItemPopup::updateColors()
+{
+ mItemName->setForegroundColor(getColor(mItemType));
+ graphics->setColor(guiPalette->getColor(Palette::TEXT));
+}
+
gcn::Color ItemPopup::getColor(const std::string& type)
{
gcn::Color color;
@@ -196,6 +204,11 @@ gcn::Color ItemPopup::getColor(const std::string& type)
return color;
}
+std::string ItemPopup::getItemName()
+{
+ return mItemName->getCaption();
+}
+
unsigned int ItemPopup::getNumRows()
{
return mItemDesc->getNumberOfRows() + mItemEffect->getNumberOfRows() +