summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/itempopup.cpp63
-rw-r--r--src/gui/itempopup.h2
-rw-r--r--src/gui/theme.cpp15
-rw-r--r--src/gui/theme.h15
4 files changed, 61 insertions, 34 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 0c88939e3..97330b511 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -178,7 +178,7 @@ void ItemPopup::setItem(const ItemInfo &item, const unsigned char color,
}
mItemName->adjustSize();
- mItemName->setForegroundColor(getColor(mItemType));
+ setLabelColor(mItemName, mItemType);
mItemName->setPosition(space, 0);
mItemEffect->setTextWrapped(item.getEffect(), 196);
@@ -219,44 +219,41 @@ void ItemPopup::setItem(const ItemInfo &item, const unsigned char color,
mItemDesc->setPosition(0, 2 * height);
}
-gcn::Color ItemPopup::getColor(const ItemType type) const
+#define caseSetColor(name1, name2) \
+ case name1: \
+ { \
+ return label->setForegroundColorAll(getThemeColor(name2), \
+ getThemeColor(name2##_OUTLINE)); \
+ }
+void ItemPopup::setLabelColor(Label *label, const ItemType type) const
{
switch (type)
{
- case ITEM_UNUSABLE:
- return getThemeColor(Theme::GENERIC);
- case ITEM_USABLE:
- return getThemeColor(Theme::USABLE);
- case ITEM_EQUIPMENT_ONE_HAND_WEAPON:
- return getThemeColor(Theme::ONEHAND);
- case ITEM_EQUIPMENT_TWO_HANDS_WEAPON:
- return getThemeColor(Theme::TWOHAND);
- case ITEM_EQUIPMENT_TORSO:
- return getThemeColor(Theme::TORSO);
- case ITEM_EQUIPMENT_ARMS:
- return getThemeColor(Theme::ARMS);
- case ITEM_EQUIPMENT_HEAD:
- return getThemeColor(Theme::HEAD);
- case ITEM_EQUIPMENT_LEGS:
- return getThemeColor(Theme::LEGS);
- case ITEM_EQUIPMENT_SHIELD:
- return getThemeColor(Theme::SHIELD);
- case ITEM_EQUIPMENT_RING:
- return getThemeColor(Theme::RING);
- case ITEM_EQUIPMENT_NECKLACE:
- return getThemeColor(Theme::NECKLACE);
- case ITEM_EQUIPMENT_FEET:
- return getThemeColor(Theme::FEET);
- case ITEM_EQUIPMENT_AMMO:
- return getThemeColor(Theme::AMMO);
- case ITEM_EQUIPMENT_CHARM:
- return getThemeColor(Theme::CHARM);
- case ITEM_SPRITE_RACE:
- case ITEM_SPRITE_HAIR:
+ caseSetColor(ITEM_UNUSABLE, Theme::GENERIC)
+ caseSetColor(ITEM_USABLE, Theme::USABLE)
+ caseSetColor(ITEM_EQUIPMENT_ONE_HAND_WEAPON, Theme::ONEHAND)
+ caseSetColor(ITEM_EQUIPMENT_TWO_HANDS_WEAPON, Theme::TWOHAND)
+ caseSetColor(ITEM_EQUIPMENT_TORSO, Theme::TORSO)
+ caseSetColor(ITEM_EQUIPMENT_ARMS, Theme::ARMS)
+ caseSetColor(ITEM_EQUIPMENT_HEAD, Theme::HEAD)
+ caseSetColor(ITEM_EQUIPMENT_LEGS, Theme::LEGS)
+ caseSetColor(ITEM_EQUIPMENT_SHIELD, Theme::SHIELD)
+ caseSetColor(ITEM_EQUIPMENT_RING, Theme::RING)
+ caseSetColor(ITEM_EQUIPMENT_NECKLACE, Theme::NECKLACE)
+ caseSetColor(ITEM_EQUIPMENT_FEET, Theme::FEET)
+ caseSetColor(ITEM_EQUIPMENT_AMMO, Theme::AMMO)
+ caseSetColor(ITEM_EQUIPMENT_CHARM, Theme::CHARM)
+ caseSetColor(ITEM_SPRITE_RACE, Theme::UNKNOWN_ITEM)
+ caseSetColor(ITEM_SPRITE_HAIR, Theme::UNKNOWN_ITEM)
default:
- return getThemeColor(Theme::UNKNOWN_ITEM);
+ {
+ return label->setForegroundColorAll(getThemeColor(
+ Theme::UNKNOWN_ITEM), getThemeColor(
+ Theme::UNKNOWN_ITEM_OUTLINE));
+ }
}
}
+#undef caseSetColor
void ItemPopup::mouseMoved(gcn::MouseEvent &event)
{
diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h
index cf46e0661..8bd574006 100644
--- a/src/gui/itempopup.h
+++ b/src/gui/itempopup.h
@@ -75,7 +75,7 @@ class ItemPopup final : public Popup
std::string mLastName;
unsigned char mLastColor;
- gcn::Color getColor(const ItemType type) const;
+ void setLabelColor(Label *label, const ItemType type) const;
};
#endif // ITEMPOPUP_H
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 6c64af727..fad36d62a 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -885,24 +885,39 @@ static int readColorType(const std::string &type)
"HYPERLINK",
"HYPERLINK_OUTLINE",
"UNKNOWN_ITEM",
+ "UNKNOWN_ITEM_OUTLINE",
"GENERIC",
+ "GENERIC_OUTLINE",
"HEAD",
+ "HEAD_OUTLINE",
"USABLE",
+ "USABLE_OUTLINE",
"TORSO",
+ "TORSO_OUTLINE",
"ONEHAND",
+ "ONEHAND_OUTLINE",
"LEGS",
+ "LEGS_OUTLINE",
"FEET",
+ "FEET_OUTLINE",
"TWOHAND",
+ "TWOHAND_OUTLINE",
"SHIELD",
+ "SHIELD_OUTLINE",
"RING",
+ "RING_OUTLINE",
"NECKLACE",
+ "NECKLACE_OUTLINE",
"ARMS",
+ "ARMS_OUTLINE",
"AMMO",
+ "AMMO_OUTLINE",
"SERVER_VERSION_NOT_SUPPORTED",
"SERVER_VERSION_NOT_SUPPORTED_OUTLINE",
"WARNING",
"WARNING_OUTLINE",
"CHARM",
+ "CHARM_OUTLINE",
"PLAYER_ADVANCED",
"BUBBLE_NAME",
"BUBBLE_TEXT",
diff --git a/src/gui/theme.h b/src/gui/theme.h
index 1f49fe4ec..812689048 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -325,24 +325,39 @@ class Theme final : public Palette, public ConfigListener
HYPERLINK,
HYPERLINK_OUTLINE,
UNKNOWN_ITEM,
+ UNKNOWN_ITEM_OUTLINE,
GENERIC,
+ GENERIC_OUTLINE,
HEAD,
+ HEAD_OUTLINE,
USABLE,
+ USABLE_OUTLINE,
TORSO,
+ TORSO_OUTLINE,
ONEHAND,
+ ONEHAND_OUTLINE,
LEGS,
+ LEGS_OUTLINE,
FEET,
+ FEET_OUTLINE,
TWOHAND,
+ TWOHAND_OUTLINE,
SHIELD,
+ SHIELD_OUTLINE,
RING,
+ RING_OUTLINE,
NECKLACE,
+ NECKLACE_OUTLINE,
ARMS,
+ ARMS_OUTLINE,
AMMO,
+ AMMO_OUTLINE,
SERVER_VERSION_NOT_SUPPORTED,
SERVER_VERSION_NOT_SUPPORTED_OUTLINE,
WARNING,
WARNING_OUTLINE,
CHARM,
+ CHARM_OUTLINE,
PLAYER_ADVANCED,
BUBBLE_NAME,
BUBBLE_TEXT,