summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-14 09:33:48 -0600
committerIra Rice <irarice@gmail.com>2009-03-14 09:33:48 -0600
commit698e166377fa4e7e4e4a971af33458c68bd70809 (patch)
tree445020bd2cfd7812a6583f3080de0ca6a05d4117 /src/gui/itempopup.cpp
parenta1b399ad3956b03ce26416abd906f22e3c3d2d82 (diff)
downloadmana-698e166377fa4e7e4e4a971af33458c68bd70809.tar.gz
mana-698e166377fa4e7e4e4a971af33458c68bd70809.tar.bz2
mana-698e166377fa4e7e4e4a971af33458c68bd70809.tar.xz
mana-698e166377fa4e7e4e4a971af33458c68bd70809.zip
Commented up item popups, speech bubbles, as well as only update item
info on item change. Also fixed color updating for item shortcuts and item links, as the displayed colors wouldn't update on change on color change in the setup color dialog. Signed-off-by: Ira Rice <irarice@gmail.com>
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() +