WIP: toujours perdu entre stack, stack_child et stack_page (les noms sont mal choisis)

This commit is contained in:
Jean Sirmai 2024-06-19 10:24:35 +02:00
parent 6adcdc7d96
commit 270b2feba5
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 8 additions and 5 deletions

View File

@ -168,28 +168,31 @@ void window_header_bar (GtkWindow *main_window, char *title){
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
gtk_window_set_titlebar (main_window, header_bar); gtk_window_set_titlebar (main_window, header_bar);
gpointer no_local_data = NULL;
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ()); GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic"); gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-performance-symbolic"); gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-performance-symbolic");
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), no_local_data); g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), NULL);
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | ")); GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
// https://docs.gtk.org/gtk4/class.Stack.html // https://docs.gtk.org/gtk4/class.Stack.html
GtkWidget *a_stack = gtk_stack_new ();
GtkWidget *a_switcher = gtk_stack_switcher_new (); GtkWidget *a_switcher = gtk_stack_switcher_new ();
GtkWidget *a_stack = gtk_stack_new ();
GtkStackPage* stack_child_space = gtk_stack_add_child (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box()));
GtkStackPage* stack_child_rules = gtk_stack_add_child (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new()));
GtkStackPage* stack_child_data = gtk_stack_add_child (GTK_STACK (a_stack), GTK_WIDGET (get_measures_page_new()));
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (a_switcher), GTK_STACK (a_stack)); gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (a_switcher), GTK_STACK (a_stack));
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box()), "a_name", "space"); gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box()), "a_name", "space");
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new()), "another_name", "rules"); gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new()), "another_name", "rules");
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_measures_page_new()), "a_third_name", "data analysis"); gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_measures_page_new()), "a_third_name", "data analysis");
// gtk_stack_page_set_visible (*self, TRUE); // gtk_stack_page_set_visible (*self, TRUE);
// gtk_window_set_child (main_window, GTK_WIDGET (gtk_stack_get_visible_child (GTK_STACK (a_stack))));
gtk_stack_set_visible_child (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box())); gtk_stack_set_visible_child (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box()));
gtk_stack_set_visible_child (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new())); gtk_stack_set_visible_child (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new()));
gtk_widget_set_visible (GTK_WIDGET (get_edit_rules_page_new()), TRUE);
gtk_window_set_child (main_window, GTK_WIDGET (gtk_stack_get_visible_child (GTK_STACK (a_stack))));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));