]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/image.h
Rename some get functions as find because they can return null
[libs/gltk.git] / source / image.h
index 8b857f41c48ec051309584b2f3d629a6dd0f250e..99e0874f124e36b72ca3a08660896a9b40cc6f5c 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,7 +11,7 @@ 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>
@@ -20,17 +21,17 @@ public:
        };
 
 private:
-       const GL::Texture2D *image;
+       const GL::Texture2D *image = nullptr;
        std::string icon_name;
-       bool keep_aspect;
+       bool keep_aspect = true;
 
 public:
-       Image(const GL::Texture2D * = 0);
+       Image(const GL::Texture2D * = nullptr);
 
-       virtual const char *get_class() const { return "image"; }
+       const char *get_class() const override { return "image"; }
 
 private:
-       virtual void autosize_special(const Part &, Geometry &) const;
+       void autosize_special(const Part &, Geometry &) const override;
 
 public:
        void set_image(const GL::Texture2D *);
@@ -39,9 +40,9 @@ public:
 
 private:
        void update_icon();
-       virtual void rebuild_special(const Part &);
-       virtual void on_style_change();
-       virtual void on_reparent();
+       void rebuild_special(const Part &) override;
+       void on_style_change() override;
+       void on_reparent() override;
 };
 
 } // namespace GLtk