[gtk+/gtk-2-16] Bug 543310 - set_enable_tree_lines doesn't work when a cellrenderer...
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-16] Bug 543310 - set_enable_tree_lines doesn't work when a cellrenderer...
- Date: Sat, 29 Aug 2009 02:44:33 +0000 (UTC)
commit c72a3976a009b5bf8f5cf718cb94a953df0c8373
Author: Kristian Rietveld <kris gtk org>
Date: Thu Aug 27 18:09:17 2009 +0200
Bug 543310 - set_enable_tree_lines doesn't work when a cellrenderer...
Reorder drawing in gtk_tree_view_bin_expose() so that the tree lines are
drawn after the cells have been drawn. This is because cell-background
is handled in the cell renderer, so the tree lines need to be drawn
after this.
gtk/gtktreeview.c | 146 +++++++++++++++++++++++++++--------------------------
1 files changed, 74 insertions(+), 72 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 3c80f64..c73f439 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -4582,78 +4582,6 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
background_area.y + max_height);
}
- if (gtk_tree_view_is_expander_column (tree_view, column) &&
- tree_view->priv->tree_lines_enabled)
- {
- gint x = background_area.x;
- gint mult = rtl ? -1 : 1;
- gint y0 = background_area.y;
- gint y1 = background_area.y + background_area.height/2;
- gint y2 = background_area.y + background_area.height;
-
- if (rtl)
- x += background_area.width - 1;
-
- if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT
- && depth > 1)
- {
- gdk_draw_line (event->window,
- tree_view->priv->tree_line_gc,
- x + tree_view->priv->expander_size * (depth - 1.5) * mult,
- y1,
- x + tree_view->priv->expander_size * (depth - 1.1) * mult,
- y1);
- }
- else if (depth > 1)
- {
- gdk_draw_line (event->window,
- tree_view->priv->tree_line_gc,
- x + tree_view->priv->expander_size * (depth - 1.5) * mult,
- y1,
- x + tree_view->priv->expander_size * (depth - 0.5) * mult,
- y1);
- }
-
- if (depth > 1)
- {
- gint i;
- GtkRBNode *tmp_node;
- GtkRBTree *tmp_tree;
-
- if (!_gtk_rbtree_next (tree, node))
- gdk_draw_line (event->window,
- tree_view->priv->tree_line_gc,
- x + tree_view->priv->expander_size * (depth - 1.5) * mult,
- y0,
- x + tree_view->priv->expander_size * (depth - 1.5) * mult,
- y1);
- else
- gdk_draw_line (event->window,
- tree_view->priv->tree_line_gc,
- x + tree_view->priv->expander_size * (depth - 1.5) * mult,
- y0,
- x + tree_view->priv->expander_size * (depth - 1.5) * mult,
- y2);
-
- tmp_node = tree->parent_node;
- tmp_tree = tree->parent_tree;
-
- for (i = depth - 2; i > 0; i--)
- {
- if (_gtk_rbtree_next (tmp_tree, tmp_node))
- gdk_draw_line (event->window,
- tree_view->priv->tree_line_gc,
- x + tree_view->priv->expander_size * (i - 0.5) * mult,
- y0,
- x + tree_view->priv->expander_size * (i - 0.5) * mult,
- y2);
-
- tmp_node = tmp_tree->parent_node;
- tmp_tree = tmp_tree->parent_tree;
- }
- }
- }
-
if (gtk_tree_view_is_expander_column (tree_view, column))
{
if (!rtl)
@@ -4727,6 +4655,79 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
&event->area,
flags);
}
+
+ if (gtk_tree_view_is_expander_column (tree_view, column) &&
+ tree_view->priv->tree_lines_enabled)
+ {
+ gint x = background_area.x;
+ gint mult = rtl ? -1 : 1;
+ gint y0 = background_area.y;
+ gint y1 = background_area.y + background_area.height/2;
+ gint y2 = background_area.y + background_area.height;
+
+ if (rtl)
+ x += background_area.width - 1;
+
+ if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT
+ && depth > 1)
+ {
+ gdk_draw_line (event->window,
+ tree_view->priv->tree_line_gc,
+ x + tree_view->priv->expander_size * (depth - 1.5) * mult,
+ y1,
+ x + tree_view->priv->expander_size * (depth - 1.1) * mult,
+ y1);
+ }
+ else if (depth > 1)
+ {
+ gdk_draw_line (event->window,
+ tree_view->priv->tree_line_gc,
+ x + tree_view->priv->expander_size * (depth - 1.5) * mult,
+ y1,
+ x + tree_view->priv->expander_size * (depth - 0.5) * mult,
+ y1);
+ }
+
+ if (depth > 1)
+ {
+ gint i;
+ GtkRBNode *tmp_node;
+ GtkRBTree *tmp_tree;
+
+ if (!_gtk_rbtree_next (tree, node))
+ gdk_draw_line (event->window,
+ tree_view->priv->tree_line_gc,
+ x + tree_view->priv->expander_size * (depth - 1.5) * mult,
+ y0,
+ x + tree_view->priv->expander_size * (depth - 1.5) * mult,
+ y1);
+ else
+ gdk_draw_line (event->window,
+ tree_view->priv->tree_line_gc,
+ x + tree_view->priv->expander_size * (depth - 1.5) * mult,
+ y0,
+ x + tree_view->priv->expander_size * (depth - 1.5) * mult,
+ y2);
+
+ tmp_node = tree->parent_node;
+ tmp_tree = tree->parent_tree;
+
+ for (i = depth - 2; i > 0; i--)
+ {
+ if (_gtk_rbtree_next (tmp_tree, tmp_node))
+ gdk_draw_line (event->window,
+ tree_view->priv->tree_line_gc,
+ x + tree_view->priv->expander_size * (i - 0.5) * mult,
+ y0,
+ x + tree_view->priv->expander_size * (i - 0.5) * mult,
+ y2);
+
+ tmp_node = tmp_tree->parent_node;
+ tmp_tree = tmp_tree->parent_tree;
+ }
+ }
+ }
+
if (node == cursor && has_special_cell &&
((column == tree_view->priv->focus_column &&
GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS) &&
@@ -4740,6 +4741,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
&event->area,
flags);
}
+
cell_offset += column->width;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]