[gtk+/wip/hires-icons: 4/9] widget: Add _scaled() variants for icon rendering
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/hires-icons: 4/9] widget: Add _scaled() variants for icon rendering
- Date: Fri, 10 May 2013 16:45:04 +0000 (UTC)
commit 13450c48c4f4217bec5f7600a7b2c2dc4bbe591c
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Feb 12 14:01:15 2013 +0100
widget: Add _scaled() variants for icon rendering
Likewise to the iconfactory changes, this API allows to
deal with stock icons at sizes that are suitable for
gdk_window_get_scale_factor()
gtk/gtkwidget.c | 23 +++++++++++++++++++++++
gtk/gtkwidget.h | 4 ++++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b5ce4e5..1f6fe40 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -9681,6 +9681,29 @@ gtk_widget_render_icon_pixbuf (GtkWidget *widget,
return gtk_icon_set_render_icon_pixbuf (icon_set, context, size);
}
+GdkPixbuf*
+gtk_widget_render_icon_pixbuf_scaled (GtkWidget *widget,
+ const gchar *stock_id,
+ GtkIconSize size,
+ gdouble *scale)
+{
+ GtkStyleContext *context;
+ GtkIconSet *icon_set;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+ g_return_val_if_fail (stock_id != NULL, NULL);
+ g_return_val_if_fail (size > GTK_ICON_SIZE_INVALID || size == -1, NULL);
+
+ context = gtk_widget_get_style_context (widget);
+ icon_set = gtk_style_context_lookup_icon_set (context, stock_id);
+
+ if (icon_set == NULL)
+ return NULL;
+
+ return gtk_icon_set_render_icon_pixbuf_scaled (icon_set, context,
+ size, scale);
+}
+
/**
* gtk_widget_set_parent_window:
* @widget: a #GtkWidget.
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index d6d49f7..f31d5ba 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -1012,6 +1012,10 @@ GDK_AVAILABLE_IN_ALL
GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget,
const gchar *stock_id,
GtkIconSize size);
+GdkPixbuf *gtk_widget_render_icon_scaled (GtkWidget *widget,
+ const gchar *stock_id,
+ GtkIconSize size,
+ gdouble *scale);
/* handle composite names for GTK_COMPOSITE_CHILD widgets,
* the returned name is newly allocated.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]