[gtkmm] Gtk::Image: Add more constructors



commit 53987236b44d552146f90eb5342cfb967e61ae22
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Thu May 31 09:44:21 2018 +0200

    Gtk::Image: Add more constructors
    
    Add a ctor taking a Gdk::Paintable and a ctor taking a Gio::Icon.
    See issue #35.
    
    Fix the parameter name in _WRAP_CTOR(Image(const std::string& file), ...).
    The parameter name in _WRAP_CTOR must be equal to the corresponding
    property name.

 gtk/src/image.hg | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/src/image.hg b/gtk/src/image.hg
index b27196bd..160e2f47 100644
--- a/gtk/src/image.hg
+++ b/gtk/src/image.hg
@@ -55,7 +55,7 @@ public:
    * The storage type (get_storage_type()) of the returned image is not defined.
    * It will be whatever is appropriate for displaying the file.
    */
-  _WRAP_CTOR(Image(const std::string& filename), gtk_image_new_from_file)
+  _WRAP_CTOR(Image(const std::string& file), gtk_image_new_from_file)
 
   // gtk_image_new_from_pixbuf() does more than just call g_object_new().
   // GtkImage has no "pixbuf" property.
@@ -66,9 +66,13 @@ public:
   Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
   _IGNORE(gtk_image_new_from_pixbuf)
 
-  //We don't wrap gtk_image_new_from_icon_name() to avoid a clash with the from-filename constructor.
-  //But we do wrap gtk_image_set_from_icon_name()
-  _IGNORE(gtk_image_new_from_icon_name)
+  _WRAP_CTOR(Image(const Glib::RefPtr<Gdk::Paintable>& paintable), gtk_image_new_from_paintable)
+  _WRAP_CTOR(Image(const Glib::RefPtr<Gio::Icon>& gicon), gtk_image_new_from_gicon)
+
+  // We don't wrap gtk_image_new_from_resource() and gtk_image_new_from_icon_name()
+  // to avoid a clash with the from_filename constructor.
+  // But we do wrap gtk_image_set_from_resource() and gtk_image_set_from_icon_name().
+  _IGNORE(gtk_image_new_from_resource, gtk_image_new_from_icon_name)
 
   _WRAP_METHOD(void set(const std::string& filename), gtk_image_set_from_file)
   _WRAP_METHOD(void set_from_resource(const std::string& resource_path), gtk_image_set_from_resource)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]