[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

GtkTreeView total height.



Hi all!

I'd need to compute the total height of a treeview based on the
amount of rows its model has.  I've tried with the following
code but I had to set some constants that obviously works in my
specific setting but I would like to know to what correspond
that unknowns.

Thanks in advance.

Here the code:

-----------------------------------------------------------------

static guint
get_row_height (GtkTreeView  *tree_view)
{
	
	guint row_height = 0;
	
	GList *columns = gtk_tree_view_get_columns (tree_view);
	
	GList *current = columns;
	while (current) {
		GtkTreeViewColumn *renderers = gtk_tree_view_column_get_cell_renderers
			((GtkTreeViewColumn *) current->data);
		
		guint cell_height = 0;
		
		GList *current1 = renderers;
		while (current1) {
			GtkCellRenderer *renderer = (GtkCellRenderer *) current1->data;
			
			guint height;
			
			gtk_cell_renderer_get_size (renderer, GTK_TREE_VIEW(tree_view),
						    NULL, NULL, NULL, NULL, &height);
			
			if (height > cell_height)
				cell_height = height;
			
			current1 = g_list_next (current1);
		}
		
		g_list_free (renderers);
		
		if (cell_height > row_height)
			row_height = cell_height;
		
		current = g_list_next (current);
	}
	g_list_free (columns);
	
	row_height += 4;  /* horizontal-separator ? */
	
	return row_height;
}

---
	
	gint grid_height = n_rows * get_row_height (tree_view)
		+ 35;  /* header height ? */
---

-----------------------------------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]