From edd5dfcd15198f5d5d277835fdf75108eb67472d Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 4 Sep 2011 17:39:39 +0000 Subject: Fixed the close button on the chat window. --- src/client/chat.cc | 14 +++++++++++++- src/client/chat.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/client/chat.cc b/src/client/chat.cc index 8a09883..c49550e 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -103,6 +103,18 @@ void Chat::toggle() show(); } +bool Chat::on_emit(ui::Widget *sender, const ui::Widget::Event event, void *data) +{ + if (sender == chat_closebutton) { + if (event == ui::Widget::EventButtonClicked) { + hide(); + return true; + } + } + + return Window::on_emit(sender, event, data); +} + bool Chat::on_keypress(const int key, const unsigned int modifier) { // number of lines to scroll @@ -250,7 +262,7 @@ void Chat::resize() chat_playerlist->set_size(ui::UI::elementsize.width() * 1.5f, height() - chat_playerlist->top() - padding * 2.0f); // resize chat text pane - chat_scrollpane->set_location(chat_playerlist->right() + padding, padding); + chat_scrollpane->set_location(chat_playerlist->right() + padding, chat_titlelabel->bottom() + padding); chat_scrollpane->set_size(width() - chat_scrollpane->left() - padding, chat_playerlist->height()); } diff --git a/src/client/chat.h b/src/client/chat.h index ca0ff72..9b64297 100644 --- a/src/client/chat.h +++ b/src/client/chat.h @@ -45,6 +45,8 @@ protected: virtual bool on_keypress(const int key, const unsigned int modifier); + virtual bool on_emit(ui::Widget *sender, const ui::Widget::Event event, void *data); + /** * @brief set the chatbox prompt to 'say:' or 'command:' depending on the current input text. */ -- cgit v1.2.3