]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/image.h
Use nullptr instead of 0 for pointers
[libs/gltk.git] / source / image.h
index 5f6b935d20422050df32664b5c00e71984361e61..12e77f2a7f6df28f935bcf2c66dac9290913f33f 100644 (file)
@@ -2,6 +2,7 @@
 #define MSP_GLTK_IMAGE_H_
 
 #include <msp/gl/texture2d.h>
+#include "mspgltk_api.h"
 #include "widget.h"
 
 namespace Msp {
@@ -10,24 +11,38 @@ namespace GLtk {
 /**
 A widget for displaying images.
 */
-class Image: public Widget
+class MSPGLTK_API Image: public Widget
 {
+public:
+       class Loader: public Msp::DataFile::DerivedObjectLoader<Image, Widget::Loader>
+       {
+       public:
+               Loader(Image &);
+       };
+
 private:
-       const GL::Texture2D *image;
-       bool keep_aspect;
+       const GL::Texture2D *image = nullptr;
+       std::string icon_name;
+       bool keep_aspect = true;
 
 public:
-       Image(const GL::Texture2D * = 0);
+       Image(const GL::Texture2D * = nullptr);
 
        virtual const char *get_class() const { return "image"; }
 
-       virtual void autosize();
+private:
+       virtual void autosize_special(const Part &, Geometry &) const;
 
+public:
        void set_image(const GL::Texture2D *);
+       void set_icon(const std::string &);
        void set_keep_aspect(bool);
 
 private:
-       virtual void render_special(const Part &) const;
+       void update_icon();
+       virtual void rebuild_special(const Part &);
+       virtual void on_style_change();
+       virtual void on_reparent();
 };
 
 } // namespace GLtk