[gimp/gtk3-port: 5/246] libgimpwidgets: port virtual functions to GTK+ 3.0



commit 5bcb9c15f42c42b634595c4ee49ecd1a803be8c1
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 10:26:34 2010 +0200

    libgimpwidgets: port virtual functions to GTK+ 3.0

 libgimpwidgets/gimpcellrenderertoggle.c |  109 +++++++++++++-----------------
 1 files changed, 47 insertions(+), 62 deletions(-)
---
diff --git a/libgimpwidgets/gimpcellrenderertoggle.c b/libgimpwidgets/gimpcellrenderertoggle.c
index 218fbd8..655564d 100644
--- a/libgimpwidgets/gimpcellrenderertoggle.c
+++ b/libgimpwidgets/gimpcellrenderertoggle.c
@@ -56,35 +56,34 @@ enum
 };
 
 
-static void gimp_cell_renderer_toggle_finalize     (GObject         *object);
-static void gimp_cell_renderer_toggle_get_property (GObject         *object,
-                                                    guint            param_id,
-                                                    GValue          *value,
-                                                    GParamSpec      *pspec);
-static void gimp_cell_renderer_toggle_set_property (GObject         *object,
-                                                    guint            param_id,
-                                                    const GValue    *value,
-                                                    GParamSpec      *pspec);
-static void gimp_cell_renderer_toggle_get_size     (GtkCellRenderer *cell,
-                                                    GtkWidget       *widget,
-                                                    GdkRectangle    *rectangle,
-                                                    gint            *x_offset,
-                                                    gint            *y_offset,
-                                                    gint            *width,
-                                                    gint            *height);
-static void gimp_cell_renderer_toggle_render       (GtkCellRenderer *cell,
-                                                    GdkWindow       *window,
-                                                    GtkWidget       *widget,
-                                                    GdkRectangle    *background_area,
-                                                    GdkRectangle    *cell_area,
-                                                    GdkRectangle    *expose_area,
-                                                    GtkCellRendererState flags);
-static gboolean gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell,
-                                                    GdkEvent        *event,
-                                                    GtkWidget       *widget,
-                                                    const gchar     *path,
-                                                    GdkRectangle    *background_area,
-                                                    GdkRectangle    *cell_area,
+static void gimp_cell_renderer_toggle_finalize     (GObject              *object);
+static void gimp_cell_renderer_toggle_get_property (GObject              *object,
+                                                    guint                 param_id,
+                                                    GValue               *value,
+                                                    GParamSpec           *pspec);
+static void gimp_cell_renderer_toggle_set_property (GObject              *object,
+                                                    guint                 param_id,
+                                                    const GValue         *value,
+                                                    GParamSpec           *pspec);
+static void gimp_cell_renderer_toggle_get_size     (GtkCellRenderer      *cell,
+                                                    GtkWidget            *widget,
+                                                    const GdkRectangle   *rectangle,
+                                                    gint                 *x_offset,
+                                                    gint                 *y_offset,
+                                                    gint                 *width,
+                                                    gint                 *height);
+static void gimp_cell_renderer_toggle_render       (GtkCellRenderer      *cell,
+                                                    cairo_t              *cr,
+                                                    GtkWidget            *widget,
+                                                    const GdkRectangle   *background_area,
+                                                    const GdkRectangle   *cell_area,
+                                                    GtkCellRendererState  flags);
+static gboolean gimp_cell_renderer_toggle_activate (GtkCellRenderer      *cell,
+                                                    GdkEvent             *event,
+                                                    GtkWidget            *widget,
+                                                    const gchar          *path,
+                                                    const GdkRectangle   *background_area,
+                                                    const GdkRectangle   *cell_area,
                                                     GtkCellRendererState  flags);
 static void gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle,
                                                      GtkWidget              *widget);
@@ -220,13 +219,13 @@ gimp_cell_renderer_toggle_set_property (GObject      *object,
 }
 
 static void
-gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
-                                    GtkWidget       *widget,
-                                    GdkRectangle    *cell_area,
-                                    gint            *x_offset,
-                                    gint            *y_offset,
-                                    gint            *width,
-                                    gint            *height)
+gimp_cell_renderer_toggle_get_size (GtkCellRenderer    *cell,
+                                    GtkWidget          *widget,
+                                    const GdkRectangle *cell_area,
+                                    gint               *x_offset,
+                                    gint               *y_offset,
+                                    gint               *width,
+                                    gint               *height)
 {
   GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
   GtkStyle               *style  = gtk_widget_get_style (widget);
@@ -289,17 +288,15 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
 
 static void
 gimp_cell_renderer_toggle_render (GtkCellRenderer      *cell,
-                                  GdkWindow            *window,
+                                  cairo_t              *cr,
                                   GtkWidget            *widget,
-                                  GdkRectangle         *background_area,
-                                  GdkRectangle         *cell_area,
-                                  GdkRectangle         *expose_area,
+                                  const GdkRectangle   *background_area,
+                                  const GdkRectangle   *cell_area,
                                   GtkCellRendererState  flags)
 {
   GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
   GtkStyle               *style  = gtk_widget_get_style (widget);
   GdkRectangle            toggle_rect;
-  GdkRectangle            draw_rect;
   GtkStateType            state;
   gboolean                active;
   gint                    xpad;
@@ -307,9 +304,9 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer      *cell,
 
   if (! toggle->stock_id)
     {
-      GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, window, widget,
+      GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, cr, widget,
                                                       background_area,
-                                                      cell_area, expose_area,
+                                                      cell_area,
                                                       flags);
       return;
     }
@@ -348,13 +345,11 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer      *cell,
         state = GTK_STATE_INSENSITIVE;
     }
 
-  if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) &&
-      (flags & GTK_CELL_RENDERER_PRELIT))
+  if (flags & GTK_CELL_RENDERER_PRELIT)
     gtk_paint_shadow (style,
-                      window,
+                      cr,
                       state,
                       active ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
-                      &draw_rect,
                       widget, NULL,
                       toggle_rect.x,     toggle_rect.y,
                       toggle_rect.width, toggle_rect.height);
@@ -366,19 +361,9 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer      *cell,
       toggle_rect.width  -= style->xthickness * 2;
       toggle_rect.height -= style->ythickness * 2;
 
-      if (gdk_rectangle_intersect (&draw_rect, &toggle_rect, &draw_rect))
-        {
-          cairo_t *cr = gdk_cairo_create (window);
-
-          gdk_cairo_rectangle (cr, &draw_rect);
-          cairo_clip (cr);
-
-          gdk_cairo_set_source_pixbuf (cr, toggle->pixbuf,
-                                       toggle_rect.x, toggle_rect.y);
-          cairo_paint (cr);
-
-          cairo_destroy (cr);
-        }
+      gdk_cairo_set_source_pixbuf (cr, toggle->pixbuf,
+                                   toggle_rect.x, toggle_rect.y);
+      cairo_paint (cr);
     }
 }
 
@@ -387,8 +372,8 @@ gimp_cell_renderer_toggle_activate (GtkCellRenderer      *cell,
                                     GdkEvent             *event,
                                     GtkWidget            *widget,
                                     const gchar          *path,
-                                    GdkRectangle         *background_area,
-                                    GdkRectangle         *cell_area,
+                                    const GdkRectangle   *background_area,
+                                    const GdkRectangle   *cell_area,
                                     GtkCellRendererState  flags)
 {
   GtkCellRendererToggle *toggle = GTK_CELL_RENDERER_TOGGLE (cell);



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