GtkTreeView comments
- From: Brian Cameron <Brian Cameron Sun COM>
- To: gtk-devel-list gnome org
- Subject: GtkTreeView comments
- Date: Mon, 11 Jun 2001 16:37:03 +0100 (BST)
Gtk Experts:
I am now working on the ATK interfaces for the GtkTreeView widget when
it is displaying as a GtkListStore.
The interface that I am workin on returns the cell value given the
row/column table coordinates (of the GtkTreeView, not the coordinates
of the GtkTreeModel).
I found that there is no easy way to get the GtkTreeModel column number
given the GtkTreeView column number. I found that I had to get the
GtkTreeViewColumn structure and dig through its "attributes" to get
this information. It seemed like there should be an access function for
returning this information. Or am I wrong here?
I also notice that there isn't a GtkTreeView function that returns
the number of columns in the view. In order to calculate this I have
to call gtk_tree_view_get_columns() and loop through the whole linked
list to count the number of rows. Wouldn't it be nice if the
tree_view->priv->n_columns value were somehow accessible.
Anyway, this is the code I had to write in order to get the value for
a call given the x,y coordinates of the TreeView. I'd appreciate it
if anyone could let me know if there is a more efficient way of doing
this.
{
GtkTreePath *tree_path;
GtkTreeIter iter;
GtkTreeViewColumn *tv_col;
GValue *value, val;
value = &val;
tree_path = gtk_tree_path_new();
gtk_tree_path_append_index(tree_path, row);
gtk_tree_model_get_iter(model, &iter, tree_path);
tv_col = gtk_tree_view_get_column(view, column);
if (tv_col != NULL)
{
GSList *list;
list = tv_col->attributes;
while (list && list->next)
{
memset (value, 0, sizeof (value));
gtk_tree_model_get_value(model, &iter,
GPOINTER_TO_INT(list->next->data), value);
/* now i have the value and can process it */
list = list->next->next;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]