2024-06-11 00:11:50 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <gtk-4.0/gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "callback.h"
|
2024-06-11 22:01:44 +02:00
|
|
|
#include "automaton.h"
|
2024-06-11 00:11:50 +02:00
|
|
|
#include "display.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "texts.h"
|
|
|
|
|
|
|
|
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
2024-06-11 22:01:44 +02:00
|
|
|
// GTK_ORIENTATION_HORIZONTAL GTK_ORIENTATION_VERTICAL
|
2024-06-11 00:11:50 +02:00
|
|
|
|
2024-06-11 16:39:40 +02:00
|
|
|
/* doc : see > on_dialog_window_activation (...) in callback.c */
|
2024-06-11 00:11:50 +02:00
|
|
|
|
2024-06-11 16:39:40 +02:00
|
|
|
void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){
|
2024-06-12 15:38:21 +02:00
|
|
|
char *title = " Save the current model before modifying it? ";
|
2024-06-11 00:11:50 +02:00
|
|
|
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_window_set_titlebar (dialog_window, header_bar);
|
2024-06-11 16:39:40 +02:00
|
|
|
|
2024-06-12 15:38:21 +02:00
|
|
|
GtkWidget *dialog_window_grid = gtk_grid_new ();
|
2024-06-11 19:20:44 +02:00
|
|
|
|
2024-06-12 15:38:21 +02:00
|
|
|
const char *txt = " SAVE CURRENT MODEL ";
|
|
|
|
GtkButton *action_save_current_model = GTK_BUTTON (gtk_button_new_with_label (txt));
|
2024-06-11 22:49:42 +02:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (action_save_current_model), FALSE);
|
2024-06-12 15:38:21 +02:00
|
|
|
g_signal_connect (action_save_current_model, "clicked",
|
|
|
|
G_CALLBACK (on_WRITE_CURRENT_MODEL), dialog_window);
|
2024-06-11 22:49:42 +02:00
|
|
|
|
2024-06-11 19:20:44 +02:00
|
|
|
GtkButton *click_yes = GTK_BUTTON (gtk_button_new_with_label ("YES"));
|
2024-06-12 15:38:21 +02:00
|
|
|
g_signal_connect (click_yes, "clicked",
|
|
|
|
G_CALLBACK (on_SAVE_CURRENT_MODEL_BEFORE_EDITING), action_save_current_model);
|
2024-06-11 19:20:44 +02:00
|
|
|
|
|
|
|
GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO"));
|
2024-06-12 15:38:21 +02:00
|
|
|
g_signal_connect (click_no, "clicked",
|
|
|
|
G_CALLBACK (on_DISCARD_CURRENT_MODEL_AND_START_EDITING), dialog_window);
|
|
|
|
|
|
|
|
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_yes), 0, 0, 1, 1) ;
|
|
|
|
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_no), 1, 0, 1, 1) ;
|
|
|
|
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (action_save_current_model), 0, 2, 2, 1) ;
|
|
|
|
gtk_window_set_child (GTK_WINDOW (dialog_window), GTK_WIDGET (dialog_window_grid));
|
2024-06-11 16:39:40 +02:00
|
|
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window));
|
|
|
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE);
|
2024-06-12 00:16:45 +02:00
|
|
|
gtk_window_set_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE
|
2024-06-11 22:49:42 +02:00
|
|
|
gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE);
|
2024-06-11 16:39:40 +02:00
|
|
|
gtk_window_present (GTK_WINDOW (dialog_window));
|
2024-06-11 00:11:50 +02:00
|
|
|
}
|
2024-06-11 16:39:40 +02:00
|
|
|
|
|
|
|
|