From 8ccfd7747bddf3fad75b0f358a64e66646b54032 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 19 Oct 2008 17:16:39 +0000 Subject: ui_chat and ui_chatsmall --- src/client/chat.cc | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/client/chat.cc') diff --git a/src/client/chat.cc b/src/client/chat.cc index a3c60c0..c829990 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -6,6 +6,7 @@ #include "auxiliary/functions.h" #include "client/chat.h" +#include "client/client.h" #include "core/core.h" #include "sys/sys.h" #include "ui/ui.h" @@ -33,6 +34,8 @@ Chat::Chat(ui::Widget *parent) : ui::Window(parent) set_background(true); set_visible(false); + + chat_small = false; } Chat::~Chat() @@ -40,6 +43,11 @@ Chat::~Chat() history.clear(); } +void Chat::set_small(bool small) +{ + chat_small = small; +} + void Chat::event_text(const std::string & text) { while (chat_log.size() >= DEFAULT_CHAT_LOG_SIZE) { @@ -99,6 +107,9 @@ bool Chat::on_keypress(const int key, const unsigned int modifier) history.push_back(""); history_pos = history.rbegin(); chat_input->set_text((*history_pos)); + + if (chat_small) + hide(); } else { hide(); } @@ -139,6 +150,9 @@ bool Chat::on_keypress(const int key, const unsigned int modifier) void Chat::event_draw() { + if (client()->console()->visible()) + return; + if (!core::application()->connected()) { hide(); return; @@ -146,14 +160,20 @@ void Chat::event_draw() if (ui::root()->active()) return; - else - Widget::event_draw(); + + if (chat_small) { + chat_scrollpane->hide(); + } else { + chat_scrollpane->show(); + } + Widget::event_draw(); } void Chat::resize() { const float margin = 8.0f; math::Vector2f s(size()); + s.x -= margin*2; s.y -= margin*2; -- cgit v1.2.3