diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-08 06:23:54 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-08 06:23:54 -0600 |
commit | 89f59c09fec10ff163f410960f77a9391f9e1e61 (patch) | |
tree | 92041c233db743748ab7005c638c3c4374b339f9 /src | |
parent | 098b9f71c878af8862e8ef80289e806c93464513 (diff) | |
download | mana-89f59c09fec10ff163f410960f77a9391f9e1e61.tar.gz mana-89f59c09fec10ff163f410960f77a9391f9e1e61.tar.bz2 mana-89f59c09fec10ff163f410960f77a9391f9e1e61.tar.xz mana-89f59c09fec10ff163f410960f77a9391f9e1e61.zip |
Move ChatInput into the files for ChatWindow
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/gui/chat.cpp | 13 | ||||
-rw-r--r-- | src/gui/chat.h | 19 | ||||
-rw-r--r-- | src/gui/chatinput.cpp | 34 | ||||
-rw-r--r-- | src/gui/chatinput.h | 44 |
6 files changed, 30 insertions, 84 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 615a0975..89c70081 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -120,8 +120,6 @@ SET(SRCS gui/charcreatedialog.h gui/chat.cpp gui/chat.h - gui/chatinput.cpp - gui/chatinput.h gui/confirm_dialog.cpp gui/confirm_dialog.h gui/debugwindow.cpp diff --git a/src/Makefile.am b/src/Makefile.am index df2a11d9..b8ce31a6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -73,8 +73,6 @@ tmw_SOURCES = gui/widgets/avatar.cpp \ gui/charcreatedialog.h \ gui/chat.cpp \ gui/chat.h \ - gui/chatinput.cpp \ - gui/chatinput.h \ gui/confirm_dialog.cpp \ gui/confirm_dialog.h \ gui/debugwindow.cpp \ diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 17b1a3dc..86e5865a 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -21,7 +21,6 @@ #include "chat.h" -#include "gui/chatinput.h" #include "gui/itemlinkhandler.h" #include "gui/recorder.h" #include "gui/sdlinput.h" @@ -40,6 +39,18 @@ #include <guichan/focushandler.hpp> +ChatInput::ChatInput() +{ + setVisible(false); + + addFocusListener(this); +} + +void ChatInput::focusLost(const gcn::Event &event) +{ + setVisible(false); +} + ChatWindow::ChatWindow(): Window(_("Chat")), mTmpVisible(false) diff --git a/src/gui/chat.h b/src/gui/chat.h index 085833eb..d28cecd4 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -22,9 +22,11 @@ #ifndef CHAT_H #define CHAT_H +#include "gui/widgets/textfield.h" #include "gui/widgets/window.h" #include <guichan/actionlistener.hpp> +#include <guichan/focuslistener.hpp> #include <guichan/keylistener.hpp> #include <guichan/widget.hpp> #include <guichan/widgetlistener.hpp> @@ -54,6 +56,21 @@ struct CHATLOG }; /** + * The chat input hides when it loses focus. It is also invisible by default. + */ +class ChatInput : public TextField, public gcn::FocusListener +{ + public: + ChatInput(); + + /** + * Called if the chat input loses focus. It will set itself to + * invisible as result. + */ + void focusLost(const gcn::Event &event); +}; + +/** * The chat window. * * \ingroup Interface @@ -192,7 +209,7 @@ class ChatWindow : public Window, Recorder *mRecorder; /** Input box for typing chat messages. */ - gcn::TextField *mChatInput; + ChatInput *mChatInput; private: bool mTmpVisible; diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp deleted file mode 100644 index 43f3cde4..00000000 --- a/src/gui/chatinput.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The Mana World - * Copyright (C) 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "chatinput.h" - -ChatInput::ChatInput() -{ - setVisible(false); - - addFocusListener(this); -} - -void ChatInput::focusLost(const gcn::Event &event) -{ - setVisible(false); -} diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h deleted file mode 100644 index c76802bc..00000000 --- a/src/gui/chatinput.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The Mana World - * Copyright (C) 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef CHATINPUT_H -#define CHATINPUT_H - -#include "gui/widgets/textfield.h" - -#include <guichan/focuslistener.hpp> - -/** - * The chat input hides when it loses focus. It is also invisible by default. - */ -class ChatInput : public TextField, public gcn::FocusListener -{ - public: - ChatInput(); - - /** - * Called if the chat input loses focus. It will set itself to - * invisible as result. - */ - void focusLost(const gcn::Event &event); -}; - -#endif |