]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/label.h
Improve widget part caching
[libs/gltk.git] / source / label.h
index 8380ef0eaaa8676eca5b348790830690297b4924..3e753dd0d92f97a64c69f1c6f46ea1a29421261d 100644 (file)
@@ -1,28 +1,41 @@
 #ifndef MSP_GLTK_LABEL_H_
 #define MSP_GLTK_LABEL_H_
 
+#include "text.h"
 #include "widget.h"
 
 namespace Msp {
 namespace GLtk {
 
+/**
+Labels display static text.  There is one special part: "text".
+*/
 class Label: public Widget
 {
 public:
-       class Loader: public Widget::Loader
+       class Loader: public DataFile::DerivedObjectLoader<Label, Widget::Loader>
        {
        public:
                Loader(Label &);
-               Label &get_object();
+       private:
+               void text(const std::string &);
        };
 
-       Label(const Resources &, const std::string & =std::string());
+private:
+       Text text;
+
+public:
+       Label(const std::string & = std::string());
+
+       virtual const char *get_class() const { return "label"; }
+
+       virtual void autosize();
        void set_text(const std::string &);
+
 private:
-       std::string text;
+       virtual void rebuild_special(const Part &);
 
-       const char *get_class() const { return "label"; }
-       void render_part(const Part &) const;
+       virtual void on_style_change();
 };
 
 } // namespace GLtk