[gtk+/rendering-cleanup-next: 44/153] separatortoolitem: Port to draw vfunc



commit 80ace170288de9ea871506def94f0cd67ed6dc46
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 6 16:20:30 2010 +0200

    separatortoolitem: Port to draw vfunc

 gtk/gtkseparatortoolitem.c |   17 +++++++++------
 gtk/gtktoolbar.c           |   45 ++++++++++++++++++++++---------------------
 gtk/gtktoolbar.h           |    5 ++-
 3 files changed, 36 insertions(+), 31 deletions(-)
---
diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c
index 139cd25..9c28893 100644
--- a/gtk/gtkseparatortoolitem.c
+++ b/gtk/gtkseparatortoolitem.c
@@ -70,8 +70,10 @@ static void     gtk_separator_tool_item_size_request      (GtkWidget
                                                            GtkRequisition            *requisition);
 static void     gtk_separator_tool_item_size_allocate     (GtkWidget                 *widget,
                                                            GtkAllocation             *allocation);
-static gboolean gtk_separator_tool_item_expose            (GtkWidget                 *widget,
-                                                           GdkEventExpose            *event);
+static gboolean gtk_separator_tool_item_draw              (GtkWidget                 *widget,
+                                                           cairo_t                   *cr,
+                                                           int                        width,
+                                                           int                        height);
 static void     gtk_separator_tool_item_add               (GtkContainer              *container,
                                                            GtkWidget                 *child);
 static gint     get_space_size                            (GtkToolItem               *tool_item);
@@ -120,7 +122,7 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
   object_class->get_property = gtk_separator_tool_item_get_property;
   widget_class->size_request = gtk_separator_tool_item_size_request;
   widget_class->size_allocate = gtk_separator_tool_item_size_allocate;
-  widget_class->expose_event = gtk_separator_tool_item_expose;
+  widget_class->draw = gtk_separator_tool_item_draw;
   widget_class->realize = gtk_separator_tool_item_realize;
   widget_class->unrealize = gtk_separator_tool_item_unrealize;
   widget_class->map = gtk_separator_tool_item_map;
@@ -340,8 +342,10 @@ gtk_separator_tool_item_button_event (GtkWidget      *widget,
 }
 
 static gboolean
-gtk_separator_tool_item_expose (GtkWidget      *widget,
-                                GdkEventExpose *event)
+gtk_separator_tool_item_draw (GtkWidget *widget,
+                              cairo_t   *cr,
+                              int        width,
+                              int        height)
 {
   GtkAllocation allocation;
   GtkToolbar *toolbar = NULL;
@@ -356,8 +360,7 @@ gtk_separator_tool_item_expose (GtkWidget      *widget,
         toolbar = GTK_TOOLBAR (parent);
 
       gtk_widget_get_allocation (widget, &allocation);
-      _gtk_toolbar_paint_space_line (widget, toolbar,
-                                     &(event->area), &allocation);
+      _gtk_toolbar_paint_space_line (widget, toolbar, cr, width, height);
     }
 
   return FALSE;
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 31992e4..e6be914 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -3617,8 +3617,9 @@ _gtk_toolbar_get_default_space_size (void)
 void
 _gtk_toolbar_paint_space_line (GtkWidget           *widget,
 			       GtkToolbar          *toolbar,
-			       const GdkRectangle  *area,
-			       const GtkAllocation *allocation)
+                               cairo_t             *cr,
+                               int                  width,
+                               int                  height)
 {
   GtkToolbarPrivate *priv = toolbar->priv;
   GtkOrientation orientation;
@@ -3647,20 +3648,20 @@ _gtk_toolbar_paint_space_line (GtkWidget           *widget,
                             NULL);
 
       if (wide_separators)
-        gtk_paint_box (style, window,
+        gtk_cairo_paint_box (style, cr,
                        state, GTK_SHADOW_ETCHED_OUT,
-                       area, widget, "vseparator",
-                       allocation->x + (allocation->width - separator_width) / 2,
-                       allocation->y + allocation->height * start_fraction,
+                       widget, "vseparator",
+                       (width - separator_width) / 2,
+                       height * start_fraction,
                        separator_width,
-                       allocation->height * (end_fraction - start_fraction));
+                       height * (end_fraction - start_fraction));
       else
-        gtk_paint_vline (style, window,
-                         state, area, widget,
+        gtk_cairo_paint_vline (style, cr,
+                         state, widget,
                          "toolbar",
-                         allocation->y + allocation->height * start_fraction,
-                         allocation->y + allocation->height * end_fraction,
-                         allocation->x + (allocation->width - style->xthickness) / 2);
+                         height * start_fraction,
+                         height * end_fraction,
+                         (width - style->xthickness) / 2);
     }
   else
     {
@@ -3673,20 +3674,20 @@ _gtk_toolbar_paint_space_line (GtkWidget           *widget,
                             NULL);
 
       if (wide_separators)
-        gtk_paint_box (style, window,
+        gtk_cairo_paint_box (style, cr,
                        state, GTK_SHADOW_ETCHED_OUT,
-                       area, widget, "hseparator",
-                       allocation->x + allocation->width * start_fraction,
-                       allocation->y + (allocation->height - separator_height) / 2,
-                       allocation->width * (end_fraction - start_fraction),
+                       widget, "hseparator",
+                       width * start_fraction,
+                       (height - separator_height) / 2,
+                       width * (end_fraction - start_fraction),
                        separator_height);
       else
-        gtk_paint_hline (style, window,
-                         state, area, widget,
+        gtk_cairo_paint_hline (style, cr,
+                         state, widget,
                          "toolbar",
-                         allocation->x + allocation->width * start_fraction,
-                         allocation->x + allocation->width * end_fraction,
-                         allocation->y + (allocation->height - style->ythickness) / 2);
+                         width * start_fraction,
+                         width * end_fraction,
+                         (height - style->ythickness) / 2);
     }
 }
 
diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h
index 922fa0e..b7f9509 100644
--- a/gtk/gtktoolbar.h
+++ b/gtk/gtktoolbar.h
@@ -127,8 +127,9 @@ void            gtk_toolbar_set_drop_highlight_item (GtkToolbar      *toolbar,
 gchar *         _gtk_toolbar_elide_underscores      (const gchar         *original);
 void            _gtk_toolbar_paint_space_line       (GtkWidget           *widget,
 						     GtkToolbar          *toolbar,
-						     const GdkRectangle  *area,
-						     const GtkAllocation *allocation);
+                                                     cairo_t             *cr,
+                                                     int                  width,
+                                                     int                  height);
 gint            _gtk_toolbar_get_default_space_size (void);
 
 



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