From 89f59c09fec10ff163f410960f77a9391f9e1e61 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 8 Apr 2009 06:23:54 -0600 Subject: Move ChatInput into the files for ChatWindow --- src/CMakeLists.txt | 2 -- src/Makefile.am | 2 -- src/gui/chat.cpp | 13 ++++++++++++- src/gui/chat.h | 19 ++++++++++++++++++- src/gui/chatinput.cpp | 34 ---------------------------------- src/gui/chatinput.h | 44 -------------------------------------------- tmw.cbp | 2 -- 7 files changed, 30 insertions(+), 86 deletions(-) delete mode 100644 src/gui/chatinput.cpp delete mode 100644 src/gui/chatinput.h 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 +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 +#include #include #include #include @@ -53,6 +55,21 @@ struct CHATLOG int own; }; +/** + * 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. * @@ -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 - -/** - * 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 diff --git a/tmw.cbp b/tmw.cbp index 48aca855..684333b6 100644 --- a/tmw.cbp +++ b/tmw.cbp @@ -238,8 +238,6 @@ - - -- cgit v1.2.3-70-g09d2