[gtk+/rendering-cleanup-next: 34/153] API: Add gtk_container_propagate_draw()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 34/153] API: Add gtk_container_propagate_draw()
- Date: Sat, 11 Sep 2010 04:54:17 +0000 (UTC)
commit 1770590b124b9e37afeae3bb626c3c9cd3c648e8
Author: Benjamin Otte <otte redhat com>
Date: Mon Sep 6 11:34:07 2010 +0200
API: Add gtk_container_propagate_draw()
Equivalent to gtk_container_propagate_expose(), just for the draw event.
Also port GtkContainer to the draw vfunc
gtk/gtk.symbols | 1 +
gtk/gtkcontainer.c | 72 ++++++++++++++++++++++++++++++++++-----------------
gtk/gtkcontainer.h | 3 ++
3 files changed, 52 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 7f72bd6..18aed67 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -878,6 +878,7 @@ gtk_container_get_focus_hadjustment
gtk_container_get_focus_vadjustment
gtk_container_get_resize_mode
gtk_container_get_type G_GNUC_CONST
+gtk_container_propagate_draw
gtk_container_propagate_expose
gtk_container_remove
gtk_container_resize_children
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 3599fe0..6be2e02 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -103,8 +103,10 @@ static void gtk_container_children_callback (GtkWidget *widget,
gpointer client_data);
static void gtk_container_show_all (GtkWidget *widget);
static void gtk_container_hide_all (GtkWidget *widget);
-static gint gtk_container_expose (GtkWidget *widget,
- GdkEventExpose *event);
+static gint gtk_container_draw (GtkWidget *widget,
+ cairo_t *cr,
+ int width,
+ int height);
static void gtk_container_map (GtkWidget *widget);
static void gtk_container_unmap (GtkWidget *widget);
@@ -229,7 +231,7 @@ gtk_container_class_init (GtkContainerClass *class)
widget_class->show_all = gtk_container_show_all;
widget_class->hide_all = gtk_container_hide_all;
- widget_class->expose_event = gtk_container_expose;
+ widget_class->draw = gtk_container_draw;
widget_class->map = gtk_container_map;
widget_class->unmap = gtk_container_unmap;
widget_class->focus = gtk_container_focus;
@@ -2645,41 +2647,36 @@ gtk_container_hide_all (GtkWidget *widget)
static void
-gtk_container_expose_child (GtkWidget *child,
- gpointer client_data)
+gtk_container_draw_child (GtkWidget *child,
+ gpointer client_data)
{
struct {
GtkWidget *container;
- GdkEventExpose *event;
+ cairo_t *cr;
} *data = client_data;
- gtk_container_propagate_expose (GTK_CONTAINER (data->container),
- child,
- data->event);
+ gtk_container_propagate_draw (GTK_CONTAINER (data->container),
+ child,
+ data->cr);
}
static gint
-gtk_container_expose (GtkWidget *widget,
- GdkEventExpose *event)
+gtk_container_draw (GtkWidget *widget,
+ cairo_t *cr,
+ int width,
+ int height)
{
struct {
GtkWidget *container;
- GdkEventExpose *event;
+ cairo_t *cr;
} data;
- g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
+ data.container = widget;
+ data.cr = cr;
- if (gtk_widget_is_drawable (widget))
- {
- data.container = widget;
- data.event = event;
-
- gtk_container_forall (GTK_CONTAINER (widget),
- gtk_container_expose_child,
- &data);
- }
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_container_draw_child,
+ &data);
return FALSE;
}
@@ -2720,6 +2717,33 @@ gtk_container_unmap (GtkWidget *widget)
NULL);
}
+void
+gtk_container_propagate_draw (GtkContainer *container,
+ GtkWidget *child,
+ cairo_t *cr)
+{
+ GdkEventExpose *event;
+
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+ g_return_if_fail (cr != NULL);
+
+ g_assert (gtk_widget_get_parent (child) == GTK_WIDGET (container));
+
+ event = _gtk_cairo_get_event (cr);
+ if (event)
+ {
+ gtk_container_propagate_expose (container, child, event);
+ }
+ else
+ {
+ /* XXX: Needs gtk_widget_draw(), but can only happen once
+ * that function exists */
+ g_assert_not_reached ();
+ }
+
+}
+
/**
* gtk_container_propagate_expose:
* @container: a #GtkContainer
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index ff84ac8..185d43a 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -117,6 +117,9 @@ void gtk_container_foreach (GtkContainer *container,
gpointer callback_data);
GList* gtk_container_get_children (GtkContainer *container);
+void gtk_container_propagate_draw (GtkContainer *container,
+ GtkWidget *child,
+ cairo_t *cr);
void gtk_container_propagate_expose (GtkContainer *container,
GtkWidget *child,
GdkEventExpose *event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]