From e55638d081e2e1ff6fbc06e0e8ac0381a04308e7 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 15 Sep 2010 21:29:18 +0000 Subject: updated comments, updated buy menu, info support for map window, added const to target selection --- src/client/chat.cc | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/client/chat.cc') diff --git a/src/client/chat.cc b/src/client/chat.cc index 5eb1922..c1fc78f 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -8,6 +8,7 @@ #include "client/chat.h" #include "client/client.h" #include "core/core.h" +#include "core/gameinterface.h" #include "sys/sys.h" #include "ui/ui.h" @@ -26,6 +27,12 @@ Chat::Chat(ui::Widget *parent) : ui::Window(parent) chat_scrollpane = new ui::ScrollPane(this, chat_log); chat_scrollpane->set_border(false); + chat_scrollpane->set_label("text"); + + chat_playerpane = new ui::ScrollPane(this, chat_players); + chat_playerpane->set_border(false); + chat_playerpane->set_label("players"); + chat_playerpane->set_alignment(ui::AlignLeft | ui::AlignTop); chat_input = new ui::InputBox(this); chat_input->set_border(false); @@ -46,6 +53,7 @@ Chat::~Chat() void Chat::clear() { + chat_players.clear(); chat_log.clear(); chat_input->clear(); } @@ -172,10 +180,24 @@ void Chat::event_draw() } if (chat_small) { + chat_playerpane->hide(); chat_scrollpane->hide(); } else { + chat_playerpane->show(); chat_scrollpane->show(); + + chat_players.clear(); + std::ostringstream ostr; + + ostr << "^B" << core::game()->players().size() << " " << aux::plural("player", core::game()->players().size()); + chat_players.push_back(ostr.str()); + + for (core::GameInterface::Players::iterator it = core::game()->players().begin(); it != core::game()->players().end(); it++) { + core::Player *player = (*it); + chat_players.push_back(player->name() + "^N"); + } } + Widget::event_draw(); } @@ -187,9 +209,15 @@ void Chat::resize() s[0] -= margin * 2; s[1] -= margin * 2; + // player names + chat_playerpane->set_size(ui::UI::elementsize.width() , s.height() - font()->height() * 2.5f); + chat_playerpane->set_location(s.width() - chat_playerpane->width() + 2.0f * margin, margin + font()->height()); + + // chat text + chat_scrollpane->set_size(s.width() - chat_playerpane->width() - margin, s.height() - font()->height() * 1.5f); chat_scrollpane->set_location(margin, margin); - chat_scrollpane->set_size(s.width(), s.height() - font()->height() *1.5f); + // input bar chat_input->set_location(margin, height() - font()->height() - margin); chat_input->set_size(s.width(), font()->height()); } -- cgit v1.2.3