diff --git a/callback.c b/callback.c index 604d4fb..868a628 100644 --- a/callback.c +++ b/callback.c @@ -180,20 +180,24 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN set_mode (0); } else { gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic"); - gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "emblem-ok-symbolic"); // Transport Steam Engine !! + gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "emblem-ok-symbolic"); // Transport Steam Engine !! gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), FALSE); set_mode (1); } } + + + + void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) { printf("on_open_STATE status = %d\n", get_status ()); printf("gtk_check_button_get_active > after = %d, %d, %d from callback : on_open_STATE()\n",\ - gtk_check_button_get_active (get_GtkButton ("state")), // (GTK_CHECK_BUTTON (btt_open_STATE)), - gtk_check_button_get_active (get_GtkButton ("rules")), // (GTK_CHECK_BUTTON (btt_open_RULES)), - gtk_check_button_get_active (get_GtkButton ("data analysis"))); // (GTK_CHECK_BUTTON (btt_open_DATA))); + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))), // (GTK_CHECK_BUTTON (btt_open_STATE)), + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))), // (GTK_CHECK_BUTTON (btt_open_RULES)), + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))); // (GTK_CHECK_BUTTON (btt_open_DATA))); - if (! gtk_check_button_get_active (get_GtkButton ("state"))) window_main_child (main_window, STATE); + if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state")))) window_main_child (main_window, STATE); }// SWITCH_TO (STATE);} void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) { @@ -202,10 +206,30 @@ void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) { }// SWITCH_TO (RULES);} void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) { - printf("on_open_DATA status = %d\n", get_status ()); + printf("on_open_DATA status = %d\n", get_status ()); window_main_child (main_window, DATA); }// SWITCH_TO (DATA);} + + + + +void on_toggle_STATE_RULES_DATA (GtkToggleButton *source, gpointer user_data) { + // https://docs.gtk.org/gtk4/class.ToggleButton.html < f..k ! bad code ++ + // g_print ("Toggle button [%s] is active: %s\n", gtk_button_get_label (GTK_BUTTON (source)), gtk_toggle_button_get_active (source) ? "Yes" : "No"); + int choice = 0; + switch (choice) { + case (STATE): get_GtkButton ("state"); break; // get_window_child_STATE (); + case (RULES): get_GtkButton ("rules"); break; // get_window_child_RULES (); break; + case (DATA): get_GtkButton ("data analysis"); break; // get_window_child_DATA (); break; + default : get_GtkButton ("state"); break; // get_window_child_STATE (); + } +} + + + + + void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) { gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE); printf ("callback.c (line 201) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n"); diff --git a/callback.h b/callback.h index ac26745..79025dd 100644 --- a/callback.h +++ b/callback.h @@ -24,4 +24,4 @@ void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data); void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data); - +void on_toggle_STATE_RULES_DATA (GtkToggleButton *source, gpointer user_data); diff --git a/contain.c b/contain.c index 1e38679..32b4526 100644 --- a/contain.c +++ b/contain.c @@ -222,9 +222,9 @@ void window_header_bar (GtkWindow *window, char *title){ // gtk_check_button_set_active (GTK_CHECK_BUTTON (get_GtkButton ("state")), TRUE); printf("gtk_check_button_get_active > after = %d, %d, %d\n",\ - gtk_check_button_get_active (get_GtkButton ("state")), // (GTK_CHECK_BUTTON (btt_open_STATE)), - gtk_check_button_get_active (get_GtkButton ("rules")), // (GTK_CHECK_BUTTON (btt_open_RULES)), - gtk_check_button_get_active (get_GtkButton ("data analysis"))); // (GTK_CHECK_BUTTON (btt_open_DATA))); + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))), // (GTK_CHECK_BUTTON (btt_open_STATE)), + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))), // (GTK_CHECK_BUTTON (btt_open_RULES)), + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))); // (GTK_CHECK_BUTTON (btt_open_DATA))); 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_MODEL_RUN_STOP)); // << pas ici ! TODO @@ -233,7 +233,8 @@ void window_header_bar (GtkWindow *window, char *title){ gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_RULES)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_DATA)); -// icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme + + icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme // https://iconduck.com/sets/carbon-icons < pas mal ... // ma préférée : Transport Steam Engine Icon mais : [ process icon ] semble un bon choix... }