[gtk+] GtkWidget: add gtk_widget_render_icon_pixbuf()



commit 07eeae15825403037b7df139acf9bfa104d5559d
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Fri Dec 3 21:14:48 2010 +0100

    GtkWidget: add gtk_widget_render_icon_pixbuf()
    
    and deprecate gtk_widget_render_icon()

 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtk.symbols                      |    1 +
 gtk/gtkwidget.c                      |   64 +++++++++++++++++++++++----------
 3 files changed, 46 insertions(+), 20 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index d8f17b5..32759d9 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -4863,6 +4863,7 @@ gtk_widget_create_pango_context
 gtk_widget_get_pango_context
 gtk_widget_create_pango_layout
 gtk_widget_render_icon
+gtk_widget_render_icon_pixbuf
 gtk_widget_pop_composite_child
 gtk_widget_push_composite_child
 gtk_widget_queue_draw_area
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 411a2e7..e1d9de2 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -3293,6 +3293,7 @@ gtk_widget_region_intersect
 gtk_widget_remove_accelerator
 gtk_widget_remove_mnemonic_label
 gtk_widget_render_icon
+gtk_widget_render_icon_pixbuf
 gtk_widget_reparent
 gtk_widget_reset_rc_styles
 gtk_widget_reset_shapes
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 6b78cc1..93d5ee4 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8901,21 +8901,18 @@ gtk_widget_create_pango_layout (GtkWidget   *widget,
 }
 
 /**
- * gtk_widget_render_icon:
+ * gtk_widget_render_icon_pixbuf:
  * @widget: a #GtkWidget
  * @stock_id: a stock ID
  * @size: (type int): a stock size. A size of (GtkIconSize)-1 means
  *     render at the size of the source and don't scale (if there are
  *     multiple source sizes, GTK+ picks one of the available sizes).
- * @detail: (allow-none): render detail to pass to theme engine
  *
- * A convenience function that uses the theme engine and RC file
+ * A convenience function that uses the theme engine and style
  * settings for @widget to look up @stock_id and render it to
  * a pixbuf. @stock_id should be a stock icon ID such as
  * #GTK_STOCK_OPEN or #GTK_STOCK_OK. @size should be a size
- * such as #GTK_ICON_SIZE_MENU. @detail should be a string that
- * identifies the widget or code doing the rendering, so that
- * theme engines can special-case rendering for that widget or code.
+ * such as #GTK_ICON_SIZE_MENU.
  *
  * The pixels in the returned #GdkPixbuf are shared with the rest of
  * the application and should not be modified. The pixbuf should be freed
@@ -8923,16 +8920,16 @@ gtk_widget_create_pango_layout (GtkWidget   *widget,
  *
  * Return value: (transfer full): a new pixbuf, or %NULL if the
  *     stock ID wasn't known
+ *
+ * Since: 3.0
  **/
 GdkPixbuf*
-gtk_widget_render_icon (GtkWidget      *widget,
-                        const gchar    *stock_id,
-                        GtkIconSize     size,
-                        const gchar    *detail)
+gtk_widget_render_icon_pixbuf (GtkWidget   *widget,
+                               const gchar *stock_id,
+                               GtkIconSize  size)
 {
   GtkWidgetPrivate *priv;
   GtkIconSet *icon_set;
-  GdkPixbuf *retval;
 
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
   g_return_val_if_fail (stock_id != NULL, NULL);
@@ -8942,20 +8939,47 @@ gtk_widget_render_icon (GtkWidget      *widget,
 
   gtk_widget_ensure_style (widget);
 
-  icon_set = gtk_style_lookup_icon_set (priv->style, stock_id);
+  icon_set = gtk_style_context_lookup_icon_set (priv->context, stock_id);
 
   if (icon_set == NULL)
     return NULL;
 
-  retval = gtk_icon_set_render_icon (icon_set,
-                                     priv->style,
-                                     gtk_widget_get_direction (widget),
-                                     gtk_widget_get_state (widget),
-                                     size,
-                                     widget,
-                                     detail);
+  return gtk_icon_set_render_icon_pixbuf (icon_set, priv->context, size);
+}
 
-  return retval;
+/**
+ * gtk_widget_render_icon:
+ * @widget: a #GtkWidget
+ * @stock_id: a stock ID
+ * @size: (type int): a stock size. A size of (GtkIconSize)-1 means
+ *     render at the size of the source and don't scale (if there are
+ *     multiple source sizes, GTK+ picks one of the available sizes).
+ * @detail: (allow-none): render detail to pass to theme engine
+ *
+ * A convenience function that uses the theme engine and RC file
+ * settings for @widget to look up @stock_id and render it to
+ * a pixbuf. @stock_id should be a stock icon ID such as
+ * #GTK_STOCK_OPEN or #GTK_STOCK_OK. @size should be a size
+ * such as #GTK_ICON_SIZE_MENU. @detail should be a string that
+ * identifies the widget or code doing the rendering, so that
+ * theme engines can special-case rendering for that widget or code.
+ *
+ * The pixels in the returned #GdkPixbuf are shared with the rest of
+ * the application and should not be modified. The pixbuf should be freed
+ * after use with g_object_unref().
+ *
+ * Return value: (transfer full): a new pixbuf, or %NULL if the
+ *     stock ID wasn't known
+ *
+ * Deprecated: 3.0: Use gtk_widget_render_icon_pixbuf() instead.
+ **/
+GdkPixbuf*
+gtk_widget_render_icon (GtkWidget      *widget,
+                        const gchar    *stock_id,
+                        GtkIconSize     size,
+                        const gchar    *detail)
+{
+  return gtk_widget_render_icon_pixbuf (widget, stock_id, size);
 }
 
 /**



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