From fdb66f1ab40015982c389533ce81c33be3462f82 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 26 Oct 2001 19:45:06 +0000 Subject: [PATCH] Create new "indent_expander" style property. 2001-10-26 Anders Carlsson * gtk/gtktreeview.c: (gtk_tree_view_class_init): Create new "indent_expander" style property. (gtk_tree_view_get_arrow_xrange): Add a tree argument to the function since the xrange can change depending on where in the tree we are. (coords_are_over_arrow): Update function call to gtk_tree_view_get_arrow_xrange. (gtk_tree_view_draw_arrow): Likewise. (gtk_tree_view_real_expand_collapse_cursor_row): Call real_{expand|collapse}_row, so that we'll have an animation. --- ChangeLog | 18 ++++++++++++++++++ ChangeLog.pre-2-0 | 18 ++++++++++++++++++ ChangeLog.pre-2-10 | 18 ++++++++++++++++++ ChangeLog.pre-2-2 | 18 ++++++++++++++++++ ChangeLog.pre-2-4 | 18 ++++++++++++++++++ ChangeLog.pre-2-6 | 18 ++++++++++++++++++ ChangeLog.pre-2-8 | 18 ++++++++++++++++++ gtk/gtktreeview.c | 31 ++++++++++++++++++++++++++----- 8 files changed, 152 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40b9407ab7..3d52f552dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2001-10-26 Anders Carlsson + + * gtk/gtktreeview.c: + (gtk_tree_view_class_init): Create new "indent_expander" + style property. + + (gtk_tree_view_get_arrow_xrange): Add a tree argument + to the function since the xrange can change depending + on where in the tree we are. + + (coords_are_over_arrow): Update function call to + gtk_tree_view_get_arrow_xrange. + (gtk_tree_view_draw_arrow): Likewise. + + (gtk_tree_view_real_expand_collapse_cursor_row): + Call real_{expand|collapse}_row, so that we'll have an + animation. + Fri Oct 26 20:13:36 2001 Kristian Rietveld * tests/Makefile.am: fixed a small typo diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 40b9407ab7..3d52f552dc 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,21 @@ +2001-10-26 Anders Carlsson + + * gtk/gtktreeview.c: + (gtk_tree_view_class_init): Create new "indent_expander" + style property. + + (gtk_tree_view_get_arrow_xrange): Add a tree argument + to the function since the xrange can change depending + on where in the tree we are. + + (coords_are_over_arrow): Update function call to + gtk_tree_view_get_arrow_xrange. + (gtk_tree_view_draw_arrow): Likewise. + + (gtk_tree_view_real_expand_collapse_cursor_row): + Call real_{expand|collapse}_row, so that we'll have an + animation. + Fri Oct 26 20:13:36 2001 Kristian Rietveld * tests/Makefile.am: fixed a small typo diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 40b9407ab7..3d52f552dc 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,21 @@ +2001-10-26 Anders Carlsson + + * gtk/gtktreeview.c: + (gtk_tree_view_class_init): Create new "indent_expander" + style property. + + (gtk_tree_view_get_arrow_xrange): Add a tree argument + to the function since the xrange can change depending + on where in the tree we are. + + (coords_are_over_arrow): Update function call to + gtk_tree_view_get_arrow_xrange. + (gtk_tree_view_draw_arrow): Likewise. + + (gtk_tree_view_real_expand_collapse_cursor_row): + Call real_{expand|collapse}_row, so that we'll have an + animation. + Fri Oct 26 20:13:36 2001 Kristian Rietveld * tests/Makefile.am: fixed a small typo diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 40b9407ab7..3d52f552dc 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,21 @@ +2001-10-26 Anders Carlsson + + * gtk/gtktreeview.c: + (gtk_tree_view_class_init): Create new "indent_expander" + style property. + + (gtk_tree_view_get_arrow_xrange): Add a tree argument + to the function since the xrange can change depending + on where in the tree we are. + + (coords_are_over_arrow): Update function call to + gtk_tree_view_get_arrow_xrange. + (gtk_tree_view_draw_arrow): Likewise. + + (gtk_tree_view_real_expand_collapse_cursor_row): + Call real_{expand|collapse}_row, so that we'll have an + animation. + Fri Oct 26 20:13:36 2001 Kristian Rietveld * tests/Makefile.am: fixed a small typo diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 40b9407ab7..3d52f552dc 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,21 @@ +2001-10-26 Anders Carlsson + + * gtk/gtktreeview.c: + (gtk_tree_view_class_init): Create new "indent_expander" + style property. + + (gtk_tree_view_get_arrow_xrange): Add a tree argument + to the function since the xrange can change depending + on where in the tree we are. + + (coords_are_over_arrow): Update function call to + gtk_tree_view_get_arrow_xrange. + (gtk_tree_view_draw_arrow): Likewise. + + (gtk_tree_view_real_expand_collapse_cursor_row): + Call real_{expand|collapse}_row, so that we'll have an + animation. + Fri Oct 26 20:13:36 2001 Kristian Rietveld * tests/Makefile.am: fixed a small typo diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 40b9407ab7..3d52f552dc 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,21 @@ +2001-10-26 Anders Carlsson + + * gtk/gtktreeview.c: + (gtk_tree_view_class_init): Create new "indent_expander" + style property. + + (gtk_tree_view_get_arrow_xrange): Add a tree argument + to the function since the xrange can change depending + on where in the tree we are. + + (coords_are_over_arrow): Update function call to + gtk_tree_view_get_arrow_xrange. + (gtk_tree_view_draw_arrow): Likewise. + + (gtk_tree_view_real_expand_collapse_cursor_row): + Call real_{expand|collapse}_row, so that we'll have an + animation. + Fri Oct 26 20:13:36 2001 Kristian Rietveld * tests/Makefile.am: fixed a small typo diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 40b9407ab7..3d52f552dc 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,21 @@ +2001-10-26 Anders Carlsson + + * gtk/gtktreeview.c: + (gtk_tree_view_class_init): Create new "indent_expander" + style property. + + (gtk_tree_view_get_arrow_xrange): Add a tree argument + to the function since the xrange can change depending + on where in the tree we are. + + (coords_are_over_arrow): Update function call to + gtk_tree_view_get_arrow_xrange. + (gtk_tree_view_draw_arrow): Likewise. + + (gtk_tree_view_real_expand_collapse_cursor_row): + Call real_{expand|collapse}_row, so that we'll have an + animation. + Fri Oct 26 20:13:36 2001 Kristian Rietveld * tests/Makefile.am: fixed a small typo diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index c4ef444842..57563244e1 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -278,6 +278,7 @@ static void gtk_tree_view_draw_arrow (GtkTreeView gint x, gint y); static void gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view, + GtkRBTree *tree, gint *x1, gint *x2); static gint gtk_tree_view_new_column_width (GtkTreeView *tree_view, @@ -576,7 +577,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) #define _TREE_VIEW_EXPANDER_SIZE 10 #define _TREE_VIEW_VERTICAL_SEPARATOR 2 #define _TREE_VIEW_HORIZONTAL_SEPARATOR 2 - + gtk_widget_class_install_style_property (widget_class, g_param_spec_int ("expander_size", _("Expander Size"), @@ -611,6 +612,12 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) TRUE, G_PARAM_READABLE)); + gtk_widget_class_install_style_property (widget_class, + g_param_spec_boolean ("indent_expanders", + _("Indent Expanders"), + _("Make the expanders indented."), + FALSE, + G_PARAM_READABLE)); /* Signals */ widget_class->set_scroll_adjustments_signal = gtk_signal_new ("set_scroll_adjustments", @@ -1898,7 +1905,7 @@ coords_are_over_arrow (GtkTreeView *tree_view, arrow.height = BACKGROUND_HEIGHT (node); - gtk_tree_view_get_arrow_xrange (tree_view, &arrow.x, &x2); + gtk_tree_view_get_arrow_xrange (tree_view, tree, &arrow.x, &x2); arrow.width = x2 - arrow.x; @@ -4767,6 +4774,7 @@ gtk_tree_view_get_background_xrange (GtkTreeView *tree_view, } static void gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view, + GtkRBTree *tree, gint *x1, gint *x2) { @@ -4774,6 +4782,7 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view, GList *list; GtkTreeViewColumn *tmp_column = NULL; gint total_width; + gboolean indent_expanders; total_width = 0; for (list = tree_view->priv->columns; list; list = list->next) @@ -4790,6 +4799,13 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view, total_width += tmp_column->width; } + gtk_widget_style_get (GTK_WIDGET (tree_view), + "indent_expanders", &indent_expanders, + NULL); + + if (indent_expanders) + x_offset += tree_view->priv->tab_offset * _gtk_rbtree_get_depth (tree); + if (x1) *x1 = x_offset; @@ -5689,7 +5705,7 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view, widget = GTK_WIDGET (tree_view); - gtk_tree_view_get_arrow_xrange (tree_view, &x_offset, NULL); + gtk_tree_view_get_arrow_xrange (tree_view, tree, &x_offset, NULL); area.x = x_offset; area.y = CELL_FIRST_PIXEL (tree_view, tree, node, vertical_separator); @@ -6106,6 +6122,8 @@ gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView *tree_view, gboolean open_all) { GtkTreePath *cursor_path = NULL; + GtkRBTree *tree; + GtkRBNode *node; cursor_path = NULL; if (tree_view->priv->cursor) @@ -6114,13 +6132,16 @@ gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView *tree_view, if (cursor_path == NULL) return; + if (_gtk_tree_view_find_node (tree_view, cursor_path, &tree, &node)) + return; + gtk_widget_grab_focus (GTK_WIDGET (tree_view)); gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL); if (expand) - gtk_tree_view_expand_row (tree_view, cursor_path, open_all); + gtk_tree_view_real_expand_row (tree_view, cursor_path, tree, node, open_all, TRUE); else - gtk_tree_view_collapse_row (tree_view, cursor_path); + gtk_tree_view_real_collapse_row (tree_view, cursor_path, tree, node, TRUE); gtk_tree_path_free (cursor_path); }