WIP: comment utiliser ce switcher pour afficher ses 'stack_pages' ?
This commit is contained in:
parent
b40b3e2598
commit
6adcdc7d96
34
contain.c
34
contain.c
|
@ -147,6 +147,15 @@ GtkWidget *get_SPACE_EDIT_controls_box() {
|
|||
return GTK_WIDGET (label_ad_hoc);
|
||||
}
|
||||
|
||||
GtkWidget *get_STATE_VIEW_box(){
|
||||
GtkBox *space_view_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||
return GTK_WIDGET (space_view_box);
|
||||
}
|
||||
|
||||
void window_main_child_bottom (GtkBox *page_box){
|
||||
// gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||
|
@ -155,10 +164,10 @@ void window_main_child_bottom (GtkBox *page_box){
|
|||
|
||||
// static void icons_for_fun (GtkHeaderBar *header_bar);
|
||||
|
||||
void window_header_bar (GtkWindow *window, char *title){
|
||||
void window_header_bar (GtkWindow *main_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);
|
||||
gtk_window_set_titlebar (main_window, header_bar);
|
||||
gpointer no_local_data = NULL;
|
||||
|
||||
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
|
@ -168,20 +177,19 @@ void window_header_bar (GtkWindow *window, char *title){
|
|||
|
||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
||||
|
||||
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()));
|
||||
|
||||
// https://docs.gtk.org/gtk4/class.Stack.html
|
||||
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_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_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box()), "a_name", "space");
|
||||
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new()), "another_name", "rules");
|
||||
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_measures_page_new()), "a_third_name", "data analysis");
|
||||
|
||||
// gtk_stack_page_set_visible (*self, TRUE);
|
||||
gtk_stack_set_visible_child (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box()));
|
||||
gtk_stack_set_visible_child (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new()));
|
||||
|
||||
gtk_window_set_child (main_window, GTK_WIDGET (gtk_stack_get_visible_child (GTK_STACK (a_stack))));
|
||||
|
||||
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 (any_Label));
|
||||
|
@ -200,7 +208,7 @@ void window_main_child (GtkWindow *main_window, int selected_page){
|
|||
}
|
||||
|
||||
void main_window_design (GtkWindow *main_window){
|
||||
window_main_child (main_window, STATE);
|
||||
// window_main_child (main_window, STATE);
|
||||
window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
|
|
Loading…
Reference in New Issue