un switcher avec trois 'titled' dans la header_bar (mais rien ne fonctionne encore)
This commit is contained in:
parent
29b09fa771
commit
b40b3e2598
|
@ -174,13 +174,14 @@ void on_toggle_MODEL_RUN_STOP (GtkWidget *btt_MODEL_RUN_STOP, gpointer data) {
|
||||||
|
|
||||||
void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN_STOP) {
|
void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN_STOP) {
|
||||||
if (get_mode()) {
|
if (get_mode()) {
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "power-profile-balanced-rtl-symbolic");
|
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "power-profile-performance-symbolic");
|
||||||
gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " run ");
|
// gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " run ");
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), TRUE);
|
// gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), TRUE);
|
||||||
set_mode (0);
|
set_mode (0);
|
||||||
} else {
|
} else {
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic");
|
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic");
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), FALSE);
|
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "text-editor-symbolic");
|
||||||
|
// gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), FALSE);
|
||||||
set_mode (1);
|
set_mode (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
152
contain.c
152
contain.c
|
@ -159,41 +159,15 @@ void window_header_bar (GtkWindow *window, char *title){
|
||||||
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 (window, header_bar);
|
gtk_window_set_titlebar (window, header_bar);
|
||||||
|
|
||||||
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
|
|
||||||
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
|
|
||||||
|
|
||||||
gpointer no_local_data = NULL;
|
gpointer no_local_data = NULL;
|
||||||
|
|
||||||
GtkButton *btt_MODEL_RUN_STOP = GTK_BUTTON (gtk_button_new_with_label (" run "));
|
|
||||||
g_signal_connect (btt_MODEL_RUN_STOP, "clicked", G_CALLBACK (on_toggle_MODEL_RUN_STOP), no_local_data);
|
|
||||||
|
|
||||||
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
||||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
|
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
|
||||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-symbolic");
|
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-performance-symbolic");
|
||||||
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), btt_MODEL_RUN_STOP);
|
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), no_local_data);
|
||||||
|
|
||||||
// GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
|
||||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe));
|
|
||||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
||||||
|
|
||||||
GtkButton *btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
|
||||||
GtkButton *btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
|
||||||
GtkButton *btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
|
||||||
GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA);
|
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA);
|
|
||||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA);
|
|
||||||
|
|
||||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE);
|
|
||||||
// int selected = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE));
|
|
||||||
// if (0) printf("%d\n", selected);
|
|
||||||
// if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE)))
|
|
||||||
|
|
||||||
// g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_open_STATE), no_local_data);
|
|
||||||
// g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
|
||||||
// g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
|
||||||
|
|
||||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
@ -201,61 +175,32 @@ void window_header_bar (GtkWindow *window, char *title){
|
||||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||||
|
|
||||||
// GObject *a_stack_page = g_object_new (GTK_STACK_PAGE ? );
|
|
||||||
// https://docs.gtk.org/gobject/tutorial.html#how-to-define-and-implement-a-new-gobject
|
|
||||||
|
|
||||||
GtkWidget *a_stack = gtk_stack_new ();
|
GtkWidget *a_stack = gtk_stack_new ();
|
||||||
GtkWidget *a_switcher = gtk_stack_switcher_new ();
|
GtkWidget *a_switcher = gtk_stack_switcher_new ();
|
||||||
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (a_switcher), GTK_STACK (a_stack));
|
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (a_switcher), GTK_STACK (a_stack));
|
||||||
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (page_box), "a_name", "space");
|
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (page_box), "a_name", "space");
|
||||||
|
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new()), "other_name", "rules");
|
||||||
|
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_measures_page_new()), "third_name", "data analysis");
|
||||||
// gtk_stack_page_set_visible (*self, TRUE);
|
// gtk_stack_page_set_visible (*self, TRUE);
|
||||||
|
|
||||||
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_XOR_EXEC_EDIT));
|
||||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP));
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
||||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_STATE));
|
|
||||||
// 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));
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (a_switcher));
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (a_switcher));
|
||||||
|
|
||||||
// icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_main_child (GtkWindow *main_window, int selected_page){
|
void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
/*
|
|
||||||
switch (selected_page) {
|
|
||||||
case (INTER) : //SWITCH_TO (INTER);
|
|
||||||
break;
|
|
||||||
case (STATE) :*/
|
|
||||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||||
// window_main_child_bottom (page_box);
|
|
||||||
// if (!get_mode ()) gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
|
||||||
// else gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
|
|
||||||
gtk_window_set_child (main_window, GTK_WIDGET (page_box));
|
gtk_window_set_child (main_window, GTK_WIDGET (page_box));
|
||||||
//SWITCH_TO (STATE);
|
|
||||||
/* break;
|
|
||||||
case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new()));
|
|
||||||
//SWITCH_TO (RULES);
|
|
||||||
break;
|
|
||||||
case (DATA) : gtk_window_set_child (main_window, GTK_WIDGET (get_measures_page_new()));
|
|
||||||
//SWITCH_TO (DATA);
|
|
||||||
break;
|
|
||||||
case (4) : gtk_window_set_child (main_window, GTK_WIDGET (get_results_page_new())); break;
|
|
||||||
case (5) : gtk_window_set_child (main_window, GTK_WIDGET (get_discuss_page_new())); break;
|
|
||||||
case (6) : gtk_window_set_child (main_window, GTK_WIDGET (get_help_page_new())); break;
|
|
||||||
default : gtk_window_set_child (main_window, GTK_WIDGET (get_SPACE_VIEW_box())); // + un "help message"
|
|
||||||
}
|
|
||||||
// printf ("%d\n", get_status());
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window_design (GtkWindow *main_window){
|
void main_window_design (GtkWindow *main_window){
|
||||||
// window_main_child (main_window, STATE);
|
window_main_child (main_window, STATE);
|
||||||
window_header_bar (main_window,
|
window_header_bar (main_window,
|
||||||
"E coli (with permission from David S. Goodsell, 2009)");
|
"E coli (with permission from David S. Goodsell, 2009)");
|
||||||
gtk_window_present (GTK_WINDOW (main_window));
|
gtk_window_present (GTK_WINDOW (main_window));
|
||||||
|
@ -272,6 +217,8 @@ void main_window_design (GtkWindow *main_window){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
// icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||||
|
|
||||||
static void icons_for_fun (GtkHeaderBar *header_bar)
|
static void icons_for_fun (GtkHeaderBar *header_bar)
|
||||||
{
|
{
|
||||||
GtkButton *go_home = GTK_BUTTON (gtk_button_new ());
|
GtkButton *go_home = GTK_BUTTON (gtk_button_new ());
|
||||||
|
@ -342,4 +289,87 @@ static void icons_for_fun (GtkHeaderBar *header_bar)
|
||||||
gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic");
|
gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic");
|
||||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low));
|
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low));
|
||||||
}
|
}
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
|
||||||
|
Je fais un essai avec un stack_switcher 2024-06-18
|
||||||
|
|
||||||
|
void window_header_bar (GtkWindow *window, char *title){
|
||||||
|
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 (window, header_bar);
|
||||||
|
|
||||||
|
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
|
||||||
|
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
|
||||||
|
|
||||||
|
gpointer no_local_data = NULL;
|
||||||
|
|
||||||
|
GtkButton *btt_MODEL_RUN_STOP = GTK_BUTTON (gtk_button_new_with_label (" run "));
|
||||||
|
g_signal_connect (btt_MODEL_RUN_STOP, "clicked", G_CALLBACK (on_toggle_MODEL_RUN_STOP), no_local_data);
|
||||||
|
|
||||||
|
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
||||||
|
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
|
||||||
|
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-performance-symbolic");
|
||||||
|
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), btt_MODEL_RUN_STOP);
|
||||||
|
|
||||||
|
// GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||||
|
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe));
|
||||||
|
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
||||||
|
|
||||||
|
GtkButton *btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
||||||
|
GtkButton *btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
||||||
|
GtkButton *btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
||||||
|
GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
||||||
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA);
|
||||||
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA);
|
||||||
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA);
|
||||||
|
|
||||||
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE);
|
||||||
|
// int selected = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE));
|
||||||
|
// if (0) printf("%d\n", selected);
|
||||||
|
// if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE)))
|
||||||
|
|
||||||
|
// g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_open_STATE), no_local_data);
|
||||||
|
// g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
||||||
|
// g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
||||||
|
|
||||||
|
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
|
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||||
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||||
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||||
|
|
||||||
|
// GObject *a_stack_page = g_object_new (GTK_STACK_PAGE ? );
|
||||||
|
// https://docs.gtk.org/gobject/tutorial.html#how-to-define-and-implement-a-new-gobject
|
||||||
|
|
||||||
|
GtkWidget *a_stack = gtk_stack_new ();
|
||||||
|
GtkWidget *a_switcher = gtk_stack_switcher_new ();
|
||||||
|
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (a_switcher), GTK_STACK (a_stack));
|
||||||
|
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (page_box), "a_name", "space");
|
||||||
|
// gtk_stack_page_set_visible (*self, TRUE);
|
||||||
|
|
||||||
|
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));
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
||||||
|
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_STATE));
|
||||||
|
// 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));
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (a_switcher));
|
||||||
|
|
||||||
|
// icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue