Commit 0cbe62f9 authored by Benjamin Otte's avatar Benjamin Otte

API: Add gtk_container_propagate_draw()

Equivalent to gtk_container_propagate_expose(), just for the draw event.
Also port GtkContainer to the draw vfunc
parent 90379ed6
...@@ -880,6 +880,7 @@ gtk_container_get_focus_hadjustment ...@@ -880,6 +880,7 @@ gtk_container_get_focus_hadjustment
gtk_container_get_focus_vadjustment gtk_container_get_focus_vadjustment
gtk_container_get_resize_mode gtk_container_get_resize_mode
gtk_container_get_type G_GNUC_CONST gtk_container_get_type G_GNUC_CONST
gtk_container_propagate_draw
gtk_container_propagate_expose gtk_container_propagate_expose
gtk_container_remove gtk_container_remove
gtk_container_resize_children gtk_container_resize_children
......
...@@ -106,8 +106,8 @@ static void gtk_container_children_callback (GtkWidget *widget, ...@@ -106,8 +106,8 @@ static void gtk_container_children_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void gtk_container_show_all (GtkWidget *widget); static void gtk_container_show_all (GtkWidget *widget);
static void gtk_container_hide_all (GtkWidget *widget); static void gtk_container_hide_all (GtkWidget *widget);
static gint gtk_container_expose (GtkWidget *widget, static gint gtk_container_draw (GtkWidget *widget,
GdkEventExpose *event); cairo_t *cr);
static void gtk_container_map (GtkWidget *widget); static void gtk_container_map (GtkWidget *widget);
static void gtk_container_unmap (GtkWidget *widget); static void gtk_container_unmap (GtkWidget *widget);
static void gtk_container_adjust_size_request (GtkWidget *widget, static void gtk_container_adjust_size_request (GtkWidget *widget,
...@@ -239,7 +239,7 @@ gtk_container_class_init (GtkContainerClass *class) ...@@ -239,7 +239,7 @@ gtk_container_class_init (GtkContainerClass *class)
widget_class->show_all = gtk_container_show_all; widget_class->show_all = gtk_container_show_all;
widget_class->hide_all = gtk_container_hide_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->map = gtk_container_map;
widget_class->unmap = gtk_container_unmap; widget_class->unmap = gtk_container_unmap;
widget_class->focus = gtk_container_focus; widget_class->focus = gtk_container_focus;
...@@ -2757,41 +2757,34 @@ gtk_container_hide_all (GtkWidget *widget) ...@@ -2757,41 +2757,34 @@ gtk_container_hide_all (GtkWidget *widget)
static void static void
gtk_container_expose_child (GtkWidget *child, gtk_container_draw_child (GtkWidget *child,
gpointer client_data) gpointer client_data)
{ {
struct { struct {
GtkWidget *container; GtkWidget *container;
GdkEventExpose *event; cairo_t *cr;
} *data = client_data; } *data = client_data;
gtk_container_propagate_expose (GTK_CONTAINER (data->container), gtk_container_propagate_draw (GTK_CONTAINER (data->container),
child, child,
data->event); data->cr);
} }
static gint static gint
gtk_container_expose (GtkWidget *widget, gtk_container_draw (GtkWidget *widget,
GdkEventExpose *event) cairo_t *cr)
{ {
struct { struct {
GtkWidget *container; GtkWidget *container;
GdkEventExpose *event; cairo_t *cr;
} data; } data;
g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE); data.container = widget;
g_return_val_if_fail (event != NULL, FALSE); data.cr = cr;
if (gtk_widget_is_drawable (widget)) gtk_container_forall (GTK_CONTAINER (widget),
{ gtk_container_draw_child,
data.container = widget; &data);
data.event = event;
gtk_container_forall (GTK_CONTAINER (widget),
gtk_container_expose_child,
&data);
}
return FALSE; return FALSE;
} }
...@@ -2832,6 +2825,33 @@ gtk_container_unmap (GtkWidget *widget) ...@@ -2832,6 +2825,33 @@ gtk_container_unmap (GtkWidget *widget)
NULL); 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: * gtk_container_propagate_expose:
* @container: a #GtkContainer * @container: a #GtkContainer
......
...@@ -119,6 +119,9 @@ void gtk_container_foreach (GtkContainer *container, ...@@ -119,6 +119,9 @@ void gtk_container_foreach (GtkContainer *container,
gpointer callback_data); gpointer callback_data);
GList* gtk_container_get_children (GtkContainer *container); 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, void gtk_container_propagate_expose (GtkContainer *container,
GtkWidget *child, GtkWidget *child,
GdkEventExpose *event); GdkEventExpose *event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment