WIP: ... et ajoutons-lui des boutons
This commit is contained in:
parent
2b18424169
commit
dcbc47e7a4
21
callback.c
21
callback.c
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
#include "callback.h"
|
||||
#include "tree.h"
|
||||
#include "contain.h"
|
||||
#include "dialog.h"
|
||||
|
@ -15,12 +16,6 @@
|
|||
|
||||
static GtkWindow *main_window, *dialog_window;
|
||||
|
||||
void on_dialog_window_activation (GtkApplication *app, gpointer no_user_data)
|
||||
{
|
||||
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||
dialog_window_design (main_window, dialog_window);
|
||||
}
|
||||
|
||||
void on_main_window_activation (GtkApplication *app, gpointer no_user_data)
|
||||
{
|
||||
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||
|
@ -28,6 +23,12 @@ void on_main_window_activation (GtkApplication *app, gpointer no_user_data)
|
|||
g_signal_connect (app, "activate", G_CALLBACK (on_dialog_window_activation), main_window);
|
||||
}
|
||||
|
||||
void on_dialog_window_activation (GtkApplication *app, gpointer no_user_data)
|
||||
{
|
||||
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||
dialog_window_design (main_window, dialog_window);
|
||||
}
|
||||
|
||||
|
||||
void on_auto_notification (const char *message)
|
||||
{
|
||||
|
@ -194,3 +195,11 @@ void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointe
|
|||
// gtk_button_set_label (GTK_BUTTON (btt_toggle_observ_interpret), "observe");
|
||||
// gtk_button_set_label (GTK_BUTTON (btt_toggle_observ_interpret), "interpret");
|
||||
}
|
||||
|
||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
||||
printf("SAVE_CURRENT_MODEL_BEFORE_EDITING (callback.c - line 200)\n");
|
||||
}
|
||||
|
||||
void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
||||
printf("DISCARD_CURRENT_MODEL_AND_START_EDITING (callback.c - line 204)\n");
|
||||
}
|
||||
|
|
|
@ -14,11 +14,12 @@ void on_glarea_unrealize (GtkWidget *widget);
|
|||
|
||||
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data);
|
||||
|
||||
void on_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data);
|
||||
void on_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, GtkWidget *btt_run_stop_model_exec);
|
||||
void on_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data);
|
||||
void on_toggle_state_rules (GtkWidget *btt_toggle_state_rules, gpointer data);
|
||||
void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, 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);
|
||||
|
||||
|
||||
|
||||
|
|
21
dialog.c
21
dialog.c
|
@ -12,16 +12,25 @@
|
|||
/* doc : see > on_dialog_window_activation (...) in callback.c */
|
||||
|
||||
void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){
|
||||
char *title = " Should I save the current model before editing ? ";
|
||||
char *title = " Do I need to save the current model before modifying it? ";
|
||||
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);
|
||||
|
||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
GtkButton *click = GTK_BUTTON (gtk_button_new_with_label ("click me !"));
|
||||
gtk_box_append (page_box, GTK_WIDGET (click));
|
||||
// gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_window_set_child (dialog_window, GTK_WIDGET (page_box));
|
||||
GtkBox *YES_NO_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 400));
|
||||
// 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 *click_yes = GTK_BUTTON (gtk_button_new_with_label ("YES"));
|
||||
g_signal_connect (click_yes, "clicked", G_CALLBACK (on_SAVE_CURRENT_MODEL_BEFORE_EDITING), NULL);
|
||||
gtk_box_append (YES_NO_box, GTK_WIDGET (click_yes));
|
||||
|
||||
// gtk_box_append (YES_NO_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
||||
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), NULL);
|
||||
gtk_box_append (YES_NO_box, GTK_WIDGET (click_no));
|
||||
gtk_window_set_child (dialog_window, GTK_WIDGET (YES_NO_box));
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window));
|
||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE);
|
||||
|
|
Loading…
Reference in New Issue