summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/tabs')
-rw-r--r--src/gui/widgets/tabs/tab.cpp57
-rw-r--r--src/gui/widgets/tabs/tab.h1
2 files changed, 39 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;
+ }
}
}
diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h
index 06b5a3d18..8b26ee3d4 100644
--- a/src/gui/widgets/tabs/tab.h
+++ b/src/gui/widgets/tabs/tab.h
@@ -228,6 +228,7 @@ class Tab notfinal : public BasicContainer,
ImageCollection *mVertexes;
Image *mImage;
int mMode;
+ int mLabelMode;
protected:
bool mHasMouse;