From 55924e43101deef978c6f73ed5a4da63fcb58705 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 6 May 2013 00:55:29 +0300 Subject: Add outline colors for button class. --- src/gui/theme.cpp | 4 ++++ src/gui/theme.h | 4 ++++ src/gui/widgets/button.cpp | 24 ++++++++++++++++++++---- src/gui/widgets/button.h | 4 ++++ 4 files changed, 32 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 58d7e8245..e4f78efd2 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -781,9 +781,13 @@ static int readColorType(const std::string &type) "BORDER", "PROGRESS_BAR", "BUTTON", + "BUTTON_OUTLINE", "BUTTON_DISABLED", + "BUTTON_DISABLED_OUTLINE", "BUTTON_HIGHLIGHTED", + "BUTTON_HIGHLIGHTED_OUTLINE", "BUTTON_PRESSED", + "BUTTON_PRESSED_OUTLINE", "CHECKBOX", "DROPDOWN", "LABEL", diff --git a/src/gui/theme.h b/src/gui/theme.h index ca4204a36..579c34b8a 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -221,9 +221,13 @@ class Theme final : public Palette, public ConfigListener BORDER, PROGRESS_BAR, BUTTON, + BUTTON_OUTLINE, BUTTON_DISABLED, + BUTTON_DISABLED_OUTLINE, BUTTON_HIGHLIGHTED, + BUTTON_HIGHLIGHTED_OUTLINE, BUTTON_PRESSED, + BUTTON_PRESSED_OUTLINE, CHECKBOX, DROPDOWN, LABEL, diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 1ae22aabe..0df94143e 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -71,9 +71,13 @@ Button::Button(const Widget2 *const widget) : mXOffset(0), mYOffset(0), mEnabledColor(getThemeColor(Theme::BUTTON)), + mEnabledColor2(getThemeColor(Theme::BUTTON_OUTLINE)), mDisabledColor(getThemeColor(Theme::BUTTON_DISABLED)), + mDisabledColor2(getThemeColor(Theme::BUTTON_DISABLED_OUTLINE)), mHighlightedColor(getThemeColor(Theme::BUTTON_HIGHLIGHTED)), + mHighlightedColor2(getThemeColor(Theme::BUTTON_HIGHLIGHTED_OUTLINE)), mPressedColor(getThemeColor(Theme::BUTTON_PRESSED)), + mPressedColor2(getThemeColor(Theme::BUTTON_PRESSED_OUTLINE)), mImages(nullptr), mImageSet(nullptr), mImageWidth(0), @@ -100,9 +104,13 @@ Button::Button(const Widget2 *const widget, mXOffset(0), mYOffset(0), mEnabledColor(getThemeColor(Theme::BUTTON)), + mEnabledColor2(getThemeColor(Theme::BUTTON_OUTLINE)), mDisabledColor(getThemeColor(Theme::BUTTON_DISABLED)), + mDisabledColor2(getThemeColor(Theme::BUTTON_DISABLED_OUTLINE)), mHighlightedColor(getThemeColor(Theme::BUTTON_HIGHLIGHTED)), + mHighlightedColor2(getThemeColor(Theme::BUTTON_HIGHLIGHTED_OUTLINE)), mPressedColor(getThemeColor(Theme::BUTTON_PRESSED)), + mPressedColor2(getThemeColor(Theme::BUTTON_PRESSED_OUTLINE)), mImages(nullptr), mImageSet(nullptr), mImageWidth(0), @@ -135,9 +143,13 @@ Button::Button(const Widget2 *const widget, mXOffset(0), mYOffset(0), mEnabledColor(getThemeColor(Theme::BUTTON)), + mEnabledColor2(getThemeColor(Theme::BUTTON_OUTLINE)), mDisabledColor(getThemeColor(Theme::BUTTON_DISABLED)), + mDisabledColor2(getThemeColor(Theme::BUTTON_DISABLED_OUTLINE)), mHighlightedColor(getThemeColor(Theme::BUTTON_HIGHLIGHTED)), + mHighlightedColor2(getThemeColor(Theme::BUTTON_HIGHLIGHTED_OUTLINE)), mPressedColor(getThemeColor(Theme::BUTTON_PRESSED)), + mPressedColor2(getThemeColor(Theme::BUTTON_PRESSED_OUTLINE)), mImages(nullptr), mImageSet(nullptr), mImageWidth(imageWidth), @@ -170,9 +182,13 @@ Button::Button(const Widget2 *const widget, const std::string &imageName, mXOffset(0), mYOffset(0), mEnabledColor(getThemeColor(Theme::BUTTON)), + mEnabledColor2(getThemeColor(Theme::BUTTON_OUTLINE)), mDisabledColor(getThemeColor(Theme::BUTTON_DISABLED)), + mDisabledColor2(getThemeColor(Theme::BUTTON_DISABLED_OUTLINE)), mHighlightedColor(getThemeColor(Theme::BUTTON_HIGHLIGHTED)), + mHighlightedColor2(getThemeColor(Theme::BUTTON_HIGHLIGHTED_OUTLINE)), mPressedColor(getThemeColor(Theme::BUTTON_PRESSED)), + mPressedColor2(getThemeColor(Theme::BUTTON_PRESSED_OUTLINE)), mImages(nullptr), mImageSet(nullptr), mImageWidth(imageWidth), @@ -347,16 +363,16 @@ void Button::draw(gcn::Graphics *graphics) switch (mode) { case BUTTON_DISABLED: - graphics->setColor(mDisabledColor); + g2->setColorAll(mDisabledColor, mDisabledColor2); break; case BUTTON_PRESSED: - graphics->setColor(mPressedColor); + g2->setColorAll(mPressedColor, mPressedColor2); break; case BUTTON_HIGHLIGHTED: - graphics->setColor(mHighlightedColor); + g2->setColorAll(mHighlightedColor, mHighlightedColor2); break; default: - graphics->setColor(mEnabledColor); + g2->setColorAll(mEnabledColor, mEnabledColor2); break; } diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 90faa7d06..2fa2d64ac 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -153,9 +153,13 @@ class Button final : public gcn::Button, int mXOffset; int mYOffset; gcn::Color mEnabledColor; + gcn::Color mEnabledColor2; gcn::Color mDisabledColor; + gcn::Color mDisabledColor2; gcn::Color mHighlightedColor; + gcn::Color mHighlightedColor2; gcn::Color mPressedColor; + gcn::Color mPressedColor2; Image **mImages; ImageSet *mImageSet; int mImageWidth; -- cgit v1.2.3-70-g09d2