gem-graph-client/wip/learning how to add a menu.txt

25 lines
1.1 KiB
Plaintext

static void *user_data_free_func() {return NULL;}
void learning_how_to_create_a_menu (GtkMenuButton* menu_button) { // Je veux que ce bouton ouvre un menu.
char *array[] = {"one", "two", "three", "four", NULL};
GtkStringList *list = gtk_string_list_new ((const char * const *) array);
printf ("labo.learning_how_to_create_a_menu () > list [3] = %s\n", gtk_string_list_get_string (list, 2));
GtkWidget* list_box = gtk_list_box_new ();
gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (list));
gtk_list_box_bind_model (GTK_LIST_BOX (list_box),
NULL, // GListModel* model,
NULL, // GtkListBoxCreateWidgetFunc create_widget_func,
NULL, // gpointer user_data,
(*user_data_free_func) (NULL) // GDestroyNotify user_data_free_func
);
// https://docs.gtk.org/gtk4/class.ListView.html
// https://toshiocp.github.io/Gtk4-tutorial/sec29.html
// https://blog.gtk.org/2020/06/07/scalable-lists-in-gtk-4/
// https://docs.gtk.org/gtk4/class.ListBox.html
}