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>2010-09-19 19:44:13 +0000
committerStijn Buys <ingar@osirion.org>2010-09-19 19:44:13 +0000
commitcc18095cded14f5e7e3f049e47fca2224134b647 (patch)
tree2a057f4836925083a19988d571dc0664925c9e48 /src/ui/plaintext.cc
parentbadfb31888a6bd62e0a019b3f3dec517df4121ec (diff)
text rendering cleanups, inventory capacity & cargo volume
Diffstat (limited to 'src/ui/plaintext.cc')
-rw-r--r--src/ui/plaintext.cc58
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());
+}
+
+}
+
+