[gtk+/icon-shadow: 4/9] stylecontext: add gtk_render_icon()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/icon-shadow: 4/9] stylecontext: add gtk_render_icon()
- Date: Tue, 31 May 2011 21:57:30 +0000 (UTC)
commit da8b2c233bb39fd6f6fe4eeac86c0c1c5c5515a4
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue May 24 20:59:50 2011 -0400
stylecontext: add gtk_render_icon()
docs/reference/gtk/gtk3-sections.txt | 1 +
gtk/gtk.symbols | 1 +
gtk/gtkstylecontext.c | 46 ++++++++++++++++++++++++++++++++++
gtk/gtkstylecontext.h | 7 +++++
4 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 291b219..f63e680 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -5639,6 +5639,7 @@ gtk_render_option
gtk_render_slider
gtk_render_activity
gtk_render_icon_pixbuf
+gtk_render_icon
<SUBSECTION Standard>
GTK_TYPE_STYLE_CONTEXT
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 51e07da..357840b 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -2230,6 +2230,7 @@ gtk_render_focus
gtk_render_frame
gtk_render_frame_gap
gtk_render_handle
+gtk_render_icon
gtk_render_icon_pixbuf
gtk_render_layout
gtk_render_line
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index b93dc36..fb41986 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -4403,3 +4403,49 @@ gtk_render_icon_pixbuf (GtkStyleContext *context,
_gtk_theming_engine_set_context (priv->theming_engine, context);
return engine_class->render_icon_pixbuf (priv->theming_engine, source, size);
}
+
+/**
+ * gtk_render_icon:
+ * @context: a #GtkStyleContext
+ * @cr: a #cairo_t
+ * @x: X origin of the rectangle
+ * @y: Y origin of the rectangle
+ * @width: rectangle width
+ * @height: rectangle height
+ * @pixbuf: a #GdkPixbuf containing the icon to draw
+ *
+ * Renders the icon in @pixbuf aligned and clipped in the specified area.
+ *
+ * Since: 3.2
+ **/
+void
+gtk_render_icon (GtkStyleContext *context,
+ cairo_t *cr,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GdkPixbuf *pixbuf)
+{
+ GtkStyleContextPrivate *priv;
+ GtkThemingEngineClass *engine_class;
+
+ g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+ g_return_if_fail (cr != NULL);
+
+ if (width <= 0 || height <= 0)
+ return;
+
+ priv = context->priv;
+ engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
+
+ cairo_save (cr);
+
+ store_animation_region (context, x, y, width, height);
+
+ _gtk_theming_engine_set_context (priv->theming_engine, context);
+ engine_class->render_icon (priv->theming_engine, cr,
+ x, y, width, height, pixbuf);
+
+ cairo_restore (cr);
+}
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index e687ff1..5ed8400 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -745,6 +745,13 @@ void gtk_render_activity (GtkStyleContext *context,
GdkPixbuf * gtk_render_icon_pixbuf (GtkStyleContext *context,
const GtkIconSource *source,
GtkIconSize size);
+void gtk_render_icon (GtkStyleContext *context,
+ cairo_t *cr,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GdkPixbuf *pixbuf);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]