diff options
author | Stijn Buys <ingar@osirion.org> | 2008-10-06 18:22:32 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-10-06 18:22:32 +0000 |
commit | a14d80f83aebe75241bf63b4f3ffca3a5d952577 (patch) | |
tree | fea36faedd17a0aa620f6d7e781a352327d6065d /src/ui/label.cc | |
parent | 343b0b4298e2d084d5544d3d40a8b7dcb586ce8e (diff) |
libui updates, support menu .ini files
Diffstat (limited to 'src/ui/label.cc')
-rw-r--r-- | src/ui/label.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/ui/label.cc b/src/ui/label.cc index f924452..aee6a36 100644 --- a/src/ui/label.cc +++ b/src/ui/label.cc @@ -12,15 +12,33 @@ using math::Vector2f; namespace ui { -Label::Label(Widget *parent, char const *text) : Widget(parent) +Label::Label(Widget *parent, const char *text) : Widget(parent) { set_label("label"); + set_text(text); +} + +Label::~Label() +{ +} + +void Label::print(size_t indent) +{ + std::string marker(""); + con_print << aux::pad_left(marker, indent*2) << label() << " \"" << text() << "\"" << std::endl; +} + +void Label::set_text(const char *text) +{ if (text) label_text.assign(text); + else + label_text.clear(); } -Label::~Label() +void Label::set_text(std::string const &text) { + label_text.assign(text); } void Label::draw() @@ -38,7 +56,7 @@ void Label::draw_text() if (palette()) render::gl::color(palette()->foreground()); - render::primitives::text_centered(to_global(location()), size(), label_text); + render::primitives::text_centered(global_location(), size(), label_text); } } |