summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-11 16:27:16 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-11 16:27:16 +0300
commitccdaf8cc6f61c322a2308123b03bb91f9ca68ee9 (patch)
treea4fbc02d8259aa19eed4fc8f95c1ea249085bda4
parent9d335ffd1651b5fb7bf71ca49fabba80c9099739 (diff)
downloadmanaverse-ccdaf8cc6f61c322a2308123b03bb91f9ca68ee9.tar.gz
manaverse-ccdaf8cc6f61c322a2308123b03bb91f9ca68ee9.tar.bz2
manaverse-ccdaf8cc6f61c322a2308123b03bb91f9ca68ee9.tar.xz
manaverse-ccdaf8cc6f61c322a2308123b03bb91f9ca68ee9.zip
Add new colors for button theming.
New colors: BUTTON_PRESSED and BUTTON_HIGHLIGHTED.
-rw-r--r--data/graphics/gui/colors.xml2
-rw-r--r--data/themes/blacknblack/colors.xml2
-rw-r--r--data/themes/blackwood/colors.xml2
-rw-r--r--data/themes/enchilado/colors.xml2
-rw-r--r--data/themes/mana/colors.xml2
-rw-r--r--data/themes/pink/colors.xml2
-rw-r--r--data/themes/unity/colors.xml2
-rw-r--r--data/themes/wood/colors.xml2
-rw-r--r--src/gui/theme.cpp2
-rw-r--r--src/gui/theme.h2
-rw-r--r--src/gui/widgets/button.cpp21
-rw-r--r--src/gui/widgets/button.h2
12 files changed, 39 insertions, 4 deletions
diff --git a/data/graphics/gui/colors.xml b/data/graphics/gui/colors.xml
index 8652713f3..49a5ee367 100644
--- a/data/graphics/gui/colors.xml
+++ b/data/graphics/gui/colors.xml
@@ -6,6 +6,8 @@
<color id="BORDER" color="#000000" />
<color id="PROGRESS_BAR" color="#ffffff" />
<color id="BUTTON" color="#000000" />
+ <color id="BUTTON_HIGHLIGHTED" color="#000000" />
+ <color id="BUTTON_PRESSED" color="#000000" />
<color id="BUTTON_DISABLED" color="#333333" />
<color id="CHECKBOX" color="#000000" />
<color id="DROPDOWN" color="#000000" />
diff --git a/data/themes/blacknblack/colors.xml b/data/themes/blacknblack/colors.xml
index 68776cf47..c1f4cbac7 100644
--- a/data/themes/blacknblack/colors.xml
+++ b/data/themes/blacknblack/colors.xml
@@ -6,6 +6,8 @@
<color id="BORDER" color="#00c000" />
<color id="PROGRESS_BAR" color="#ffffff" />
<color id="BUTTON" color="#ffffff" />
+ <color id="BUTTON_HIGHLIGHTED" color="#ffffff" />
+ <color id="BUTTON_PRESSED" color="#ffffff" />
<color id="BUTTON_DISABLED" color="#777777" />
<color id="CHECKBOX" color="#ffffff" />
<color id="DROPDOWN" color="#ffffff" />
diff --git a/data/themes/blackwood/colors.xml b/data/themes/blackwood/colors.xml
index 03ba51864..cbe809512 100644
--- a/data/themes/blackwood/colors.xml
+++ b/data/themes/blackwood/colors.xml
@@ -6,6 +6,8 @@
<color id="BORDER" color="#000000" />
<color id="PROGRESS_BAR" color="#ffffff" />
<color id="BUTTON" color="#000000" />
+ <color id="BUTTON_HIGHLIGHTED" color="#000000" />
+ <color id="BUTTON_PRESSED" color="#000000" />
<color id="BUTTON_DISABLED" color="#333333" />
<color id="CHECKBOX" color="#000000" />
<color id="DROPDOWN" color="#000000" />
diff --git a/data/themes/enchilado/colors.xml b/data/themes/enchilado/colors.xml
index a98ea738c..77fe13740 100644
--- a/data/themes/enchilado/colors.xml
+++ b/data/themes/enchilado/colors.xml
@@ -6,6 +6,8 @@
<color id="BORDER" color="#000000" />
<color id="PROGRESS_BAR" color="#ffffff" />
<color id="BUTTON" color="#000000" />
+ <color id="BUTTON_HIGHLIGHTED" color="#000000" />
+ <color id="BUTTON_PRESSED" color="#000000" />
<color id="BUTTON_DISABLED" color="#333333" />
<color id="CHECKBOX" color="#000000" />
<color id="DROPDOWN" color="#000000" />
diff --git a/data/themes/mana/colors.xml b/data/themes/mana/colors.xml
index 3e99304f5..749718d9e 100644
--- a/data/themes/mana/colors.xml
+++ b/data/themes/mana/colors.xml
@@ -6,6 +6,8 @@
<color id="BORDER" color="#000000" />
<color id="PROGRESS_BAR" color="#ffffff" />
<color id="BUTTON" color="#000000" />
+ <color id="BUTTON_HIGHLIGHTED" color="#000000" />
+ <color id="BUTTON_PRESSED" color="#000000" />
<color id="BUTTON_DISABLED" color="#333333" />
<color id="CHECKBOX" color="#000000" />
<color id="DROPDOWN" color="#000000" />
diff --git a/data/themes/pink/colors.xml b/data/themes/pink/colors.xml
index 55772c7a5..05a1f9dab 100644
--- a/data/themes/pink/colors.xml
+++ b/data/themes/pink/colors.xml
@@ -6,6 +6,8 @@
<color id="BORDER" color="#000000" />
<color id="PROGRESS_BAR" color="#ffffff" />
<color id="BUTTON" color="#FF00FF" />
+ <color id="BUTTON_HIGHLIGHTED" color="#FF00FF" />
+ <color id="BUTTON_PRESSED" color="#FF00FF" />
<color id="BUTTON_DISABLED" color="#FF00FF" />
<color id="CHECKBOX" color="#FF00FF" />
<color id="DROPDOWN" color="#FF00FF" />
diff --git a/data/themes/unity/colors.xml b/data/themes/unity/colors.xml
index 62035e813..4c944e25a 100644
--- a/data/themes/unity/colors.xml
+++ b/data/themes/unity/colors.xml
@@ -5,6 +5,8 @@
<color id="OUTLINE" color="#000000" />
<color id="PROGRESS_BAR" color="#ffffff" />
<color id="BUTTON" color="#FE9750" />
+ <color id="BUTTON_HIGHLIGHTED" color="#FE9750" />
+ <color id="BUTTON_PRESSED" color="#FE9750" />
<color id="BUTTON_DISABLED" color="#FC6400" />
<color id="CHECKBOX" color="#E0E0E0" />
<color id="DROPDOWN" color="#E0E0E0" />
diff --git a/data/themes/wood/colors.xml b/data/themes/wood/colors.xml
index ea337c0b8..ddf935d57 100644
--- a/data/themes/wood/colors.xml
+++ b/data/themes/wood/colors.xml
@@ -6,6 +6,8 @@
<color id="BORDER" color="#000000" />
<color id="PROGRESS_BAR" color="#ffffff" />
<color id="BUTTON" color="#000000" />
+ <color id="BUTTON_HIGHLIGHTED" color="#000000" />
+ <color id="BUTTON_PRESSED" color="#000000" />
<color id="BUTTON_DISABLED" color="#cccccc" />
<color id="CHECKBOX" color="#000000" />
<color id="DROPDOWN" color="#000000" />
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 578717b57..99dac7887 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -679,6 +679,8 @@ static int readColorType(const std::string &type)
"PROGRESS_BAR",
"BUTTON",
"BUTTON_DISABLED",
+ "BUTTON_HIGHLIGHTED",
+ "BUTTON_PRESSED",
"CHECKBOX",
"DROPDOWN",
"LABEL",
diff --git a/src/gui/theme.h b/src/gui/theme.h
index cfa9ab49d..04c355e0f 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -171,6 +171,8 @@ class Theme : public Palette, public ConfigListener
PROGRESS_BAR,
BUTTON,
BUTTON_DISABLED,
+ BUTTON_HIGHLIGHTED,
+ BUTTON_PRESSED,
CHECKBOX,
DROPDOWN,
LABEL,
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 614ec7313..c8f756f6a 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -193,6 +193,8 @@ void Button::init()
}
mEnabledColor = Theme::getThemeColor(Theme::BUTTON);
mDisabledColor = Theme::getThemeColor(Theme::BUTTON_DISABLED);
+ mHighlightedColor = Theme::getThemeColor(Theme::BUTTON_HIGHLIGHTED);
+ mPressedColor = Theme::getThemeColor(Theme::BUTTON_PRESSED);
mInstances++;
}
@@ -323,10 +325,21 @@ void Button::draw(gcn::Graphics *graphics)
// g2->drawImageRect(0, 0, getWidth(), getHeight(), button[mode]);
- if (mode == BUTTON_DISABLED)
- graphics->setColor(mDisabledColor);
- else
- graphics->setColor(mEnabledColor);
+ switch (mode)
+ {
+ case BUTTON_DISABLED:
+ graphics->setColor(mDisabledColor);
+ break;
+ case BUTTON_PRESSED:
+ graphics->setColor(mPressedColor);
+ break;
+ case BUTTON_HIGHLIGHTED:
+ graphics->setColor(mHighlightedColor);
+ break;
+ default:
+ graphics->setColor(mEnabledColor);
+ break;
+ }
int textX = 0;
const int textY = getHeight() / 2 - getFont()->getHeight() / 2;
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index e3ff82f0f..f57e9a7cd 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -143,6 +143,8 @@ class Button : public gcn::Button, public gcn::WidgetListener
int mYOffset;
gcn::Color mEnabledColor;
gcn::Color mDisabledColor;
+ gcn::Color mHighlightedColor;
+ gcn::Color mPressedColor;
Image **mImages;
ImageSet *mImageSet;
int mImageWidth;