summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-09 21:09:58 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-09 22:52:14 +0200
commit6ada0095e10a592ca78206edf851cc9e235619ab (patch)
tree63c6bc53d01040d9e402e0085e29ff14adb2f626 /src/gui/chat.cpp
parentdefb43bcd7dd1b3a475214bb3c36cb44bf16358f (diff)
downloadMana-6ada0095e10a592ca78206edf851cc9e235619ab.tar.gz
Mana-6ada0095e10a592ca78206edf851cc9e235619ab.tar.bz2
Mana-6ada0095e10a592ca78206edf851cc9e235619ab.tar.xz
Mana-6ada0095e10a592ca78206edf851cc9e235619ab.zip
No need for ChatInput to be in the header file, even
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index ab98b594..7f08ec48 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -28,6 +28,7 @@
#include "gui/widgets/chattab.h"
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/tabbedarea.h"
+#include "gui/widgets/textfield.h"
#include "gui/widgets/whispertab.h"
#include "beingmanager.h"
@@ -38,18 +39,30 @@
#include "utils/stringutils.h"
#include <guichan/focushandler.hpp>
+#include <guichan/focuslistener.hpp>
-ChatInput::ChatInput()
+/**
+ * The chat input hides when it loses focus. It is also invisible by default.
+ */
+class ChatInput : public TextField, public gcn::FocusListener
{
- setVisible(false);
+ public:
+ ChatInput()
+ {
+ setVisible(false);
+ addFocusListener(this);
+ }
- addFocusListener(this);
-}
+ /**
+ * Called if the chat input loses focus. It will set itself to
+ * invisible as result.
+ */
+ void focusLost(const gcn::Event &event)
+ {
+ setVisible(false);
+ }
+};
-void ChatInput::focusLost(const gcn::Event &event)
-{
- setVisible(false);
-}
ChatWindow::ChatWindow():
Window(_("Chat")),