summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2010-12-12 15:09:27 +0100
committerKristian Rietveld <kris@gtk.org>2010-12-12 15:09:27 +0100
commitcbfc3f5bf03e837d00c90cc428d24c020af7ace1 (patch)
treeca29432849bc096a65657a39414a0157e5f662b3
parent8c743a0363d014eb41407b826eae61d36ceab3f2 (diff)
downloadgtk+-cbfc3f5bf03e837d00c90cc428d24c020af7ace1.tar.gz
Make gtk_tree_view_get_cell_area() aware of row separators
-rw-r--r--gtk/gtktreeview.c19
-rw-r--r--gtk/tests/treeview.c7
2 files changed, 20 insertions, 6 deletions
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 995c55e4ce..fd010fd74b 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -13604,10 +13604,21 @@ gtk_tree_view_get_cell_area (GtkTreeView *tree_view,
if ((!ret && tree == NULL) || ret)
return;
- rect->y = gtk_tree_view_get_cell_area_y_offset (tree_view, tree, node,
- vertical_separator);
- rect->height = gtk_tree_view_get_cell_area_height (tree_view, node,
- vertical_separator);
+ if (row_is_separator (tree_view, NULL, path))
+ {
+ /* There isn't really a "cell area" for separator, so we
+ * return the y, height values for background area instead.
+ */
+ rect->y = gtk_tree_view_get_row_y_offset (tree_view, tree, node);
+ rect->height = gtk_tree_view_get_row_height (tree_view, node);
+ }
+ else
+ {
+ rect->y = gtk_tree_view_get_cell_area_y_offset (tree_view, tree, node,
+ vertical_separator);
+ rect->height = gtk_tree_view_get_cell_area_height (tree_view, node,
+ vertical_separator);
+ }
if (column &&
gtk_tree_view_is_expander_column (tree_view, column))
diff --git a/gtk/tests/treeview.c b/gtk/tests/treeview.c
index b59537dec5..fe42095530 100644
--- a/gtk/tests/treeview.c
+++ b/gtk/tests/treeview.c
@@ -176,7 +176,7 @@ test_row_separator_height (void)
GtkListStore *store;
GtkWidget *window;
GtkWidget *tree_view;
- GdkRectangle rect;
+ GdkRectangle rect, cell_rect;
store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_list_store_insert_with_values (store, &iter, 0, 0, "Row content", -1);
@@ -201,12 +201,14 @@ test_row_separator_height (void)
NULL);
gtk_container_add (GTK_CONTAINER (window), tree_view);
- gtk_widget_show (window);
+ gtk_widget_show_all (window);
path = gtk_tree_path_new_from_indices (2, -1);
gtk_tree_view_get_background_area (GTK_TREE_VIEW (tree_view),
path, NULL, &rect);
+ gtk_tree_view_get_cell_area (GTK_TREE_VIEW (tree_view),
+ path, NULL, &cell_rect);
gtk_tree_path_free (path);
gtk_widget_style_get (tree_view,
@@ -221,6 +223,7 @@ test_row_separator_height (void)
height = 2 + 2 * focus_pad;
g_assert_cmpint (rect.height, ==, height);
+ g_assert_cmpint (cell_rect.height, ==, height);
gtk_widget_destroy (tree_view);
}