[gimp/gtk3-port: 182/246] app: port GimpOverlayFrame to GtkStyleContext



commit 2999cdcfd49f1eea105b9b4da649b6e689f24906
Author: Michael Natterer <mitch gimp org>
Date:   Wed Dec 29 15:53:15 2010 +0100

    app: port GimpOverlayFrame to GtkStyleContext

 app/widgets/gimpoverlayframe.c |   40 ++++++++++++++++++++++------------------
 1 files changed, 22 insertions(+), 18 deletions(-)
---
diff --git a/app/widgets/gimpoverlayframe.c b/app/widgets/gimpoverlayframe.c
index ecd4cec..bc99b19 100644
--- a/app/widgets/gimpoverlayframe.c
+++ b/app/widgets/gimpoverlayframe.c
@@ -130,8 +130,9 @@ static gboolean
 gimp_overlay_frame_draw (GtkWidget *widget,
                          cairo_t   *cr)
 {
-  GtkStyle *style = gtk_widget_get_style (widget);
-  gboolean  rgba;
+  GtkStyleContext *style = gtk_widget_get_style_context (widget);
+  GdkRGBA          color;
+  gboolean         rgba;
 
   rgba = gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget)) != NULL;
 
@@ -142,7 +143,10 @@ gimp_overlay_frame_draw (GtkWidget *widget,
     }
 
   cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-  gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
+  gtk_style_context_get_background_color (style,
+                                          gtk_widget_get_state_flags (widget),
+                                          &color);
+  gdk_cairo_set_source_rgba (cr, &color);
 
   if (rgba)
     {
@@ -203,7 +207,7 @@ gimp_overlay_frame_draw (GtkWidget *widget,
   {
     GtkAllocation    allocation;
     cairo_pattern_t *gradient;
-    GimpRGB          color;
+    GdkRGBA          color;
     gdouble          x0, y0;
     gdouble          x1, y1;
     gdouble          w, h;
@@ -225,27 +229,27 @@ gimp_overlay_frame_draw (GtkWidget *widget,
 
     gradient = cairo_pattern_create_linear (x0, y0, x1, y1);
 
-    gimp_rgb_set_gdk_color (&color, &style->bg[GTK_STATE_NORMAL]);
+    gtk_style_context_get_color (style, 0, &color);
     cairo_pattern_add_color_stop_rgba (gradient,
                                        0.0,
-                                       color.r,
-                                       color.g,
-                                       color.b,
-                                       1.0);
+                                       color.red,
+                                       color.green,
+                                       color.blue,
+                                       color.alpha);
     cairo_pattern_add_color_stop_rgba (gradient,
                                        1.0,
-                                       color.r,
-                                       color.g,
-                                       color.b,
-                                       1.0);
+                                       color.red,
+                                       color.green,
+                                       color.blue,
+                                       color.alpha);
 
-    gimp_rgb_set_gdk_color (&color, &style->bg[GTK_STATE_SELECTED]);
+    gtk_style_context_get_color (style, GTK_STATE_FLAG_SELECTED, &color);
     cairo_pattern_add_color_stop_rgba (gradient,
                                        0.5,
-                                       color.r,
-                                       color.g,
-                                       color.b,
-                                       1.0);
+                                       color.red,
+                                       color.green,
+                                       color.blue,
+                                       color.alpha);
 
     cairo_set_source (cr, gradient);
 



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