Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine2005-03-28 22:07:56 +0000
committerVeronika Irvine2005-03-28 22:07:56 +0000
commit23fc8c95fbcf8582a842db17d1b67d4350ee089c (patch)
treee2051a1b0d0bf8b2c8f3e2d45cf876fa6a8b0d96
parentbd89ec28ce4c03e69b002e4e21dcd2b0f9ced25d (diff)
downloadeclipse.platform.swt-23fc8c95fbcf8582a842db17d1b67d4350ee089c.tar.gz
eclipse.platform.swt-23fc8c95fbcf8582a842db17d1b67d4350ee089c.tar.xz
eclipse.platform.swt-23fc8c95fbcf8582a842db17d1b67d4350ee089c.zip
add removeAll to TreeItem
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
index d47f962120..48680cb29a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
@@ -840,6 +840,26 @@ void releaseWidget () {
cellFont = null;
}
+public void removeAll () {
+ checkWidget ();
+ int length = OS.gtk_tree_model_iter_n_children (parent.modelHandle, handle);
+ if (length == 0) return;
+ int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
+ int [] index = new int [1];
+ boolean valid = OS.gtk_tree_model_iter_children (parent.modelHandle, iter, handle);
+ while (valid) {
+ OS.gtk_tree_model_get (parent.modelHandle, iter, Tree.ID_COLUMN, index, -1);
+ valid = OS.gtk_tree_model_iter_next (parent.modelHandle, iter);
+ TreeItem item = parent.items [index [0]];
+ if (item != null) {
+ item.releaseChild ();
+ item.releaseWidget ();
+ item.destroyWidget ();
+ }
+ }
+ OS.g_free (iter);
+}
+
/**
* Sets the receiver's background color to the color specified
* by the argument, or to the default system color for the item

Back to the top