From cc18095cded14f5e7e3f049e47fca2224134b647 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 19 Sep 2010 19:44:13 +0000 Subject: text rendering cleanups, inventory capacity & cargo volume --- src/ui/plaintext.cc | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/ui/plaintext.cc (limited to 'src/ui/plaintext.cc') diff --git a/src/ui/plaintext.cc b/src/ui/plaintext.cc new file mode 100644 index 0000000..33e10fc --- /dev/null +++ b/src/ui/plaintext.cc @@ -0,0 +1,58 @@ +/* + ui/text.cc + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#include "ui/paint.h" +#include "ui/plaintext.h" + +namespace ui +{ + +PlainText::PlainText(Widget *parent, const char *text) : Widget(parent) +{ + set_label("text"); + set_text(text); +} + +PlainText::~PlainText() +{ +} + +void PlainText::print(const size_t indent) const +{ + std::string marker(""); + con_print << aux::pad_left(marker, indent*2) << label() << " \"" << text() << "\"" << std::endl; +} + +void PlainText::clear() +{ + widget_text.clear(); +} + +void PlainText::set_text(const char *text) +{ + if (text) + widget_text.assign(text); + else + widget_text.clear(); +} + +void PlainText::set_text(const std::string &text) +{ + widget_text.assign(text); +} + +void PlainText::draw() +{ + if (!text().size()) + return; + + Paint::set_color(palette()->foreground()); + Paint::draw_text(global_location(), font(), text()); +} + +} + + -- cgit v1.2.3