#include #include #include "cold.h" #include "widgets.h" #include "pages.h" #include "texts.h" GtkWidget *get_edit_rules_page_new(){ GtkWidget *xxx_grid = gtk_grid_new(); return xxx_grid; } GtkWidget *get_edit_measures_page_new(){ GtkWidget *measures_grid = gtk_grid_new(); return measures_grid; } GtkWidget *get_edit_results_page_new(){ GtkWidget *xxx_grid = gtk_grid_new(); return xxx_grid; } GtkWidget *get_edit_discuss_page_new(){ GtkWidget *xxx_grid = gtk_grid_new(); return xxx_grid; } GtkWidget *get_edit_help_page_new(){ GtkWidget *edit_help_grid = gtk_grid_new(); gtk_grid_attach (GTK_GRID(edit_help_grid), GTK_WIDGET(get_frame_with_label()), 0, 0, 1, 1); return edit_help_grid; } GtkWidget *get_run_measures_page_new(){ GtkWidget *measures_grid = gtk_grid_new(); gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("movements"), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transports"), 1, 0, 1, 1); gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transformations"), 2, 0, 1, 1); gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("objects"), 0, 1, 1, 1); gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("situations"), 1, 1, 1, 1); return measures_grid; } GtkWidget *get_run_results_page_new(){ GtkWidget *results_grid = gtk_grid_new(); gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Repartitions"), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Correlations"), 0, 1, 1, 1); gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Evolutions"), 0, 2, 1, 1); return results_grid; } GtkWidget *get_run_discuss_page_new(){ GtkWidget *discuss_grid = gtk_grid_new(); gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Interpretations"), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Discussions"), 0, 1, 1, 1); return discuss_grid; } GtkWidget *get_run_help_page_new(){ GtkWidget *run_help_grid = gtk_grid_new(); gtk_grid_attach (GTK_GRID(run_help_grid), GTK_WIDGET(get_frame_with_label()), 0, 0, 1, 1); return run_help_grid; } GtkWidget *get_run_rules_page_new(){ GtkWidget *rules_grid = gtk_grid_new(); GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1); GtkWidget *frame1 = gtk_frame_new ("hello ?"); GtkWidget *frame2 = gtk_frame_new ("it's me !"); GtkWidget *grid_3 = gtk_grid_new(); gtk_frame_set_child ( GTK_FRAME(frame2), grid_3); gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1)); gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2)); gtk_widget_set_size_request (hpaned, W, H); gtk_grid_attach (GTK_GRID (grid_3), gtk_button_new_with_label ("in the right pane"), 0, 0, 1, 1); return rules_grid; } GtkWidget *get_edit_space_page_new(){ GtkWidget *space_grid = gtk_grid_new(); gtk_grid_attach (GTK_GRID(space_grid), get_test_image(), 0, 0, 1, 3); gtk_grid_attach (GTK_GRID(space_grid), get_objects_and_situations_horizontal_pane(), 0, 4, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_XYZ_box()), 1, 0, 1, 2); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ZOOM_box()), 1, 2, 1, 2); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_edit_TOOL_box()), 1, 3, 1, 2); gtk_widget_set_size_request (space_grid, W, H); // How to use gtk_separators ? // gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)), 1, 1, 1, 1); return space_grid; } GtkWidget *get_run_space_page_new(){ /* GtkBox *lateral_right_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 40)); // spacing gtk_box_append (lateral_right_box, GTK_WIDGET (get_RUN_STOP_box())); gtk_box_append (lateral_right_box, GTK_WIDGET (get_scroll_speed())); gtk_box_append (lateral_right_box, GTK_WIDGET (get_STEP_by_STEP_box())); gtk_box_append (lateral_right_box, GTK_WIDGET (get_XYZ_box())); gtk_box_append (lateral_right_box, GTK_WIDGET (get_ZOOM_box())); */ GtkWidget *space_grid = gtk_grid_new(); // same result using either : get_ELAPSED_TIME_box() or get_simulation_time_extent_buffer() gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ELAPSED_TIME_box()), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), get_test_image(), 0, 1, 1, 2); gtk_grid_attach (GTK_GRID(space_grid), get_objects_and_situations_horizontal_pane(), 0, 3, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_RUN_STOP_box()), 1, 0, 1, 2); // gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)), 1, 1, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_XYZ_box()), 1, 2, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ZOOM_box()), 1, 3, 1, 1); return space_grid; } void window_bar(GtkWindow *window, char *title){ GtkWidget *titlebar = gtk_header_bar_new(); gtk_window_set_title (window, title); gtk_window_set_titlebar (window, titlebar); // 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); } void activate (GtkApplication *app, gpointer user_data) { GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app)); window_bar (window, "E coli (with permission from David S. Goodsell, 2009)"); GtkNotebook *run_notebook = GTK_NOTEBOOK(gtk_notebook_new()); gtk_notebook_set_tab_pos (GTK_NOTEBOOK(run_notebook), GTK_POS_TOP); // GTK_POS_LEFT gtk_notebook_append_page (run_notebook, get_run_space_page_new(), gtk_label_new ("space")); gtk_notebook_append_page (run_notebook, get_run_rules_page_new(), gtk_label_new ("rules")); gtk_notebook_append_page (run_notebook, get_run_measures_page_new(),gtk_label_new ("measures")); gtk_notebook_append_page (run_notebook, get_run_results_page_new(), gtk_label_new ("results")); gtk_notebook_append_page (run_notebook, get_run_discuss_page_new(), gtk_label_new ("interpret")); gtk_notebook_append_page (run_notebook, get_run_help_page_new(), gtk_label_new ("help")); GtkNotebook *edit_notebook = GTK_NOTEBOOK(gtk_notebook_new()); gtk_notebook_set_tab_pos (GTK_NOTEBOOK(edit_notebook), GTK_POS_TOP); // GTK_POS_RIGHT gtk_notebook_append_page (edit_notebook, get_edit_space_page_new(), gtk_label_new ("space")); gtk_notebook_append_page (edit_notebook, get_edit_rules_page_new(), gtk_label_new ("rules")); gtk_notebook_append_page (edit_notebook, get_edit_measures_page_new(),gtk_label_new ("measures")); gtk_notebook_append_page (edit_notebook, get_edit_results_page_new(), gtk_label_new ("results")); gtk_notebook_append_page (edit_notebook, get_edit_discuss_page_new(), gtk_label_new ("interpret")); gtk_notebook_append_page (edit_notebook, get_edit_help_page_new(), gtk_label_new ("help")); GtkWidget *run_xor_edit_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_size_request (run_xor_edit_horizontal_pane, W_IMAGE, H_STYLES_PANE); gtk_paned_set_start_child (GTK_PANED(run_xor_edit_horizontal_pane), GTK_WIDGET (run_notebook)); gtk_paned_set_end_child (GTK_PANED(run_xor_edit_horizontal_pane), GTK_WIDGET (edit_notebook)); gtk_paned_set_position (GTK_PANED (run_xor_edit_horizontal_pane), W_IMAGE + 90); // ! WARNING ! '90' is AD HOC gtk_window_set_child (window, GTK_WIDGET(run_xor_edit_horizontal_pane)); gtk_window_present (GTK_WINDOW (window)); } /* REM ! * g_signal_connect (button, "clicked", G_CALLBACK (printf("%s\n", text)), text); * g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); * * drag-and-drop https://docs.gtk.org/gtk4/drag-and-drop.html * * GtkGestureZoom https://docs.gtk.org/gtk4/class.GestureZoom.html */