diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-30 18:33:00 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-30 18:33:00 -0600 |
commit | caf3cad2da9945e48fc2104404460f639c71a6b0 (patch) | |
tree | 513663c5b27299bb088d7af51bcf3fec8f207fa5 /src/gui | |
parent | dc8df2e9205724c7d4c9a7b6599770ddd29aace3 (diff) | |
download | mana-caf3cad2da9945e48fc2104404460f639c71a6b0.tar.gz mana-caf3cad2da9945e48fc2104404460f639c71a6b0.tar.bz2 mana-caf3cad2da9945e48fc2104404460f639c71a6b0.tar.xz mana-caf3cad2da9945e48fc2104404460f639c71a6b0.zip |
Hilight chat tabs when appropriate
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/chattab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tab.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.h | 5 |
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; }; |