From 61392840d52a3976b886f7638ff5babcb5509c49 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 30 Mar 2009 17:04:39 -0600 Subject: Allow tabs to be colored and color whisper tabs --- src/gui/widgets/tab.cpp | 14 +++++++++++--- src/gui/widgets/tab.h | 6 ++++++ src/gui/widgets/whispertab.cpp | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index f7161ed9..3c95eb26 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -62,7 +62,8 @@ static TabData const data[TAB_COUNT] = { ImageRect Tab::tabImg[TAB_COUNT]; -Tab::Tab() : gcn::Tab() +Tab::Tab() : gcn::Tab(), + mTabColor(guiPalette->getColor(Palette::TEXT)) { init(); } @@ -126,7 +127,7 @@ void Tab::draw(gcn::Graphics *graphics) { mode = TAB_SELECTED; // if tab is selected, it doesnt need to highlight activity - mLabel->setForegroundColor(guiPalette->getColor(Palette::TEXT)); + mLabel->setForegroundColor(mTabColor); mHighlighted = false; } else if (mHighlighted) @@ -136,7 +137,7 @@ void Tab::draw(gcn::Graphics *graphics) } else { - mLabel->setForegroundColor(guiPalette->getColor(Palette::TEXT)); + mLabel->setForegroundColor(mTabColor); } } @@ -158,6 +159,13 @@ void Tab::draw(gcn::Graphics *graphics) drawChildren(graphics); } +void Tab::setTabColor(gcn::Color color) +{ + if (color == NULL) + color = guiPalette->getColor(Palette::TEXT); + mTabColor = color; +} + void Tab::setHighlighted(bool high) { mHighlighted = high; diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index 3af4e2bf..64e76d4c 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -47,6 +47,11 @@ class Tab : public gcn::Tab */ void draw(gcn::Graphics *graphics); + /** + * Set the normal color fo the tab's text. + */ + void setTabColor(gcn::Color color); + /** * Set tab highlighted */ @@ -60,6 +65,7 @@ class Tab : public gcn::Tab static int mInstances; /**< Number of tab instances */ static float mAlpha; + gcn::Color mTabColor; bool mHighlighted; }; diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 9e6d9336..75131bda 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -39,7 +39,7 @@ WhisperTab::WhisperTab(const std::string &nick) : ChatTab(nick), mNick(nick) { - setForegroundColor(guiPalette->getColor(Palette::WHISPER)); + setTabColor(guiPalette->getColor(Palette::WHISPER)); } WhisperTab::~WhisperTab() -- cgit v1.2.3-60-g2f50