summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/chattab.cpp2
-rw-r--r--src/gui/widgets/chattab.h2
-rw-r--r--src/gui/widgets/tab.h6
-rw-r--r--src/gui/widgets/tabbedarea.cpp10
-rw-r--r--src/gui/widgets/tabbedarea.h5
5 files changed, 25 insertions, 0 deletions
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 4a63bbcd..43248e8b 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -207,6 +207,8 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord)
mScrollArea->logic();
chatWindow->mRecorder->record(line.substr(3));
+ if (this != getTabbedArea()->getSelectedTab())
+ setHighlighted(true);
}
void ChatTab::chatLog(const std::string &nick, const std::string &msg)
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 76b33011..88443aa3 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -110,6 +110,8 @@ class ChatTab : public Tab
friend class ChatWindow;
friend class WhisperWindow;
+ virtual void setCurrent() { setHighlighted(false); }
+
virtual void handleInput(const std::string &msg);
virtual void handleCommand(std::string msg);
diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h
index 64e76d4c..efdc8d26 100644
--- a/src/gui/widgets/tab.h
+++ b/src/gui/widgets/tab.h
@@ -23,8 +23,10 @@
#define TAB_H
#include <guichan/widgets/tab.hpp>
+#include <guichan/widgets/tabbedarea.hpp>
class ImageRect;
+class TabbedArea;
/**
* A tab, the same as the guichan tab in 0.8, but extended to allow transparancy
@@ -57,6 +59,10 @@ class Tab : public gcn::Tab
*/
void setHighlighted(bool high);
+ protected:
+ friend class TabbedArea;
+ virtual void setCurrent() {}
+
private:
/** Load images if no other instances exist yet */
void init();
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 8e93d394..0d7cf155 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -146,4 +146,14 @@ void TabbedArea::removeTab(Tab *tab)
void TabbedArea::logic()
{
logicChildren();
+
+}
+void TabbedArea::setSelectedTab(gcn::Tab *tab)
+{
+ gcn::TabbedArea::setSelectedTab(tab);
+
+ Tab *newTab = dynamic_cast<Tab*>(tab);
+
+ if (newTab)
+ newTab->setCurrent();
}
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index dffbd36b..b4fc1ded 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -87,6 +87,11 @@ class TabbedArea : public gcn::TabbedArea
int getContainerHeight() { return mWidgetContainer->getHeight(); }
+ void setSelectedTab(unsigned int index)
+ { gcn::TabbedArea::setSelectedTab(index); }
+
+ void setSelectedTab(gcn::Tab *tab);
+
private:
typedef std::vector< std::pair<gcn::Tab*, gcn::Widget*> > TabContainer;
};