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.
This commit is contained in:
Kristian Rietveld 2009-08-27 18:09:17 +02:00
parent 786b3914cd
commit ec7187e039

View File

@ -4572,78 +4572,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)
@ -4717,6 +4645,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) &&
@ -4730,6 +4731,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
&event->area,
flags);
}
cell_offset += column->width;
}