109 lines
4.0 KiB
C
109 lines
4.0 KiB
C
#include <stdio.h>
|
|
#include <gtk-4.0/gtk/gtk.h>
|
|
|
|
#include "cold.h"
|
|
#include "widgets.h"
|
|
#include "pages.h"
|
|
|
|
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
essai run-stop, speed et step by step dans une seule box controls
|
|
-----------------------------------------------------------------
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <gtk-4.0/gtk/gtk.h>
|
|
#include "cold.h"
|
|
|
|
void print_text(GtkWidget *widget, gpointer data) {g_print (data);}
|
|
|
|
GtkWidget *get_a_space_test_image(){
|
|
GtkWidget *image;
|
|
image = GTK_WIDGET(get_scrolled_gl_area());
|
|
image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/images/aXoris.png");
|
|
image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/images/gg sketch.png");
|
|
image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/images/E coli.png");
|
|
image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/images/E coli resized.png");
|
|
image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/E coli by David S. Goodsell (2009).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\n STOP";
|
|
const char *format = "<span style=\"oblique\">\%s</span>";
|
|
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_CONTROL_box(){
|
|
GtkBox *CONTROL_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
|
gtk_box_append (CONTROL_box, GTK_WIDGET (get_RUN_STOP_box()));
|
|
gtk_box_append (CONTROL_box, GTK_WIDGET (get_scroll_speed()));
|
|
gtk_box_append (CONTROL_box, GTK_WIDGET (get_STEP_by_STEP_box()));
|
|
return CONTROL_box;
|
|
}
|
|
|
|
GtkWidget *get_space_page_new(){
|
|
|
|
GtkWidget *space_grid = gtk_grid_new();
|
|
// attach 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), GTK_WIDGET(get_simulation_time_extent_buffer()), 0, 0, 1, 1);
|
|
gtk_grid_attach (GTK_GRID(space_grid), get_a_space_test_image(), 0, 1, 1, 5);
|
|
gtk_grid_attach (GTK_GRID(space_grid), get_objects_and_situations_horizontal_pane(), 0, 6, 1, 1);
|
|
// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_RUN_STOP_box()), 1, 0, 1, 1);
|
|
// gtk_grid_attach (GTK_GRID(space_grid), get_scroll_speed(), 1, 2, 1, 1);
|
|
// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_STEP_by_STEP_box()), 1, 3, 1, 1);
|
|
gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_CONTROL_box()), 1, 0, 1, 2);
|
|
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;
|
|
}
|
|
*/
|