From 020ae4ba6537fdce87209f07ea21cc002aaa52ba Mon Sep 17 00:00:00 2001 From: Jan-Fabian Humann Date: Mon, 14 Mar 2005 12:50:00 +0000 Subject: Fixed handling of get item button and made chatWindow (de)focus on ENTER - You can now only use the get item button when chat window isn't focused --- src/gui/chat.cpp | 10 +++++++++- src/gui/chat.h | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 253fb3f4..45c87ee8 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -188,6 +188,8 @@ void ChatWindow::action(const std::string& eventId) chat_send(char_info[0].name, message.c_str()); chatInput->setText(""); } + gui->focusNone(); + } } @@ -197,6 +199,11 @@ void ChatWindow::requestFocus() chatInput->requestFocus(); } +bool ChatWindow::isFocused() +{ + return chatInput->hasFocus(); +} + char *ChatWindow::chat_send(std::string nick, std::string msg) { short packid = 0x008c; @@ -339,4 +346,5 @@ std::string ChatWindow::cut_string(std::string& value, unsigned int maximumLengt } return std::string(""); -} \ No newline at end of file +} + diff --git a/src/gui/chat.h b/src/gui/chat.h index db2d9843..ad3d5e39 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -136,7 +136,12 @@ class ChatWindow : public Window, public gcn::ActionListener { * Request focus. */ void requestFocus(); - + + /** + * Checks wether ChatWindow is Focused or not + */ + bool isFocused(); + /* * Determines wether to send a command or an ordinary message, then * contructs packets & sends them @@ -196,3 +201,4 @@ class ChatWindow : public Window, public gcn::ActionListener { }; #endif + -- cgit v1.2.3-70-g09d2