diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-27 07:32:02 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-27 07:32:02 -0600 |
commit | 9d68ee18a9d1f37cbdf4b984d6db72f7fc59cf51 (patch) | |
tree | 8928f298da71ff16f9177aa7227b9dcc97ae9d01 /src/gui | |
parent | 268e47c0d3791483f3d0066e24c6686c3c938da9 (diff) | |
download | mana-client-9d68ee18a9d1f37cbdf4b984d6db72f7fc59cf51.tar.gz mana-client-9d68ee18a9d1f37cbdf4b984d6db72f7fc59cf51.tar.bz2 mana-client-9d68ee18a9d1f37cbdf4b984d6db72f7fc59cf51.tar.xz mana-client-9d68ee18a9d1f37cbdf4b984d6db72f7fc59cf51.zip |
Add a close command to WhisperTab
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 10 | ||||
-rw-r--r-- | src/gui/chat.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.h | 2 |
6 files changed, 30 insertions, 2 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 7861bdb6..b0b15dbc 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -232,7 +232,10 @@ bool ChatWindow::isInputFocused() void ChatWindow::removeTab(ChatTab *tab) { // Prevent removal of the local chat tab - if (tab != localChatTab) mChatTabs->removeTab(tab); + if (tab == localChatTab) + return; + + mChatTabs->removeTab(tab); } void ChatWindow::addTab(ChatTab *tab) @@ -250,6 +253,11 @@ void ChatWindow::addTab(ChatTab *tab) logic(); } +void ChatWindow::removeWhisper(std::string nick) +{ + mWhispers.erase(nick); +} + void ChatWindow::chatSend(std::string &msg) { ChatTab *tab = getFocused(); diff --git a/src/gui/chat.h b/src/gui/chat.h index 7c080960..177aa38f 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -194,6 +194,8 @@ class ChatWindow : public Window, /** Add the tab to the window */ void addTab(ChatTab *tab); + void removeWhisper(std::string nick); + void adjustTabSize(); #ifdef EATHENA_SUPPORT diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 120d4e21..46116a37 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -290,7 +290,7 @@ void ChatTab::chatSend(std::string &msg) } else { - commandHandler->handleCommand(std::string(msg, 1)); + handleCommand(std::string(msg, 1)); } } @@ -322,3 +322,8 @@ void ChatTab::sendChat(std::string &msg) { return; #endif } + +void ChatTab::handleCommand(std::string msg) +{ + commandHandler->handleCommand(msg); +} diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index a478abeb..14c4c130 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -108,6 +108,8 @@ class ChatTab : public Tab virtual void sendChat(std::string &msg); + virtual void handleCommand(std::string msg); + ScrollArea *mScrollArea; BrowserBox *mTextOutput; //Recorder *mRecorder; diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index ba469c00..8af8d427 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -55,6 +55,7 @@ WhisperTab::WhisperTab(const std::string &nick) : WhisperTab::~WhisperTab() { + chatWindow->removeWhisper(mNick); } void WhisperTab::sendChat(std::string &msg) { @@ -76,3 +77,11 @@ void WhisperTab::sendChat(std::string &msg) { chatLog(strprintf(_("%s: %s"), player_node->getName().c_str(), msg.c_str()), BY_PLAYER, false); } + +void WhisperTab::handleCommand(std::string msg) +{ + if (msg == "close") + delete this; + else + ChatTab::handleCommand(msg); +} diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index e3ebf0f3..6f9db1ee 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -48,6 +48,8 @@ class WhisperTab : public ChatTab void sendChat(std::string &msg); + void handleCommand(std::string msg); + private: std::string mNick; }; |