#include #include #include "cold.h" #include "widgets.h" #include "pages.h" GtkWidget *get_test_image(){ GtkWidget *image; // forget > GTK_WIDGET(get_scrolled_gl_area()); // Use GtkImage if you want to display a fixed-size icon // and GtkPicture if you want to display a (maybe) scaled picture. image = gtk_image_new_from_file("/home/jean/01/Gtk4/Getting_Started_with_GTK/image aXoris.png"); image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image gg sketch.png"); image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image E coli (Goodsell).png"); return image; } GtkWidget *get_scroll_speed(){ GtkAdjustment *speed_adjust = gtk_adjustment_new (0, 0, 100, 1, 0, 0); GtkWidget *scroll_speed = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, speed_adjust); return scroll_speed; } // TODO cliquer sur "RUN" --> affiche "STOP" (et inversement) GtkBox *get_RUN_STOP_box(){ GtkBox *RUN_STOP_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2 GtkWidget *RUN_Label = GTK_WIDGET (gtk_label_new (NULL)); // "RUN")); const char *str = " RUN-STOP"; const char *format = "\%s"; // ^c^v no more... char *markup; markup = g_markup_printf_escaped (format, str); gtk_label_set_markup (GTK_LABEL (RUN_Label), markup); // Sets the labels text and attributes from markup. g_free (markup); gtk_label_set_max_width_chars (GTK_LABEL(RUN_Label), 12); gtk_label_set_wrap (GTK_LABEL(RUN_Label), TRUE); gtk_label_set_xalign (GTK_LABEL(RUN_Label), 0.5); // xalign value, between 0 and 1 gtk_label_set_yalign (GTK_LABEL(RUN_Label), 0.5); gtk_label_set_selectable (GTK_LABEL(RUN_Label), FALSE); // default = FALSE gtk_label_set_single_line_mode (GTK_LABEL(RUN_Label), TRUE); // default = TRUE // gtk_box_append (RUN_STOP_box, RUN_Label); return RUN_STOP_box; } GtkBox *get_STEP_by_STEP_box(){ GtkBox *STEP_by_STEP_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); GtkWidget *STEP_by_STEP_Label = GTK_WIDGET (gtk_label_new ("ONE\nSTEP")); gtk_box_append (STEP_by_STEP_box, STEP_by_STEP_Label); return STEP_by_STEP_box; } GtkBox *get_ZOOM_box(){ GtkBox *ZOOM_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new ("ZOOM\n ---\n(space\nstruct.)")); gtk_box_append (ZOOM_box, ZOOM_Label); return ZOOM_box; } GtkBox *get_edit_TOOL_box(){ GtkBox *TOOL_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new ("TOOLS\n ---\n(space\nstruct.)")); gtk_box_append (TOOL_box, ZOOM_Label); return TOOL_box; } GtkBox *get_XYZ_box(){ GtkBox *XYZ_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2 // GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier // (double min, double max, double step, const char** icons) GtkAdjustment *X_adjust = gtk_adjustment_new (0, 0, 380, 1, 0, 0); GtkAdjustment *Y_adjust = gtk_adjustment_new (0, 0, 380, 1, 0, 0); GtkAdjustment *Z_adjust = gtk_adjustment_new (0, 0, 380, 1, 0, 0); GtkWidget *scroll_X = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, X_adjust); GtkWidget *scroll_Y = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Y_adjust); GtkWidget *scroll_Z = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Z_adjust); gtk_box_append (XYZ_box, scroll_X); gtk_box_append (XYZ_box, scroll_Y); gtk_box_append (XYZ_box, scroll_Z); // gtk_box_set_baseline_position (XYZ_box, GTK_BASELINE_POSITION_BOTTOM); return XYZ_box; } GtkBox *get_ELAPSED_TIME_box(){ GtkBox *ELAPSED_TIME_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // GtkProgressBar *get_simulation_time_extent_buffer(){ GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); gtk_progress_bar_set_text (buffer, "<--- [buffer] (simulation extensive time) --->"); gtk_progress_bar_set_show_text (buffer, TRUE); gtk_widget_set_size_request (GTK_WIDGET (buffer), W_IMAGE, 40); gtk_box_append (ELAPSED_TIME_box, GTK_WIDGET(buffer)); return ELAPSED_TIME_box; } GtkProgressBar *get_simulation_time_extent_buffer(){ GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); gtk_progress_bar_set_text (buffer, "<--- [buffer] (simulation extensive time) --->"); gtk_progress_bar_set_show_text (buffer, TRUE); gtk_widget_set_size_request (GTK_WIDGET (buffer), W_IMAGE, 40); return buffer; } GtkBox *get_objects_box(){ GtkBox *objects_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" membrane "))); gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" co-enzyme A "))); gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" ribosome "))); gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" cytochrome C "))); gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" ATP synthase "))); gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" chromosome "))); return objects_box; } GtkBox *get_situations_box(){ GtkBox *situations_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" transcription "))); gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" promotion opéron lactose "))); gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" translation "))); gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" transport Na/K "))); gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" ubiquitination "))); gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" rotation du moteur flagellaire "))); return situations_box; } static GtkWidget *get_frame_objects(){ GtkWidget *frame_objects = gtk_frame_new (" Objects"); // defines each class of object transparence gtk_widget_set_size_request (frame_objects, 0, H_STYLES_PANE); // < utile seulement pour la largeur min/max gtk_frame_set_child (GTK_FRAME (frame_objects), GTK_WIDGET (get_objects_box())); return frame_objects; } static GtkWidget *get_frame_situations(){ GtkWidget *frame_situations = gtk_frame_new (" Situations"); // facilitates each situation identification gtk_widget_set_size_request (GTK_WIDGET (frame_situations), 0, H_STYLES_PANE); // < utile seulement pour la largeur min/max gtk_frame_set_child (GTK_FRAME (frame_situations), GTK_WIDGET (get_situations_box())); return frame_situations; } GtkWidget *get_objects_and_situations_horizontal_pane(){ GtkWidget *objects_and_situations_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_paned_set_start_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (get_frame_objects())); gtk_paned_set_end_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (get_frame_situations())); return objects_and_situations_horizontal_pane; }GtkScrolledWindow *get_scrolled_gl_area(){ GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new()); gtk_scrolled_window_set_min_content_width (scrolled, W_IMAGE); gtk_scrolled_window_set_min_content_height (scrolled, H_IMAGE); // GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); // GtkAdjustment *height = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); // (value, lower, upper, step_increment, page_increment, page_size) // GtkWidget *GLarea = gtk_gl_area_new(); // gtk_scrolled_window_set_child (scrolled, GLarea); // https://docs.gtk.org/gtk4/class.GLArea.html return scrolled; }