[gtk+/treeview-refactor] Make gtk_tree_view_get_cell_area() aware of row separators
- From: Kristian Rietveld <kristian src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/treeview-refactor] Make gtk_tree_view_get_cell_area() aware of row separators
- Date: Sun, 12 Dec 2010 14:24:01 +0000 (UTC)
commit cbfc3f5bf03e837d00c90cc428d24c020af7ace1
Author: Kristian Rietveld <kris gtk org>
Date: Sun Dec 12 15:09:27 2010 +0100
Make gtk_tree_view_get_cell_area() aware of row separators
gtk/gtktreeview.c | 19 +++++++++++++++----
gtk/tests/treeview.c | 7 +++++--
2 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 995c55e..fd010fd 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 b59537d..fe42095 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]