From 9aa4f417d06588c8aef654751f4ada92ccfb9c3f Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 10 Sep 2010 21:12:55 +0200 Subject: [PATCH] API: Remove gtk_container_propagate_expose() Also, move the documentation to its replacement gtk_widget_propagate_draw(). --- docs/reference/gtk/gtk3-sections.txt | 2 +- gtk/gtk.symbols | 1 - gtk/gtkcontainer.c | 75 +++++++++------------------- 3 files changed, 25 insertions(+), 53 deletions(-) diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index 5a3d0020b..16f3b0288 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -868,7 +868,7 @@ gtk_container_child_set_valist gtk_container_forall gtk_container_get_border_width gtk_container_set_border_width -gtk_container_propagate_expose +gtk_container_propagate_draw gtk_container_get_focus_chain gtk_container_set_focus_chain gtk_container_unset_focus_chain diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 671cdd4b1..345e1e429 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -881,7 +881,6 @@ 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 gtk_container_set_border_width diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 2a6855e2e..7cecb10dd 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -2825,6 +2825,30 @@ gtk_container_unmap (GtkWidget *widget) NULL); } +/** + * gtk_container_propagate_draw: + * @container: a #GtkContainer + * @child: a child of @container + * @cr: Cairo context as passed to the container. If you want to use @cr + * in container's draw function, consider using cairo_save() and + * cairo_restore() before calling this function. + * + * When a container receives a call to the draw function, it must send + * synthetic #GtkWidget::draw calls to all children that don't have their + * own #GdkWindows. This function provides a convenient way of doing this. + * A container, when it receives a call to its #GtkWidget::draw function, + * calls gtk_container_propagate_draw() once for each child, passing in + * the @cr the container received. + * + * gtk_container_propagate_draw() takes care of translating the origin of @cr, + * and deciding whether the draw needs to be sent to the child. It is a + * convenient and optimized way of getting the same effect as calling + * gtk_widget_draw() on the child directly. + * + * In most cases, a container can simply either inherit the + * #GtkWidget::draw implementation from #GtkContainer, or do some drawing + * and then chain to the ::draw implementation from #GtkContainer. + **/ void gtk_container_propagate_draw (GtkContainer *container, GtkWidget *child, @@ -2894,57 +2918,6 @@ gtk_container_propagate_draw (GtkContainer *container, cairo_restore (cr); } -/** - * gtk_container_propagate_expose: - * @container: a #GtkContainer - * @child: a child of @container - * @event: a expose event sent to container - * - * When a container receives an expose event, it must send synthetic - * expose events to all children that don't have their own #GdkWindows. - * This function provides a convenient way of doing this. A container, - * when it receives an expose event, calls gtk_container_propagate_expose() - * once for each child, passing in the event the container received. - * - * gtk_container_propagate_expose() takes care of deciding whether - * an expose event needs to be sent to the child, intersecting - * the event's area with the child area, and sending the event. - * - * In most cases, a container can simply either simply inherit the - * #GtkWidget::expose implementation from #GtkContainer, or, do some drawing - * and then chain to the ::expose implementation from #GtkContainer. - **/ -void -gtk_container_propagate_expose (GtkContainer *container, - GtkWidget *child, - GdkEventExpose *event) -{ - GdkEvent *child_event; - - g_return_if_fail (GTK_IS_CONTAINER (container)); - g_return_if_fail (GTK_IS_WIDGET (child)); - g_return_if_fail (event != NULL); - - g_assert (gtk_widget_get_parent (child) == GTK_WIDGET (container)); - - if (gtk_widget_is_drawable (child) && - !gtk_widget_get_has_window (child) && - gtk_widget_get_window (child) == event->window) - { - child_event = gdk_event_new (GDK_EXPOSE); - child_event->expose = *event; - g_object_ref (child_event->expose.window); - - child_event->expose.region = gtk_widget_region_intersect (child, event->region); - if (!cairo_region_is_empty (child_event->expose.region)) - { - cairo_region_get_extents (child_event->expose.region, &child_event->expose.area); - gtk_widget_send_expose (child, child_event); - } - gdk_event_free (child_event); - } -} - gboolean _gtk_container_get_need_resize (GtkContainer *container) { -- 2.43.2