[gtk+/rendering-cleanup-next: 6/153] separator: Convert to draw signal
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 6/153] separator: Convert to draw signal
- Date: Sat, 11 Sep 2010 04:51:56 +0000 (UTC)
commit 4523e7b7de11173d33ae8057461f85a08f03d12a
Author: Benjamin Otte <otte redhat com>
Date: Thu Sep 9 21:03:24 2010 +0200
separator: Convert to draw signal
gtk/gtkseparator.c | 63 ++++++++++++++++++++++++----------------------------
1 files changed, 29 insertions(+), 34 deletions(-)
---
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index 579231c..d081233 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -64,8 +64,10 @@ static void gtk_separator_get_property (GObject *object,
static void gtk_separator_size_request (GtkWidget *widget,
GtkRequisition *requisition);
-static gboolean gtk_separator_expose (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean gtk_separator_draw (GtkWidget *widget,
+ cairo_t *cr,
+ int width,
+ int height);
G_DEFINE_TYPE_WITH_CODE (GtkSeparator, gtk_separator, GTK_TYPE_WIDGET,
@@ -83,7 +85,7 @@ gtk_separator_class_init (GtkSeparatorClass *class)
object_class->get_property = gtk_separator_get_property;
widget_class->size_request = gtk_separator_size_request;
- widget_class->expose_event = gtk_separator_expose;
+ widget_class->draw = gtk_separator_draw;
g_object_class_override_property (object_class,
PROP_ORIENTATION,
@@ -186,8 +188,10 @@ gtk_separator_size_request (GtkWidget *widget,
}
static gboolean
-gtk_separator_expose (GtkWidget *widget,
- GdkEventExpose *event)
+gtk_separator_draw (GtkWidget *widget,
+ cairo_t *cr,
+ int width,
+ int height)
{
GtkSeparator *separator = GTK_SEPARATOR (widget);
GtkSeparatorPrivate *private = separator->priv;
@@ -199,9 +203,6 @@ gtk_separator_expose (GtkWidget *widget,
gint separator_width;
gint separator_height;
- if (!gtk_widget_is_drawable (widget))
- return FALSE;
-
style = gtk_widget_get_style (widget);
gtk_widget_style_get (widget,
"wide-separators", &wide_separators,
@@ -216,38 +217,32 @@ gtk_separator_expose (GtkWidget *widget,
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (wide_separators)
- gtk_paint_box (style, window,
- state, GTK_SHADOW_ETCHED_OUT,
- &event->area, widget, "hseparator",
- allocation.x,
- allocation.y + (allocation.height - separator_height) / 2,
- allocation.width,
- separator_height);
+ gtk_cairo_paint_box (style, cr,
+ gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
+ widget, "hseparator",
+ 0, (height - separator_height) / 2,
+ width, separator_height);
else
- gtk_paint_hline (style, window,
- state,
- &event->area, widget, "hseparator",
- allocation.x,
- allocation.x + allocation.width - 1,
- allocation.y + (allocation.height - style->ythickness) / 2);
+ gtk_cairo_paint_hline (style, cr,
+ gtk_widget_get_state (widget),
+ widget, "hseparator",
+ 0, width - 1,
+ (height - style->ythickness) / 2);
}
else
{
if (wide_separators)
- gtk_paint_box (style, window,
- state, GTK_SHADOW_ETCHED_OUT,
- &event->area, widget, "vseparator",
- allocation.x + (allocation.width - separator_width) / 2,
- allocation.y,
- separator_width,
- allocation.height);
+ gtk_cairo_paint_box (style, cr,
+ gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
+ widget, "vseparator",
+ (width - separator_width) / 2, 0,
+ separator_width, height);
else
- gtk_paint_vline (style, window,
- state,
- &event->area, widget, "vseparator",
- allocation.y,
- allocation.y + allocation.height - 1,
- allocation.x + (allocation.width - style->xthickness) / 2);
+ gtk_cairo_paint_vline (style, cr,
+ gtk_widget_get_state (widget),
+ widget, "vseparator",
+ 0, height - 1,
+ (width - style->xthickness) / 2);
}
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]