[gtk+] Replace GtkStyle uses from migration guide examples
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Replace GtkStyle uses from migration guide examples
- Date: Sat, 19 Feb 2011 18:48:48 +0000 (UTC)
commit 50233edbc9627942291334f892389f7ee4d60742
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 19 13:47:43 2011 -0500
Replace GtkStyle uses from migration guide examples
Part of https://bugzilla.gnome.org/show_bug.cgi?id=642677
docs/reference/gtk/migrating-2to3.xml | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/docs/reference/gtk/migrating-2to3.xml b/docs/reference/gtk/migrating-2to3.xml
index 581101e..d68fe30 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, &area);
cairo_clip (cr);
/* set the correct source color */
-gdk_cairo_set_source_color (cr, &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, &rgba);
+gdk_cairo_set_source_rgba (cr, &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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]