[gtk+/rendering-cleanup-next: 45/155] separatortoolitem: Port to draw vfunc
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 45/155] separatortoolitem: Port to draw vfunc
- Date: Wed, 15 Sep 2010 03:00:41 +0000 (UTC)
commit 5fd3ede80b1c28fe3d6cca731505f3d7cb2bc931
Author: Benjamin Otte <otte redhat com>
Date: Mon Sep 6 16:20:30 2010 +0200
separatortoolitem: Port to draw vfunc
gtk/gtkseparatortoolitem.c | 13 +++++------
gtk/gtktoolbar.c | 46 ++++++++++++++++++++++---------------------
gtk/gtktoolbar.h | 3 +-
3 files changed, 31 insertions(+), 31 deletions(-)
---
diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c
index 139cd25..d8ebb63 100644
--- a/gtk/gtkseparatortoolitem.c
+++ b/gtk/gtkseparatortoolitem.c
@@ -70,8 +70,8 @@ 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);
static void gtk_separator_tool_item_add (GtkContainer *container,
GtkWidget *child);
static gint get_space_size (GtkToolItem *tool_item);
@@ -120,7 +120,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 +340,8 @@ 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)
{
GtkAllocation allocation;
GtkToolbar *toolbar = NULL;
@@ -356,8 +356,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);
}
return FALSE;
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 643e8e4..e4196fb 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -3615,14 +3615,14 @@ _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)
{
GtkToolbarPrivate *priv = toolbar->priv;
GtkOrientation orientation;
GtkStateType state;
GtkStyle *style;
GdkWindow *window;
+ int width, height;
const double start_fraction = (SPACE_LINE_START / SPACE_LINE_DIVISION);
const double end_fraction = (SPACE_LINE_END / SPACE_LINE_DIVISION);
@@ -3633,6 +3633,8 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget,
style = gtk_widget_get_style (widget);
window = gtk_widget_get_window (widget);
state = gtk_widget_get_state (widget);
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
@@ -3645,20 +3647,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
{
@@ -3671,20 +3673,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..99a278c 100644
--- a/gtk/gtktoolbar.h
+++ b/gtk/gtktoolbar.h
@@ -127,8 +127,7 @@ 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);
gint _gtk_toolbar_get_default_space_size (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]