[gtkmm/wip/dboles/Button-Issue#58: 4/4] Button: Add unset_image()
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/wip/dboles/Button-Issue#58: 4/4] Button: Add unset_image()
- Date: Tue, 19 Nov 2019 14:46:31 +0000 (UTC)
commit 5c38770fbb963845849baef31cdbff5909933dac
Author: Daniel Boles <dboles src gmail com>
Date: Tue Nov 19 14:43:34 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
Close https://gitlab.gnome.org/GNOME/gtkmm/merge_requests/22
gtk/src/button.ccg | 5 +++++
gtk/src/button.hg | 10 +++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
---
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..048ae6ca 100644
--- a/gtk/src/button.hg
+++ b/gtk/src/button.hg
@@ -144,13 +144,21 @@ public:
* property_always_show_image() is <tt>true</tt>. You don’t have to call
* Gtk::Widget::show() on the @a image yourself.
*
- * The image can be unset by assigning <tt>nullptr</tt> to property_image().
+ * The image can be unset by calling unset_image() or assigning
+ * <tt>nullptr</tt> to property_image().
*
* @newin{2,6}
*
* @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]