From b1fc18d941188bee80efddd037758a17ac94bd3b Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 24 Jan 2024 10:11:24 +0100 Subject: [PATCH] WIP: GtkWidget *my_expander = gtk_expander_new (my_expander); < OK --- src/ui/sand_box.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ui/sand_box.c b/src/ui/sand_box.c index 5683386..1a6ca1f 100644 --- a/src/ui/sand_box.c +++ b/src/ui/sand_box.c @@ -180,11 +180,19 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box) GtkWidget *my_tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (my_list_store)); GtkCellRenderer *my_renderer = gtk_cell_renderer_text_new (); + gtk_tree_store_set (G_OBJECT (my_renderer), "foreground", "green", NULL); + gtk_list_store_set (G_OBJECT (my_renderer), "foreground", "red", NULL); + GtkTreeViewColumn *my_column = gtk_tree_view_column_new_with_attributes ("column title", my_renderer, NULL); + // the example is : column = gtk_tree_view_column_new_with_attributes ("Author", renderer, "text", AUTHOR_COLUMN, NULL); + // gtk_tree_view_append_column (GTK_TREE_VIEW (my_tree_view), my_column); gtk_tree_store_set (my_list_store, &child_iter, my_column, "zero", -1); gtk_tree_view_append_column (GTK_TREE_VIEW (my_tree_view), my_column); gtk_tree_store_set (my_list_store, &child_iter, my_column, "one", -1); gtk_tree_view_append_column (GTK_TREE_VIEW (my_tree_view), my_column); gtk_tree_store_set (my_list_store, &child_iter, my_column, "two", -1); + GtkWidget *my_expander = gtk_expander_new ("my_expander"); + printf("%s\n", gtk_expander_get_label (my_expander)); + // GtkWidget my_column = *gtk_column_view_new (my_selection_model); /* GtkWidget *treeview; */ /* treeview = gtk_tree_view_new_with_model (my_selection_model); */ @@ -193,7 +201,7 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box) /* COLUMN_DESCRIPTION); */ GtkWidget *my_list_view = gtk_list_view_new (GTK_SELECTION_MODEL (my_selection_model), my_list_item_factory); - gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (in_that_box), my_tree_view); // instead of my_list_view + gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (in_that_box), my_tree_view); // use my_tree_view instead of my_list_view } @@ -224,5 +232,6 @@ void on_activate_window_creation (GtkApplication *app, gpointer data) { // GtkColumnView // // https://toshiocp.github.io/Gtk4-tutorial/sec29.html https://docs.gtk.org/gtk4/section-tree-widget.html +// https://www.typeerror.org/docs/gtk~4.0/ https://www.typeerror.org/docs/gtk~4.0/gtktreemodel // https://docs.gtk.org/#user-interface https://docs.gtk.org/gtk4/ https://docs.gtk.org/glib/ https://docs.gtk.org/gio/