summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Hamann <lars@src.gnome.org>1998-07-20 19:45:45 +0000
committerLars Hamann <lars@src.gnome.org>1998-07-20 19:45:45 +0000
commitcebb7bfc9f6cff18b06716fb8e536998f1a3df9a (patch)
treef97a2a582b29900b8a29a0fb55d417c47e81c215
parentbfa2ec274b4da9f63da81d4f633f7f175856502d (diff)
downloadgtk+-cebb7bfc9f6cff18b06716fb8e536998f1a3df9a.tar.gz
new functions, recursive process tree to specified depth
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth) (gtk_ctree_pre_recursive_to_depth): new functions, recursive process tree to specified depth (gtk_ctree_expand_to_depth): expand tree to specified depth (gtk_ctree_collapse_to_depth): collapse all nodes with level >= depth
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-08
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-28
-rw-r--r--ChangeLog.pre-2-48
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--gtk/gtkctree.c157
-rw-r--r--gtk/gtkctree.h68
9 files changed, 255 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 0d8b57edbc..5613f285c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
+ (gtk_ctree_pre_recursive_to_depth): new functions, recursive process
+ tree to specified depth
+ (gtk_ctree_expand_to_depth): expand tree to specified depth
+ (gtk_ctree_collapse_to_depth): collapse all nodes with level >= depth
+
Sun Jul 19 23:51:05 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (scroll_vertical): fix for vertical scrolling in case
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 0d8b57edbc..5613f285c2 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,11 @@
+Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
+ (gtk_ctree_pre_recursive_to_depth): new functions, recursive process
+ tree to specified depth
+ (gtk_ctree_expand_to_depth): expand tree to specified depth
+ (gtk_ctree_collapse_to_depth): collapse all nodes with level >= depth
+
Sun Jul 19 23:51:05 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (scroll_vertical): fix for vertical scrolling in case
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 0d8b57edbc..5613f285c2 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,11 @@
+Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
+ (gtk_ctree_pre_recursive_to_depth): new functions, recursive process
+ tree to specified depth
+ (gtk_ctree_expand_to_depth): expand tree to specified depth
+ (gtk_ctree_collapse_to_depth): collapse all nodes with level >= depth
+
Sun Jul 19 23:51:05 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (scroll_vertical): fix for vertical scrolling in case
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 0d8b57edbc..5613f285c2 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,11 @@
+Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
+ (gtk_ctree_pre_recursive_to_depth): new functions, recursive process
+ tree to specified depth
+ (gtk_ctree_expand_to_depth): expand tree to specified depth
+ (gtk_ctree_collapse_to_depth): collapse all nodes with level >= depth
+
Sun Jul 19 23:51:05 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (scroll_vertical): fix for vertical scrolling in case
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 0d8b57edbc..5613f285c2 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,11 @@
+Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
+ (gtk_ctree_pre_recursive_to_depth): new functions, recursive process
+ tree to specified depth
+ (gtk_ctree_expand_to_depth): expand tree to specified depth
+ (gtk_ctree_collapse_to_depth): collapse all nodes with level >= depth
+
Sun Jul 19 23:51:05 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (scroll_vertical): fix for vertical scrolling in case
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 0d8b57edbc..5613f285c2 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,11 @@
+Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
+ (gtk_ctree_pre_recursive_to_depth): new functions, recursive process
+ tree to specified depth
+ (gtk_ctree_expand_to_depth): expand tree to specified depth
+ (gtk_ctree_collapse_to_depth): collapse all nodes with level >= depth
+
Sun Jul 19 23:51:05 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (scroll_vertical): fix for vertical scrolling in case
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 0d8b57edbc..5613f285c2 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,11 @@
+Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
+ (gtk_ctree_pre_recursive_to_depth): new functions, recursive process
+ tree to specified depth
+ (gtk_ctree_expand_to_depth): expand tree to specified depth
+ (gtk_ctree_collapse_to_depth): collapse all nodes with level >= depth
+
Sun Jul 19 23:51:05 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (scroll_vertical): fix for vertical scrolling in case
diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c
index 17f23e8967..759f845004 100644
--- a/gtk/gtkctree.c
+++ b/gtk/gtkctree.c
@@ -125,6 +125,9 @@ static void tree_expand (GtkCTree *ctree,
static void tree_collapse (GtkCTree *ctree,
GList *node,
gpointer data);
+static void tree_collapse_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth);
static void tree_toggle_expansion (GtkCTree *ctree,
GList *node,
gpointer data);
@@ -3226,6 +3229,15 @@ tree_collapse (GtkCTree *ctree,
}
static void
+tree_collapse_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth)
+{
+ if (node && GTK_CTREE_ROW (node)->level == depth)
+ gtk_ctree_collapse_recursive (ctree, node);
+}
+
+static void
tree_toggle_expansion (GtkCTree *ctree,
GList *node,
gpointer data)
@@ -3883,6 +3895,9 @@ gtk_ctree_post_recursive (GtkCTree *ctree,
GList *work;
GList *tmp;
+ g_return_if_fail (ctree != NULL);
+ g_return_if_fail (GTK_IS_CTREE (ctree));
+
if (node)
work = GTK_CTREE_ROW (node)->children;
else
@@ -3900,6 +3915,44 @@ gtk_ctree_post_recursive (GtkCTree *ctree,
}
void
+gtk_ctree_post_recursive_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth,
+ GtkCTreeFunc func,
+ gpointer data)
+{
+ GList *work;
+ GList *tmp;
+
+ g_return_if_fail (ctree != NULL);
+ g_return_if_fail (GTK_IS_CTREE (ctree));
+
+ if (depth < 0)
+ {
+ gtk_ctree_post_recursive (ctree, node, func, data);
+ return;
+ }
+
+ if (node)
+ work = GTK_CTREE_ROW (node)->children;
+ else
+ work = GTK_CLIST (ctree)->row_list;
+
+ if (work && GTK_CTREE_ROW (work)->level <= depth)
+ {
+ while (work)
+ {
+ tmp = GTK_CTREE_ROW (work)->sibling;
+ gtk_ctree_post_recursive_to_depth (ctree, work, depth, func, data);
+ work = tmp;
+ }
+ }
+
+ if (node && GTK_CTREE_ROW (node)->level <= depth)
+ func (ctree, node, data);
+}
+
+void
gtk_ctree_pre_recursive (GtkCTree *ctree,
GList *node,
GtkCTreeFunc func,
@@ -3908,6 +3961,8 @@ gtk_ctree_pre_recursive (GtkCTree *ctree,
GList *work;
GList *tmp;
+ g_return_if_fail (ctree != NULL);
+ g_return_if_fail (GTK_IS_CTREE (ctree));
if (node)
{
@@ -3925,6 +3980,45 @@ gtk_ctree_pre_recursive (GtkCTree *ctree,
}
}
+void
+gtk_ctree_pre_recursive_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth,
+ GtkCTreeFunc func,
+ gpointer data)
+{
+ GList *work;
+ GList *tmp;
+
+ g_return_if_fail (ctree != NULL);
+ g_return_if_fail (GTK_IS_CTREE (ctree));
+
+ if (depth < 0)
+ {
+ gtk_ctree_pre_recursive (ctree, node, func, data);
+ return;
+ }
+
+ if (node)
+ {
+ work = GTK_CTREE_ROW (node)->children;
+ if (GTK_CTREE_ROW (node)->level <= depth)
+ func (ctree, node, data);
+ }
+ else
+ work = GTK_CLIST (ctree)->row_list;
+
+ if (work && GTK_CTREE_ROW (work)->level <= depth)
+ {
+ while (work)
+ {
+ tmp = GTK_CTREE_ROW (work)->sibling;
+ gtk_ctree_pre_recursive_to_depth (ctree, work, depth, func, data);
+ work = tmp;
+ }
+ }
+}
+
gboolean
gtk_ctree_is_visible (GtkCTree *ctree,
GList *node)
@@ -4085,6 +4179,7 @@ gtk_ctree_expand_recursive (GtkCTree *ctree,
gboolean thaw = FALSE;
g_return_if_fail (ctree != NULL);
+ g_return_if_fail (GTK_IS_CTREE (ctree));
clist = GTK_CLIST (ctree);
@@ -4104,6 +4199,36 @@ gtk_ctree_expand_recursive (GtkCTree *ctree,
gtk_clist_thaw (clist);
}
+void
+gtk_ctree_expand_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth)
+{
+ GtkCList *clist;
+ gboolean thaw = FALSE;
+
+ g_return_if_fail (ctree != NULL);
+ g_return_if_fail (GTK_IS_CTREE (ctree));
+
+ clist = GTK_CLIST (ctree);
+
+ if (node && GTK_CTREE_ROW (node)->is_leaf)
+ return;
+
+ if (((node && gtk_ctree_is_visible (ctree, node)) || !node) &&
+ !GTK_CLIST_FROZEN (clist))
+ {
+ gtk_clist_freeze (clist);
+ thaw = TRUE;
+ }
+
+ gtk_ctree_post_recursive_to_depth (ctree, node, depth,
+ GTK_CTREE_FUNC (tree_expand), NULL);
+
+ if (thaw)
+ gtk_clist_thaw (clist);
+}
+
void
gtk_ctree_collapse (GtkCTree *ctree,
GList *node)
@@ -4125,6 +4250,7 @@ gtk_ctree_collapse_recursive (GtkCTree *ctree,
gboolean thaw = FALSE;
g_return_if_fail (ctree != NULL);
+ g_return_if_fail (GTK_IS_CTREE (ctree));
if (node && GTK_CTREE_ROW (node)->is_leaf)
return;
@@ -4144,6 +4270,37 @@ gtk_ctree_collapse_recursive (GtkCTree *ctree,
gtk_clist_thaw (clist);
}
+void
+gtk_ctree_collapse_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth)
+{
+ GtkCList *clist;
+ gboolean thaw = FALSE;
+
+ g_return_if_fail (ctree != NULL);
+ g_return_if_fail (GTK_IS_CTREE (ctree));
+
+ if (node && GTK_CTREE_ROW (node)->is_leaf)
+ return;
+
+ clist = GTK_CLIST (ctree);
+
+ if (((node && gtk_ctree_is_visible (ctree, node)) || !node) &&
+ !GTK_CLIST_FROZEN (clist))
+ {
+ gtk_clist_freeze (clist);
+ thaw = TRUE;
+ }
+
+ gtk_ctree_post_recursive_to_depth (ctree, node, depth,
+ GTK_CTREE_FUNC (tree_collapse_to_depth),
+ GINT_TO_POINTER (depth));
+
+ if (thaw)
+ gtk_clist_thaw (clist);
+}
+
void
gtk_ctree_toggle_expansion (GtkCTree *ctree,
GList *node)
diff --git a/gtk/gtkctree.h b/gtk/gtkctree.h
index 58f2edab46..cd6153c7af 100644
--- a/gtk/gtkctree.h
+++ b/gtk/gtkctree.h
@@ -181,32 +181,42 @@ void gtk_ctree_remove (GtkCTree *ctree,
* information *
***********************************************************/
-void gtk_ctree_post_recursive (GtkCTree *ctree,
- GList *node,
- GtkCTreeFunc func,
- gpointer data);
-void gtk_ctree_pre_recursive (GtkCTree *ctree,
- GList *node,
- GtkCTreeFunc func,
- gpointer data);
-gboolean gtk_ctree_is_visible (GtkCTree *ctree,
- GList *node);
-GList * gtk_ctree_last (GtkCTree *ctree,
- GList *node);
-GList * gtk_ctree_find_glist_ptr (GtkCTree *ctree,
- GtkCTreeRow *ctree_row);
-gint gtk_ctree_find (GtkCTree *ctree,
- GList *node,
- GList *child);
-gboolean gtk_ctree_is_ancestor (GtkCTree *ctree,
- GList *node,
- GList *child);
-GList * gtk_ctree_find_by_row_data (GtkCTree *ctree,
- GList *node,
- gpointer data);
-gboolean gtk_ctree_is_hot_spot (GtkCTree *ctree,
- gint x,
- gint y);
+void gtk_ctree_post_recursive (GtkCTree *ctree,
+ GList *node,
+ GtkCTreeFunc func,
+ gpointer data);
+void gtk_ctree_post_recursive_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth,
+ GtkCTreeFunc func,
+ gpointer data);
+void gtk_ctree_pre_recursive (GtkCTree *ctree,
+ GList *node,
+ GtkCTreeFunc func,
+ gpointer data);
+void gtk_ctree_pre_recursive_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth,
+ GtkCTreeFunc func,
+ gpointer data);
+gboolean gtk_ctree_is_visible (GtkCTree *ctree,
+ GList *node);
+GList * gtk_ctree_last (GtkCTree *ctree,
+ GList *node);
+GList * gtk_ctree_find_glist_ptr (GtkCTree *ctree,
+ GtkCTreeRow *ctree_row);
+gint gtk_ctree_find (GtkCTree *ctree,
+ GList *node,
+ GList *child);
+gboolean gtk_ctree_is_ancestor (GtkCTree *ctree,
+ GList *node,
+ GList *child);
+GList * gtk_ctree_find_by_row_data (GtkCTree *ctree,
+ GList *node,
+ gpointer data);
+gboolean gtk_ctree_is_hot_spot (GtkCTree *ctree,
+ gint x,
+ gint y);
/***********************************************************
* Tree signals : move, expand, collapse, (un)select *
@@ -220,10 +230,16 @@ void gtk_ctree_expand (GtkCTree *ctree,
GList *node);
void gtk_ctree_expand_recursive (GtkCTree *ctree,
GList *node);
+void gtk_ctree_expand_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth);
void gtk_ctree_collapse (GtkCTree *ctree,
GList *node);
void gtk_ctree_collapse_recursive (GtkCTree *ctree,
GList *node);
+void gtk_ctree_collapse_to_depth (GtkCTree *ctree,
+ GList *node,
+ gint depth);
void gtk_ctree_toggle_expansion (GtkCTree *ctree,
GList *node);
void gtk_ctree_toggle_expansion_recursive (GtkCTree *ctree,