WIP: même fenêtre dialogue avec grille (( ;- )

This commit is contained in:
Jean Sirmai 2024-06-12 15:38:21 +02:00
parent d1918a0d0b
commit daf5831cce
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 14 additions and 16 deletions

View File

@ -13,33 +13,31 @@
/* doc : see > on_dialog_window_activation (...) in callback.c */ /* doc : see > on_dialog_window_activation (...) in callback.c */
void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){ void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){
char *title = " Do I need to save the current model before modifying it? "; char *title = " Save the current model before modifying it? ";
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 (dialog_window, header_bar); gtk_window_set_titlebar (dialog_window, header_bar);
GtkBox *YES_NO_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 400)); GtkWidget *dialog_window_grid = gtk_grid_new ();
// gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL);
// gtk_box_layout_set_homogeneous (GTK_BOX (YES_NO_box), TRUE);
// gtk_box_set_baseline_position (YES_NO_box, GTK_BASELINE_POSITION_CENTER);
GtkButton *action_save_current_model = GTK_BUTTON (gtk_button_new_with_label ("SAVE THE CURRENT MODEL")); const char *txt = " SAVE CURRENT MODEL ";
GtkButton *action_save_current_model = GTK_BUTTON (gtk_button_new_with_label (txt));
gtk_widget_set_sensitive (GTK_WIDGET (action_save_current_model), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (action_save_current_model), FALSE);
g_signal_connect (action_save_current_model, "clicked", G_CALLBACK (on_WRITE_CURRENT_MODEL), dialog_window); g_signal_connect (action_save_current_model, "clicked",
G_CALLBACK (on_WRITE_CURRENT_MODEL), dialog_window);
GtkButton *click_yes = GTK_BUTTON (gtk_button_new_with_label ("YES")); GtkButton *click_yes = GTK_BUTTON (gtk_button_new_with_label ("YES"));
g_signal_connect (click_yes, "clicked", G_CALLBACK (on_SAVE_CURRENT_MODEL_BEFORE_EDITING), action_save_current_model); g_signal_connect (click_yes, "clicked",
gtk_box_append (YES_NO_box, GTK_WIDGET (click_yes)); G_CALLBACK (on_SAVE_CURRENT_MODEL_BEFORE_EDITING), action_save_current_model);
GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO")); GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO"));
g_signal_connect (click_no, "clicked", G_CALLBACK (on_DISCARD_CURRENT_MODEL_AND_START_EDITING), dialog_window); g_signal_connect (click_no, "clicked",
gtk_box_append (YES_NO_box, GTK_WIDGET (click_no)); G_CALLBACK (on_DISCARD_CURRENT_MODEL_AND_START_EDITING), dialog_window);
GtkBox *WINDOW_CHILD_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_yes), 0, 0, 1, 1) ;
gtk_box_append (WINDOW_CHILD_box, GTK_WIDGET (YES_NO_box)); gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_no), 1, 0, 1, 1) ;
gtk_box_append (WINDOW_CHILD_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (action_save_current_model), 0, 2, 2, 1) ;
gtk_box_append (WINDOW_CHILD_box, GTK_WIDGET (action_save_current_model)); gtk_window_set_child (GTK_WINDOW (dialog_window), GTK_WIDGET (dialog_window_grid));
gtk_window_set_child (dialog_window, GTK_WIDGET (WINDOW_CHILD_box));
gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window)); gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE);