summaryrefslogtreecommitdiff
path: root/gtk/gtkrbtree.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2002-03-20 22:06:05 +0000
committerKristian Rietveld <kristian@src.gnome.org>2002-03-20 22:06:05 +0000
commit92febe2720cd229749e64e99ea31906bade84a44 (patch)
tree3aae7af7600e2217ec47b0909ee5b42fc250901f /gtk/gtkrbtree.c
parent8acfd1e9de927adf2bea546bda55740a2b0cc436 (diff)
downloadgtk+-92febe2720cd229749e64e99ea31906bade84a44.tar.gz
add _gtk_rbtree_set_fixed_height()
Wed Mar 20 22:59:23 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkrbtree.[ch]: add _gtk_rbtree_set_fixed_height() * gtk/gtktreeprivate.h: add fixed_height_check field * gtk/gtktreeview.c (gtk_tree_view_init): initialize scroll_sync_timer and fixed_height_check (do_validate_rows): add fixed_height_check. If all validated rows in the first cycle have the same height, then we set that height for the entire tree. This is some sort of 'fake' optimization, but helps a lot for the common case. We keep validating the entire tree in the background though. (gtk_tree_view_set_model): reset fixed_height_check
Diffstat (limited to 'gtk/gtkrbtree.c')
-rw-r--r--gtk/gtkrbtree.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c
index 0170f2cff1..6810183fcb 100644
--- a/gtk/gtkrbtree.c
+++ b/gtk/gtkrbtree.c
@@ -877,6 +877,32 @@ _gtk_rbtree_mark_invalid (GtkRBTree *tree)
while ((node = _gtk_rbtree_next (tree, node)) != NULL);
}
+void
+_gtk_rbtree_set_fixed_height (GtkRBTree *tree,
+ gint height)
+{
+ GtkRBNode *node;
+
+ if (tree == NULL)
+ return;
+
+ node = tree->root;
+ g_assert (node);
+
+ while (node->left != tree->nil)
+ node = node->left;
+
+ do
+ {
+ if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID))
+ _gtk_rbtree_node_set_height (tree, node, height);
+
+ if (node->children)
+ _gtk_rbtree_set_fixed_height (node->children, height);
+ }
+ while ((node = _gtk_rbtree_next (tree, node)) != NULL);
+}
+
typedef struct _GtkRBReorder
{
GtkRBTree *children;