From 6304a3afdcf747468dc125991b3313887c2af941 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Thu, 2 Jun 2011 00:22:05 +0200 Subject: Added a new transparent scheme based on Vanilla and a simple chat window, which displays text strings received from the server. --- gui.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'gui.cpp') diff --git a/gui.cpp b/gui.cpp index ed53cb4..4d4a723 100644 --- a/gui.cpp +++ b/gui.cpp @@ -29,6 +29,7 @@ void GUI::init() { WindowManager::setDefaultResourceGroup("layouts"); SchemeManager::getSingleton().create( "VanillaSkin.scheme" ); + SchemeManager::getSingleton().create( "Transparent.scheme" ); FontManager::getSingleton().create("VeraMono.font"); @@ -154,6 +155,33 @@ void ConsoleWindow::update() { WindowManager::getSingleton().getWindow("console_editbox")->activate(); } +/* ChatWindow */ + +ChatWindow::ChatWindow() { + WindowManager& wmgr(WindowManager::getSingleton()); + + wnd = wmgr.loadWindowLayout("chat.layout"); + root->addChildWindow(wnd); + + listbox = static_cast(wmgr.getWindow("chat_listbox")); +} + +ChatWindow::~ChatWindow() { + WindowManager& wmgr(WindowManager::getSingleton()); + wmgr.destroyWindow(wnd); + wmgr.cleanDeadPool(); +} + +void ChatWindow::add_line(const std::string& line) { + add_line(line.c_str()); +} + +void ChatWindow::add_line(const char *line) { + FormattedListboxTextItem *item = new FormattedListboxTextItem(String((utf8*)line), HTF_WORDWRAP_LEFT_ALIGNED); + listbox->addItem(item); + listbox->ensureItemIsVisible(item); +} + /* RaiseWindow */ /* default values */ -- cgit v1.2.3