summaryrefslogtreecommitdiff
path: root/docs/reference/gtk/migrating-2to3.xml
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-02-19 13:47:43 -0500
committerMatthias Clasen <mclasen@redhat.com>2011-02-19 13:47:43 -0500
commit50233edbc9627942291334f892389f7ee4d60742 (patch)
tree6287ef36d32b9193639a75ecd323765d85aa73a8 /docs/reference/gtk/migrating-2to3.xml
parent5cb6beec5439432d8b2b9253df97bb1ccce03a8e (diff)
downloadgtk+-50233edbc9627942291334f892389f7ee4d60742.tar.gz
Replace GtkStyle uses from migration guide examples
Part of https://bugzilla.gnome.org/show_bug.cgi?id=642677
Diffstat (limited to 'docs/reference/gtk/migrating-2to3.xml')
-rw-r--r--docs/reference/gtk/migrating-2to3.xml21
1 files changed, 11 insertions, 10 deletions
diff --git a/docs/reference/gtk/migrating-2to3.xml b/docs/reference/gtk/migrating-2to3.xml
index 581101e335..d68fe30432 100644
--- a/docs/reference/gtk/migrating-2to3.xml
+++ b/docs/reference/gtk/migrating-2to3.xml
@@ -277,6 +277,9 @@ gdk_gc_set_clip_rectangle (gc, NULL);
</programlisting></informalexample>
With cairo, the same effect can be achieved using:
<informalexample><programlisting>
+GtkStyleContext *context;
+GtkStateFlags flags;
+GdkRGBA rgba;
cairo_t *cr;
cr = gdk_cairo_create (drawable);
@@ -284,7 +287,10 @@ cr = gdk_cairo_create (drawable);
gdk_cairo_rectangle (cr, &amp;area);
cairo_clip (cr);
/* set the correct source color */
-gdk_cairo_set_source_color (cr, &amp;gtk_widget_get_style (widget)->text[state]);
+context = gtk_widget_get_style_context (widget));
+state = gtk_widget_get_state_flags (widget);
+gtk_style_context_get_color (context, state, &amp;rgba);
+gdk_cairo_set_source_rgba (cr, &amp;rgba);
/* draw the text */
cairo_move_to (cr, x, y);
pango_cairo_show_layout (cr, layout);
@@ -987,10 +993,13 @@ gboolean
gtk_arrow_draw (GtkWidget *widget,
cairo_t *cr)
{
+ GtkStyleContext *context;
gint x, y;
gint width, height;
gint extent;
+ context = gtk_widget_get_style_context (widget);
+
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
@@ -998,15 +1007,7 @@ gtk_arrow_draw (GtkWidget *widget,
x = PAD;
y = PAD;
- gtk_paint_arrow (gtk_widget_get_style (widget),
- cr,
- gtk_widget_get_state (widget),
- GTK_SHADOW_OUT,
- widget,
- "arrow",
- widget->priv->arrow_type,
- TRUE,
- x, y, extent, extent);
+ gtk_render_arrow (context, rc, G_PI / 2, x, y, extent);
}
</programlisting>
</example>