[gtkmm/wip/dboles/Button-Issue#58] Button: Add unset_image()



commit 593b6588463ff042a5dd2aae331b2cf4fd1c3e06
Author: Daniel Boles <dboles src gmail com>
Date:   Fri Nov 15 19:09:44 2019 +0000

    Button: Add unset_image()
    
    We had no way to do this in C++ because we make set_image() take a
    Widget&, not a Widget*, so there was no way to say there should be none.
    
    Close https://gitlab.gnome.org/GNOME/gtkmm/issues/58

 gtk/src/button.ccg | 5 +++++
 gtk/src/button.hg  | 7 +++++++
 2 files changed, 12 insertions(+)
---
diff --git a/gtk/src/button.ccg b/gtk/src/button.ccg
index 82fd22e2..74913b50 100644
--- a/gtk/src/button.ccg
+++ b/gtk/src/button.ccg
@@ -52,6 +52,11 @@ void Button::set_image_from_icon_name(const Glib::ustring& icon_name, IconSize s
   set_image(*image);
 }
 
+void Button::unset_image()
+{
+  gtk_button_set_image(gobj(), nullptr);
+}
+
 // GtkButton:focus-on-click has been removed from gtk+.
 // TODO: At ABI-break, remove it from gtkmm.
 #ifndef GTKMM_DISABLE_DEPRECATED
diff --git a/gtk/src/button.hg b/gtk/src/button.hg
index b9d6eecb..0fba938b 100644
--- a/gtk/src/button.hg
+++ b/gtk/src/button.hg
@@ -151,6 +151,13 @@ public:
    * @param image A widget to set as the image for the button.
    */
   _WRAP_METHOD(void set_image(Widget& image), gtk_button_set_image)
+
+  /** Unsets the image.
+   * @see set_image()
+   * @newin{3,26}
+   */
+  void unset_image();
+
   _WRAP_METHOD(Widget* get_image(), gtk_button_get_image)
   _WRAP_METHOD(const Widget* get_image() const, gtk_button_get_image, constversion)
 


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