summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2009-01-28 11:47:05 +0000
committerIra Rice <irarice@gmail.com>2009-01-30 18:11:51 -0700
commit5b47d0933dcfb6e898ccfa56efe53eb53b7d30cb (patch)
treeace4861b718cd58394c02f30afa0b9350825c35d /src
parent202280724138614924e473a693dc974929ef5836 (diff)
downloadmana-5b47d0933dcfb6e898ccfa56efe53eb53b7d30cb.tar.gz
mana-5b47d0933dcfb6e898ccfa56efe53eb53b7d30cb.tar.bz2
mana-5b47d0933dcfb6e898ccfa56efe53eb53b7d30cb.tar.xz
mana-5b47d0933dcfb6e898ccfa56efe53eb53b7d30cb.zip
Added highlighting ability to tabs.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/tab.cpp30
-rw-r--r--src/gui/widgets/tab.h7
2 files changed, 29 insertions, 8 deletions
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 6f7f497a..5465b431 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -21,8 +21,9 @@
#include <algorithm>
-#include "tab.h"
+#include <guichan/widgets/label.hpp>
+#include "tab.h"
#include "tabbedarea.h"
#include "../../configuration.h"
@@ -81,6 +82,7 @@ Tab::~Tab()
void Tab::init()
{
setFrameSize(0);
+ mHighlighted = false;
if (mInstances == 0)
{
@@ -112,16 +114,23 @@ void Tab::init()
void Tab::draw(gcn::Graphics *graphics)
{
- int mode;
+ int mode = TAB_STANDARD;
// check which type of tab to draw
- if (mTabbedArea && mTabbedArea->isTabSelected(this))
- {
- mode = TAB_SELECTED;
- }
- else
+ if (mTabbedArea)
{
- mode = TAB_STANDARD;
+ if(mTabbedArea->isTabSelected(this))
+ {
+ mode = TAB_SELECTED;
+ // if tab is selected, it doesnt need to highlight activity
+ mLabel->setForegroundColor(gcn::Color(0, 0, 0));
+ mHighlighted = false;
+ }
+ else if (mHighlighted)
+ {
+ mode = TAB_HIGHLIGHTED;
+ mLabel->setForegroundColor(gcn::Color(255, 0, 0));
+ }
}
if (config.getValue("guialpha", 0.8) != mAlpha)
@@ -141,3 +150,8 @@ void Tab::draw(gcn::Graphics *graphics)
// draw label
drawChildren(graphics);
}
+
+void Tab::setHighlighted(bool high)
+{
+ mHighlighted = high;
+}
diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h
index 23987cac..3af4e2bf 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 tab highlighted
+ */
+ void setHighlighted(bool high);
+
private:
/** Load images if no other instances exist yet */
void init();
@@ -54,6 +59,8 @@ class Tab : public gcn::Tab
static ImageRect tabImg[4]; /**< Tab state graphics */
static int mInstances; /**< Number of tab instances */
static float mAlpha;
+
+ bool mHighlighted;
};
#endif