[gtk+/wip/baedert/children: 27/46] widget: Add gtk_widget_get_children_clip



commit 071b12880690dbe62b9714700cfd45d6498800e6
Author: Timm Bäder <mail baedert org>
Date:   Thu Nov 24 16:40:22 2016 +0100

    widget: Add gtk_widget_get_children_clip

 gtk/gtkwidget.c        |   25 +++++++++++++++++++++++++
 gtk/gtkwidgetprivate.h |    2 ++
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 0d56cc9..548c405 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -15870,3 +15870,28 @@ gtk_widget_propagate_draw (GtkWidget *widget,
 
   cairo_restore (cr);
 }
+
+void
+gtk_widget_get_children_clip (GtkWidget     *widget,
+                              GtkAllocation *out_clip)
+{
+  GtkWidget *child;
+
+  for (child = gtk_widget_get_first_child (widget);
+       child != NULL;
+       child = gtk_widget_get_next_sibling (child))
+    {
+      GtkAllocation widget_clip;
+
+      if (!gtk_widget_is_visible (widget) ||
+          !_gtk_widget_get_child_visible (widget))
+        return;
+
+      gtk_widget_get_clip (widget, &widget_clip);
+
+      if (out_clip->width == 0 || out_clip->height == 0)
+        *out_clip = widget_clip;
+      else
+        gdk_rectangle_union (&widget_clip, out_clip, out_clip);
+    }
+}
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 5237fbc..b2d0e6a 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -300,6 +300,8 @@ void              gtk_widget_adjust_size_allocation        (GtkWidget         *w
 void              gtk_widget_adjust_baseline_request       (GtkWidget *widget,
                                                             gint      *minimum_baseline,
                                                             gint      *natural_baseline);
+void              gtk_widget_get_children_clip             (GtkWidget     *container,
+                                                            GtkAllocation *out_clip);
 
 
 


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