]> git.tdb.fi Git - libs/gltk.git/blob - source/label.h
0fb09e928fa6ff2e8edad62214e70991432ec3b2
[libs/gltk.git] / source / label.h
1 #ifndef MSP_GLTK_LABEL_H_
2 #define MSP_GLTK_LABEL_H_
3
4 #include "mspgltk_api.h"
5 #include "text.h"
6 #include "widget.h"
7
8 namespace Msp {
9 namespace GLtk {
10
11 /**
12 Labels display static text.  There is one special part: "text".
13 */
14 class MSPGLTK_API Label: public Widget
15 {
16 public:
17         class Loader: public DataFile::DerivedObjectLoader<Label, Widget::Loader>
18         {
19         public:
20                 Loader(Label &);
21
22         private:
23                 void text(const std::string &);
24         };
25
26 private:
27         Text text;
28
29 public:
30         Label(const std::string & = std::string());
31
32         const char *get_class() const override { return "label"; }
33
34         void set_text(const std::string &);
35
36 private:
37         void autosize_special(const Part &, Geometry &) const override;
38         void rebuild_special(const Part &) override;
39
40         void on_style_change() override;
41 };
42
43 } // namespace GLtk
44 } // namespace Msp
45
46 #endif