[gtk+] API: Export gtk_container_snapshot_child()



commit c4065b9ee0db4ed03eb925234f528ebfc874e4cf
Author: Benjamin Otte <otte redhat com>
Date:   Tue Dec 20 19:00:07 2016 +0100

    API: Export gtk_container_snapshot_child()
    
    It's equivalent to gtk_container_propagate_draw() and then one is
    public, too.

 docs/reference/gtk/gtk4-sections.txt |    1 +
 gtk/gtkcontainer.c                   |   20 ++++++++++++++++++++
 gtk/gtkcontainer.h                   |    4 ++++
 gtk/gtkcontainerprivate.h            |    4 ----
 gtk/gtknotebook.c                    |    1 -
 5 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 0fa2080..d6a9260 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -735,6 +735,7 @@ gtk_container_child_notify
 gtk_container_child_notify_by_pspec
 gtk_container_forall
 gtk_container_propagate_draw
+gtk_container_snapshot_child
 gtk_container_get_focus_chain
 gtk_container_set_focus_chain
 gtk_container_unset_focus_chain
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 7db677a..4f23ece 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -3269,6 +3269,26 @@ gtk_container_propagate_draw (GtkContainer *container,
   cairo_restore (cr);
 }
 
+/**
+ * gtk_container_snapshot_child:
+ * @container: a #GtkContainer
+ * @child: a child of @container
+ * @snapshot: $GtkSnapshot as passed to the container. In particular, no
+ *   calls to gtk_snapshot_translate_2d() should have been applied by the
+ *   parent.
+ *
+ * When a container receives a call to the snapshot function, it must send
+ * synthetic #GtkWidget::snapshot calls to all children. This function
+ * provides a convenient way of doing this. A container, when it receives
+ * a call to its #GtkWidget::snapshot function, calls
+ * gtk_container_snapshot_child() once for each child, passing in
+ * the @snapshot the container received.
+ *
+ * gtk_container_snapshot_child() takes care of translating the origin of
+ * @snapshot, and deciding whether the child needs to be snapshot. It is a
+ * convenient and optimized way of getting the same effect as calling
+ * gtk_widget_snapshot() on the child directly.
+ **/
 void
 gtk_container_snapshot_child (GtkContainer      *container,
                               GtkWidget         *child,
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index 6725a80..81c4334 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -142,6 +142,10 @@ GDK_AVAILABLE_IN_ALL
 void     gtk_container_propagate_draw   (GtkContainer   *container,
                                         GtkWidget      *child,
                                         cairo_t        *cr);
+GDK_AVAILABLE_IN_3_90
+void      gtk_container_snapshot_child (GtkContainer *container,
+                                        GtkWidget    *child,
+                                        GtkSnapshot  *snapshot);
 
 GDK_AVAILABLE_IN_ALL
 void     gtk_container_set_focus_chain  (GtkContainer   *container,
diff --git a/gtk/gtkcontainerprivate.h b/gtk/gtkcontainerprivate.h
index c505d55..a0569f2 100644
--- a/gtk/gtkcontainerprivate.h
+++ b/gtk/gtkcontainerprivate.h
@@ -43,10 +43,6 @@ void      _gtk_container_maybe_start_idle_sizer (GtkContainer *container);
 void      gtk_container_get_children_clip       (GtkContainer  *container,
                                                  GtkAllocation *out_clip);
 
-void      gtk_container_snapshot_child          (GtkContainer  *container,
-                                                 GtkWidget     *child,
-                                                 GtkSnapshot   *snapshot);
-
 G_END_DECLS
 
 #endif /* __GTK_CONTAINER_PRIVATE_H__ */
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index f03a15a..49e9212 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -45,7 +45,6 @@
 #include "gtkwidgetpath.h"
 #include "gtkboxgadgetprivate.h"
 #include "gtkbuiltiniconprivate.h"
-#include "gtkcontainerprivate.h"
 #include "gtkcsscustomgadgetprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtksizerequest.h"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]