On treeviews and custom treemodels again



Hi !

After some investigation here are my conclusions :

When one's implements its own GtkTreeModel, he has 2 solutions to tell the cell_renderers what to "render" :

1. put a property on the object which is given in the GValue given by
gtk_tree_model_get_value 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeModel.html#gtk-tree-model-get-value> (GtkTreeModel 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeModel.html> *tree_model,
                         GtkTreeIter 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeModel.html#GtkTreeIter> *iter,
                         gint <http://wallis/docs/linux/gtk/reference/gtk/glib/glib-Basic-Types.html#gint> 
column,
                         GValue 
<http://wallis/docs/linux/gtk/reference/gtk/gobject/gobject-Generic-values.html#GValue> *value);

2. use a void (*GtkTreeCellDataFunc 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeViewColumn.html#GtkTreeCellDataFunc>) (GtkTreeViewColumn 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeViewColumn.html> *tree_column,
                                     GtkCellRenderer 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkCellRenderer.html> *cell,
                                     GtkTreeModel 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeModel.html> *tree_model,
                                     GtkTreeIter 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeModel.html#GtkTreeIter> *iter,
                                     gpointer 
<http://wallis/docs/linux/gtk/reference/gtk/glib/glib-Basic-Types.html#gpointer> data);

Now the problem is that when you use the second solution, you cannot control the layout of the cell_renderers for on column (you only have one function to set it :

     gtk_tree_view_column_set_cell_data_func () )


Now my problem is that I want to 2 cell renderers and for the FIRST one, I want to put the boolean expand of the function

void        gtk_tree_view_column_pack_start 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeViewColumn.html#gtk-tree-view-column-pack-start> 
(GtkTreeViewColumn <http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeViewColumn.html> *tree_column,
                                            GtkCellRenderer 
<http://wallis/docs/linux/gtk/reference/gtk/html/GtkCellRenderer.html> *cell,
                                            gboolean 
<http://wallis/docs/linux/gtk/reference/gtk/glib/glib-Basic-Types.html#gboolean> expand);

to FALSE and I cannot do it with the solution 2. because the way to provide this boolean does not exists in 
the API :-(

So I should use solution 2 BUT :
I do not want to put properties specific to gui stuff on my data model so I should introduce an Object returned by gtk_tree_model_get_value <http://wallis/docs/linux/gtk/reference/gtk/html/GtkTreeModel.html#gtk-tree-model-get-value> which contains the real object
Is there a solution that I do not see to solve my problem ?

Denis




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