WIP: créons donc cette fenêtre de dialogue.
This commit is contained in:
parent
5133d672fd
commit
2b18424169
34
callback.c
34
callback.c
|
@ -9,43 +9,37 @@
|
|||
#include "parsing.h"
|
||||
#include "graph_area.h"
|
||||
|
||||
/******************************************************************************/
|
||||
/* W I N D O W S A C T I V A T I O N */
|
||||
/******************************************************************************/
|
||||
|
||||
static GtkWindow *main_window, *dialog_window;
|
||||
|
||||
/******************************************************************************/
|
||||
/* M A I N W I N D O W A C T I V A T I O N */
|
||||
/******************************************************************************/
|
||||
void on_main_window_activation (GtkApplication *self, gpointer user_data)
|
||||
void on_dialog_window_activation (GtkApplication *app, gpointer no_user_data)
|
||||
{
|
||||
main_window = GTK_WINDOW (gtk_application_window_new (self));
|
||||
window_main_child (main_window, 0); // 0 is the state page (see contain.c)
|
||||
window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||
dialog_window_design (main_window, dialog_window);
|
||||
}
|
||||
|
||||
void on_dialog_window_activation (GtkApplication *self, gpointer user_data)
|
||||
void on_main_window_activation (GtkApplication *app, gpointer no_user_data)
|
||||
{
|
||||
dialog_window = GTK_WINDOW (gtk_application_window_new (self));
|
||||
dialog_window_child (dialog_window,0); // 0 is the state page (see contain.c)
|
||||
dialog_window_header_bar (dialog_window, "dialog window");
|
||||
// gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE);
|
||||
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_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE
|
||||
gtk_window_present (GTK_WINDOW (dialog_window));
|
||||
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||
main_window_design (main_window);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (on_dialog_window_activation), main_window);
|
||||
}
|
||||
|
||||
|
||||
void on_auto_notification (const char *message)
|
||||
{
|
||||
/* Ignored (2024-06-06) because I don't know how to get "main_window" easily
|
||||
|
||||
if (window->toast_revealer == NULL) {
|
||||
g_printerr("Can't find self->toast_overlay !\n");
|
||||
g_printerr("Can't find app->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->toast_text == NULL) {
|
||||
g_printerr("Can't find self->toast_overlay !\n");
|
||||
g_printerr("Can't find app->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
void on_main_window_activation (GtkApplication *app, gpointer user_data);
|
||||
void on_dialog_window_activation (GtkApplication *self, gpointer user_data);
|
||||
void on_dialog_window_activation (GtkApplication *app, gpointer user_data);
|
||||
void on_auto_notification (const char *message);
|
||||
|
||||
void on_user_tree_expander_toggled (GtkExpander *expander, gpointer user_data);
|
||||
|
|
|
@ -209,6 +209,12 @@ void window_main_child (GtkWindow *main_window, int selected_page){
|
|||
}
|
||||
}
|
||||
|
||||
void main_window_design (GtkWindow *main_window){
|
||||
window_main_child (main_window, 0); // 0 is the state page
|
||||
window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@ MyApplication *my_application_new (const char *application_id, GApplicationFlags
|
|||
G_END_DECLS
|
||||
*/
|
||||
|
||||
void window_header_bar (GtkWindow *window, char *title);
|
||||
void window_main_child (GtkWindow *window, int selected_page);
|
||||
void main_window_design (GtkWindow *main_window);
|
||||
void two_notebooks_in_two_panes (GtkWindow *window);
|
||||
GtkWidget *get_selected_rules_vpaned_new();
|
||||
GtkFrame *get_frame_with_label();
|
||||
|
|
20
dialog.c
20
dialog.c
|
@ -9,11 +9,25 @@
|
|||
|
||||
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
||||
|
||||
/* doc : see > on_dialog_window_activation (...) in callback.c */
|
||||
|
||||
void dialog_window_child (GtkWindow *dialog_window, int selected_page){}
|
||||
|
||||
void dialog_window_header_bar (GtkWindow *dialog_window, char *title){
|
||||
void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){
|
||||
char *title = " Should I save the current model before editing ? ";
|
||||
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));
|
||||
|
||||
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_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE
|
||||
// gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE);
|
||||
gtk_window_present (GTK_WINDOW (dialog_window));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue