]> git.tdb.fi Git - libs/gltk.git/blob - source/label.cpp
Enable loading of widgets from datafiles (not implemented for all widgets yet)
[libs/gltk.git] / source / label.cpp
1 #include "label.h"
2 #include "part.h"
3
4 namespace Msp {
5 namespace GLtk {
6
7 Label::Label(const Resources &r, const std::string &t):
8         Widget(r)
9 {
10         set_text(t);
11         update_style();
12 }
13
14 void Label::set_text(const std::string &t)
15 {
16         text=t;
17 }
18
19 void Label::render_part(const Part &part) const
20 {
21         if(part.get_name()=="text")
22                 render_text(part, text);
23         else
24                 Widget::render_part(part);
25 }
26
27
28 Label::Loader::Loader(Label &l):
29         Widget::Loader(l)
30 {
31         add("text", &Label::text);
32 }
33
34 Label &Label::Loader::get_object()
35 {
36         return static_cast<Label &>(wdg);
37 }
38
39 } // namespace GLtk
40 } // namespace Msp