[gtkmm] Gtk::Button: Add set_image_from_icon_name() with a use_fallback argument
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gtk::Button: Add set_image_from_icon_name() with a use_fallback argument
- Date: Mon, 7 Apr 2014 14:28:16 +0000 (UTC)
commit a8fb2b77aa0530faeedfce721f1782c7bdfcbc44
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Mon Apr 7 16:26:01 2014 +0200
Gtk::Button: Add set_image_from_icon_name() with a use_fallback argument
* gtk/src/button.[hg|ccg]:
Add set_image_from_icon_name(icon_name, size, use_fallback). Bug #723124.
gtk/src/button.ccg | 8 ++++++++
gtk/src/button.hg | 21 +++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gtk/src/button.ccg b/gtk/src/button.ccg
index 583880f..e68300b 100644
--- a/gtk/src/button.ccg
+++ b/gtk/src/button.ccg
@@ -42,5 +42,13 @@ void Button::set_image_from_icon_name(const Glib::ustring& icon_name, IconSize s
set_image(*image);
}
+void Button::set_image_from_icon_name(const Glib::ustring& icon_name, IconSize size, bool use_fallback)
+{
+ Image* image = Gtk::manage(new Image());
+ image->set_from_icon_name(icon_name, size);
+ image->property_use_fallback() = use_fallback;
+ set_image(*image);
+}
+
} // namespace Gtk
diff --git a/gtk/src/button.hg b/gtk/src/button.hg
index 5276e4f..7be2ea5 100644
--- a/gtk/src/button.hg
+++ b/gtk/src/button.hg
@@ -103,6 +103,8 @@ public:
_WRAP_METHOD(void set_alignment(float xalign, float yalign), gtk_button_set_alignment)
_WRAP_METHOD(void get_alignment(float& xalign, float& yalign), gtk_button_get_alignment)
+ //TODO: When we can break ABI, combine the two set_image_from_icon_name() to
+ // void set_image_from_icon_name(const Glib::ustring& icon_name, IconSize size = ICON_SIZE_BUTTON, bool
use_fallback = false);
/** Sets the image to an icon from the current icon theme.
* If the icon name isn't known, a "broken image" icon will be
* displayed instead. If the current icon theme is changed, the icon
@@ -120,6 +122,25 @@ public:
*/
void set_image_from_icon_name(const Glib::ustring& icon_name, IconSize size = ICON_SIZE_BUTTON);
+ /** Sets the image to an icon from the current icon theme.
+ * If the icon name isn't known, a "broken image" icon will be
+ * displayed instead. If the current icon theme is changed, the icon
+ * will be updated appropriately.
+ * The icon will be displayed if there is no label text or if
+ * Gtk::Button::property_always_show_image() is <tt>true</tt>.
+ *
+ * This is a convenience wrapper around Gtk::Image::set_from_icon_name() and
+ * Gtk::Button:set_image().
+ *
+ * @param icon_name An icon name.
+ * @param size An icon size. Can be either an IconSize or a BuiltinIconSize.
+ * @param use_fallback Whether the icon displayed in the Gtk::Image will use
+ * standard icon names fallback. See also Gtk::ICON_LOOKUP_GENERIC_FALLBACK.
+ *
+ * @newin{3,12}
+ */
+ void set_image_from_icon_name(const Glib::ustring& icon_name, IconSize size, bool use_fallback);
+
_WRAP_METHOD(void set_image(Widget& image), gtk_button_set_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]