diff options
Diffstat (limited to 'src/ui/plaintext.cc')
-rw-r--r-- | src/ui/plaintext.cc | 58 |
1 files changed, 58 insertions, 0 deletions
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()); +} + +} + + |