diff lwlib/lwlib-utils.c @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 5a88923fcbfe
children 697ef44129c6
line wrap: on
line diff
--- a/lwlib/lwlib-utils.c	Mon Aug 13 11:12:06 2007 +0200
+++ b/lwlib/lwlib-utils.c	Mon Aug 13 11:13:30 2007 +0200
@@ -31,6 +31,31 @@
 #include <X11/ObjectP.h>
 #include "lwlib-utils.h"
 
+void
+destroy_all_children (Widget widget)
+{
+  Widget* children;
+  unsigned int number;
+  int i;
+
+  children = XtCompositeChildren (widget, &number);
+  if (children)
+    {
+      /* Unmanage all children and destroy them.  They will only be
+       * really destroyed when we get out of DispatchEvent. */
+      for (i = 0; i < number; i++)
+	{
+	  Widget child = children [i];
+	  if (!child->core.being_destroyed)
+	    {
+	      XtUnmanageChild (child);
+	      XtDestroyWidget (child);
+	    }
+	}
+      XtFree ((char *) children);
+    }
+}
+
 /* Redisplay the contents of the widget, without first clearing it. */
 void
 XtNoClearRefreshWidget (Widget widget)