WIP: j'apprivoise : gtk_tree_list_model_new(...) dans l'espoir d'ajouter des enfants à des items de ma liste
This commit is contained in:
parent
667a9c83c7
commit
393f3d81ba
|
@ -67,9 +67,9 @@ static void on_selection_change (GtkStringList *my_selection_model, guint posit
|
||||||
nombre d'éléments ayant changé d'état = %2d\n",
|
nombre d'éléments ayant changé d'état = %2d\n",
|
||||||
g_list_model_get_n_items (G_LIST_MODEL (my_selection_model)),
|
g_list_model_get_n_items (G_LIST_MODEL (my_selection_model)),
|
||||||
g_list_model_get_item_type(G_LIST_MODEL (my_selection_model)),
|
g_list_model_get_item_type(G_LIST_MODEL (my_selection_model)),
|
||||||
position,
|
position, "debug", 0);
|
||||||
gtk_string_list_get_string (my_selection_model, position),
|
/* gtk_string_list_get_string (my_selection_model, position), // GTK_STRING_LIST ? */
|
||||||
n_items );
|
/* n_items ); */
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -85,8 +85,8 @@ GListModel *my_item_create_func (gpointer item, gpointer user_data)
|
||||||
|
|
||||||
if (strcmp(gtk_string_object_get_string(item), "zero")) {
|
if (strcmp(gtk_string_object_get_string(item), "zero")) {
|
||||||
GtkWidget *my_expander = gtk_expander_new (NULL);
|
GtkWidget *my_expander = gtk_expander_new (NULL);
|
||||||
/* gtk_expander_set_child (GTK_EXPANDER(my_expander), NULL); */
|
gtk_expander_set_child (GTK_EXPANDER(my_expander), NULL);
|
||||||
/* on_activating_this_expander (GTK_EXPANDER(my_expander), NULL); */
|
on_activating_this_expander (GTK_EXPANDER(my_expander), NULL);
|
||||||
return G_LIST_MODEL (my_child_string_list);
|
return G_LIST_MODEL (my_child_string_list);
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return NULL;
|
||||||
|
@ -105,15 +105,15 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box)
|
||||||
GtkListItemFactory *my_list_item_factory = gtk_signal_list_item_factory_new ();
|
GtkListItemFactory *my_list_item_factory = gtk_signal_list_item_factory_new ();
|
||||||
g_signal_connect (my_list_item_factory, "setup", G_CALLBACK (on_setup_cb), NULL);
|
g_signal_connect (my_list_item_factory, "setup", G_CALLBACK (on_setup_cb), NULL);
|
||||||
g_signal_connect (my_list_item_factory, "bind", G_CALLBACK (on_bind_cb), NULL);
|
g_signal_connect (my_list_item_factory, "bind", G_CALLBACK (on_bind_cb), NULL);
|
||||||
if (1) { g_signal_connect (G_LIST_MODEL (my_string_list), "selection-changed", G_CALLBACK (on_selection_change), NULL);}
|
if (1) { g_signal_connect (my_selection_model, "selection-changed", G_CALLBACK (on_selection_change), NULL);}
|
||||||
|
|
||||||
|
|
||||||
// GListModel *(* GtkTreeListModelCreateModelFunc) (GObject* item, gpointer user_data) // remplacerait gtk_string_list_new() ?
|
// GListModel *(* GtkTreeListModelCreateModelFunc) (GObject* item, gpointer user_data) // remplacerait gtk_string_list_new() ?
|
||||||
// https://docs.gtk.org/gtk4/callback.TreeListModelCreateModelFunc.html
|
// https://docs.gtk.org/gtk4/callback.TreeListModelCreateModelFunc.html
|
||||||
// https://docs.gtk.org/gtk4/method.TreeListRow.set_expanded.html
|
// https://docs.gtk.org/gtk4/method.TreeListRow.set_expanded.html
|
||||||
|
|
||||||
GtkTreeListModel *my_tree_list_model = gtk_tree_list_model_new (my_selection_model, 1, 1, my_item_create_func, NULL, NULL);
|
GtkTreeListModel *my_tree_list_model = gtk_tree_list_model_new (G_LIST_MODEL (my_string_list), 1, 0, my_item_create_func, NULL, NULL); // my_string_list my_selection_model
|
||||||
int rank = 0; printf("in : GListModel *item_create_func (gpointer item,...) (line 80) (item n°%d is %s)\n",
|
int rank = 1; printf("in : GListModel *item_create_func (gpointer item,...) (line 80) (item n°%d is %s)\n",
|
||||||
rank, gtk_string_list_get_string (my_string_list, rank));
|
rank, gtk_string_list_get_string (my_string_list, rank));
|
||||||
|
|
||||||
GtkWidget *my_list_view = gtk_list_view_new (GTK_SELECTION_MODEL (my_selection_model), my_list_item_factory);
|
GtkWidget *my_list_view = gtk_list_view_new (GTK_SELECTION_MODEL (my_selection_model), my_list_item_factory);
|
||||||
|
|
Loading…
Reference in New Issue