From e91282a6213a9809a06cb0cb3deff93e0246fe5b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 8 Sep 2012 02:57:44 +0300 Subject: Allow set tab colors from outside of tab. --- src/gui/widgets/tab.cpp | 20 +++++--------------- src/gui/widgets/tab.h | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 0999dc7a9..124579fab 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -67,11 +67,11 @@ Tab::Tab() : mTabColor(&Theme::getThemeColor(Theme::TAB)), mTabHighlightedColor(&Theme::getThemeColor(Theme::TAB_HIGHLIGHTED)), mTabSelectedColor(&Theme::getThemeColor(Theme::TAB_SELECTED)), + mFlashColor(&Theme::getThemeColor(Theme::TAB_FLASH)), + mPlayerFlashColor(&Theme::getThemeColor(Theme::TAB_PLAYER_FLASH)), mVertexes(new GraphicsVertexes()), mRedraw(true), - mMode(0), - mFlashColor(Theme::getThemeColor(Theme::TAB_FLASH)), - mPlayerFlashColor(Theme::getThemeColor(Theme::TAB_PLAYER_FLASH)) + mMode(0) { init(); } @@ -161,10 +161,10 @@ void Tab::draw(gcn::Graphics *graphics) switch (mFlash) { case 1: - mLabel->setForegroundColor(mFlashColor); + mLabel->setForegroundColor(*mFlashColor); break; case 2: - mLabel->setForegroundColor(mPlayerFlashColor); + mLabel->setForegroundColor(*mPlayerFlashColor); break; default: break; @@ -192,16 +192,6 @@ void Tab::draw(gcn::Graphics *graphics) drawChildren(graphics); } -void Tab::setTabColor(const gcn::Color *const color) -{ - mTabColor = color; -} - -void Tab::setFlash(const int flash) -{ - mFlash = flash; -} - void Tab::widgetResized(const gcn::Event &event A_UNUSED) { mRedraw = true; diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index d0fa41eb6..a8ff5eb3d 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -52,14 +52,40 @@ class Tab : public gcn::Tab, public gcn::WidgetListener void draw(gcn::Graphics *graphics); /** - * Set the normal color fo the tab's text. + * Set the normal color for the tab's text. */ - void setTabColor(const gcn::Color *const color); + void setTabColor(const gcn::Color *const color) + { mTabColor = color; } + + /** + * Set the highlighted color for the tab's text. + */ + void setHighlightedTabColor(const gcn::Color *const color) + { mTabHighlightedColor = color; } + + /** + * Set the selected color for the tab's text. + */ + void setSelectedTabColor(const gcn::Color *const color) + { mTabSelectedColor = color; } + + /** + * Set the flash color for the tab's text. + */ + void setFlashTabColor(const gcn::Color *const color) + { mFlashColor = color; } + + /** + * Set the player flash color for the tab's text. + */ + void setPlayerFlashTabColor(const gcn::Color *const color) + { mPlayerFlashColor = color; } /** * Set tab flashing state */ - void setFlash(const int flash); + void setFlash(const int flash) + { mFlash = flash; } int getFlash() const { return mFlash; } @@ -89,12 +115,12 @@ class Tab : public gcn::Tab, public gcn::WidgetListener const gcn::Color *mTabColor; const gcn::Color *mTabHighlightedColor; const gcn::Color *mTabSelectedColor; + const gcn::Color *mFlashColor; + const gcn::Color *mPlayerFlashColor; int mFlash; GraphicsVertexes *mVertexes; bool mRedraw; int mMode; - gcn::Color mFlashColor; - gcn::Color mPlayerFlashColor; }; #endif -- cgit v1.2.3-60-g2f50