Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-19 17:16:39 +0000
committerStijn Buys <ingar@osirion.org>2008-10-19 17:16:39 +0000
commit8ccfd7747bddf3fad75b0f358a64e66646b54032 (patch)
tree8d666d7172fced1e310701741b860ed13f400a78 /src/client/chat.cc
parent1d580ed36893b24b618ff1e6f9023e497c62498c (diff)
ui_chat and ui_chatsmall
Diffstat (limited to 'src/client/chat.cc')
-rw-r--r--src/client/chat.cc24
1 files changed, 22 insertions, 2 deletions
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;