[gtk+] treeview: properly calculate the treeview expander size
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] treeview: properly calculate the treeview expander size
- Date: Fri, 1 Mar 2013 19:09:04 +0000 (UTC)
commit d0895d6c0feb6c6ca14bfc05910926051b2bf63b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Feb 22 19:51:54 2013 -0500
treeview: properly calculate the treeview expander size
It should be expander-size + horizontal-separator / 2. Rework code
calculating the render position of the arrow to account for the larger
size.
https://bugzilla.gnome.org/show_bug.cgi?id=650424
gtk/gtktreeview.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index b47cd42..abde267 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2864,12 +2864,14 @@ static int
gtk_tree_view_get_expander_size (GtkTreeView *tree_view)
{
gint expander_size;
+ gint horizontal_separator;
gtk_widget_style_get (GTK_WIDGET (tree_view),
"expander-size", &expander_size,
+ "horizontal-separator", &horizontal_separator,
NULL);
- return expander_size;
+ return expander_size + (horizontal_separator / 2);
}
static gboolean
@@ -9238,12 +9240,19 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
GList *list;
GtkTreeViewColumn *tmp_column = NULL;
gint total_width;
- gint expander_size;
+ gint expander_size, expander_render_size;
+ gint horizontal_separator;
gboolean indent_expanders;
gboolean rtl;
+ gtk_widget_style_get (GTK_WIDGET (tree_view),
+ "indent-expanders", &indent_expanders,
+ "horizontal-separator", &horizontal_separator,
+ NULL);
+
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
expander_size = gtk_tree_view_get_expander_size (tree_view);
+ expander_render_size = expander_size - (horizontal_separator / 2);
total_width = 0;
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
@@ -9265,9 +9274,6 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
total_width += gtk_tree_view_column_get_width (tmp_column);
}
- gtk_widget_style_get (GTK_WIDGET (tree_view),
- "indent-expanders", &indent_expanders,
- NULL);
if (indent_expanders)
{
@@ -9282,7 +9288,7 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
if (tmp_column &&
gtk_tree_view_column_get_visible (tmp_column))
/* +1 because x2 isn't included in the range. */
- *x2 = *x1 + expander_size + 1;
+ *x2 = *x1 + expander_render_size + 1;
else
*x2 = *x1;
}
@@ -10081,7 +10087,6 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
gint x_offset = 0;
gint x2;
gint vertical_separator;
- gint expander_size;
GtkCellRendererState flags = 0;
widget = GTK_WIDGET (tree_view);
@@ -10090,7 +10095,6 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
gtk_widget_style_get (widget,
"vertical-separator", &vertical_separator,
NULL);
- expander_size = gtk_tree_view_get_expander_size (tree_view);
if (! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT))
return;
@@ -10100,7 +10104,7 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
area.x = x_offset;
area.y = gtk_tree_view_get_cell_area_y_offset (tree_view, tree, node,
vertical_separator);
- area.width = expander_size;
+ area.width = x2 - x_offset;
area.height = gtk_tree_view_get_cell_area_height (tree_view, node,
vertical_separator);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]