]> git.tdb.fi Git - libs/gltk.git/commitdiff
Add a datafile statement to set an icon for an Image
authorMikko Rasa <tdb@tdb.fi>
Sat, 26 Nov 2016 11:38:02 +0000 (13:38 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 26 Nov 2016 11:38:02 +0000 (13:38 +0200)
source/image.cpp
source/image.h

index 0102a47e487ea8bf4a9efdf29cf1696172820b8f..1da782d28a2579e66d4079d8ffb915f703627255 100644 (file)
@@ -129,5 +129,12 @@ void Image::on_reparent()
                update_icon();
 }
 
+
+Image::Loader::Loader(Image &img):
+       DataFile::DerivedObjectLoader<Image, Widget::Loader>(img)
+{
+       add("icon", &Image::icon_name);
+}
+
 } // namespace GLtk
 } // namespace Msp
index 18556108b9ae3c67edf0766234111d4e5e946d42..8b857f41c48ec051309584b2f3d629a6dd0f250e 100644 (file)
@@ -12,6 +12,13 @@ A widget for displaying images.
 */
 class Image: public Widget
 {
+public:
+       class Loader: public Msp::DataFile::DerivedObjectLoader<Image, Widget::Loader>
+       {
+       public:
+               Loader(Image &);
+       };
+
 private:
        const GL::Texture2D *image;
        std::string icon_name;