From f799d0cc056be8850733be931c976d59e6dbe582 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 27 Dec 2012 20:49:56 +0300 Subject: Add outlining support for labels. --- src/gui/widgets/browserbox.cpp | 4 ++-- src/gui/widgets/browserbox.h | 1 - src/gui/widgets/label.cpp | 14 ++++++++++++++ src/gui/widgets/label.h | 5 +++++ src/gui/widgets/widget2.h | 6 ++++++ 5 files changed, 27 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index a27a46ac4..1551ae81d 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -67,8 +67,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, mNewLinePadding(15), mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), - mHyperLinkColor(getThemeColor(Theme::HYPERLINK)), - mForegroundColor2(getThemeColor(Theme::BROWSERBOX_OUTLINE)) + mHyperLinkColor(getThemeColor(Theme::HYPERLINK)) { setFocusable(true); addMouseListener(this); @@ -107,6 +106,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, mColors[1][BROWN] = getThemeColor(Theme::BROWN_OUTLINE); mForegroundColor = getThemeColor(Theme::BROWSERBOX); + mForegroundColor2 = getThemeColor(Theme::BROWSERBOX_OUTLINE); } BrowserBox::~BrowserBox() diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 9e1899d0c..2f0313c37 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -249,7 +249,6 @@ class BrowserBox final : public gcn::Widget, gcn::Color mHighlightColor; gcn::Color mHyperLinkColor; gcn::Color mColors[2][COLORS_MAX]; - gcn::Color mForegroundColor2; static Skin *mSkin; static int mInstances; diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 04bb38662..2be9a476b 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -92,6 +92,7 @@ void Label::draw(gcn::Graphics* graphics) } graphics->setColor(mForegroundColor); + static_cast(graphics)->setColor2(mForegroundColor2); font->drawString(graphics, mCaption, textX, textY); BLOCK_END("Label::draw") } @@ -101,3 +102,16 @@ void Label::adjustSize() setWidth(getFont()->getWidth(getCaption()) + 2 * mPadding); setHeight(getFont()->getHeight() + 2 * mPadding); } + +void Label::setForegroundColor(const gcn::Color &color) +{ + mForegroundColor = color; + mForegroundColor2 = color; +} + +void Label::setForegroundColorAll(const gcn::Color &color1, + const gcn::Color &color2) +{ + mForegroundColor = color1; + mForegroundColor2 = color2; +} diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index 4ea7ca3e3..084fe2f40 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -63,6 +63,11 @@ class Label final : public gcn::Label, public Widget2 void adjustSize(); + void setForegroundColor(const gcn::Color &color); + + void setForegroundColorAll(const gcn::Color &color1, + const gcn::Color &color2); + static Skin *mSkin; static int mInstances; diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index f2eb9bbb1..a02194e4c 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -80,8 +80,14 @@ class Widget2 } } + void setForegroundColor2(const gcn::Color &color) + { + mForegroundColor2 = color; + } + protected: int mPaletteOffset; + gcn::Color mForegroundColor2; }; extern int openGLMode; -- cgit v1.2.3-70-g09d2