X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fimage.h;h=8b857f41c48ec051309584b2f3d629a6dd0f250e;hb=HEAD;hp=8c5a9d5bc8ff40e8e6858ffca8e4dd27fcceaeda;hpb=d2d5b4c4dedf90a42dd2baff8334318b1d000f64;p=libs%2Fgltk.git diff --git a/source/image.h b/source/image.h index 8c5a9d5..99e0874 100644 --- a/source/image.h +++ b/source/image.h @@ -2,6 +2,7 @@ #define MSP_GLTK_IMAGE_H_ #include +#include "mspgltk_api.h" #include "widget.h" namespace Msp { @@ -10,26 +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 + { + 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"; } + const char *get_class() const override { return "image"; } private: - virtual void autosize_special(const Part &, Geometry &); + void autosize_special(const Part &, Geometry &) const override; public: void set_image(const GL::Texture2D *); + void set_icon(const std::string &); void set_keep_aspect(bool); private: - virtual void rebuild_special(const Part &); + void update_icon(); + void rebuild_special(const Part &) override; + void on_style_change() override; + void on_reparent() override; }; } // namespace GLtk