diff options
Diffstat (limited to 'src/gui/widgets/tabs/tab.cpp')
-rw-r--r-- | src/gui/widgets/tabs/tab.cpp | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 2f300fb5f..e361c78ff 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -120,6 +120,7 @@ Tab::Tab(const Widget2 *const widget) : mVertexes(new ImageCollection), mImage(nullptr), mMode(0), + mLabelMode(-1), mHasMouse(false) { init(); @@ -211,37 +212,55 @@ void Tab::draw(Graphics *graphics) // check which type of tab to draw if (mTabbedArea) { + int labelMode = mFlash; + if (mTabbedArea->isTabSelected(this)) { - mLabel->setForegroundColorAll(*mTabSelectedColor, - *mTabSelectedOutlineColor); + labelMode = 3; mode = TAB_SELECTED; // if tab is selected, it doesnt need to highlight activity mFlash = 0; } - else if (mHasMouse) + else if (!labelMode) { - mLabel->setForegroundColorAll(*mTabHighlightedColor, - *mTabHighlightedOutlineColor); - mode = TAB_HIGHLIGHTED; + if (mHasMouse) + { + labelMode = 4; + mode = TAB_HIGHLIGHTED; + } } - else + else if (mHasMouse) { - mLabel->setForegroundColorAll(*mTabColor, *mTabOutlineColor); + mode = TAB_HIGHLIGHTED; } - switch (mFlash) + if (labelMode != mLabelMode) { - case 1: - mLabel->setForegroundColorAll(*mFlashColor, - *mFlashOutlineColor); - break; - case 2: - mLabel->setForegroundColorAll(*mPlayerFlashColor, - *mPlayerFlashOutlineColor); - break; - default: - break; + mLabelMode = labelMode; + switch (labelMode) + { + case 0: // default state + default: + mLabel->setForegroundColorAll(*mTabColor, + *mTabOutlineColor); + break; + case 1: // mFlash == 1 + mLabel->setForegroundColorAll(*mFlashColor, + *mFlashOutlineColor); + break; + case 2: // mFlash == 2 + mLabel->setForegroundColorAll(*mPlayerFlashColor, + *mPlayerFlashOutlineColor); + break; + case 3: //mTabbedArea->isTabSelected(this) + mLabel->setForegroundColorAll(*mTabSelectedColor, + *mTabSelectedOutlineColor); + break; + case 4: // mHasMouse + mLabel->setForegroundColorAll(*mTabHighlightedColor, + *mTabHighlightedOutlineColor); + break; + } } } |