objects_and_situations_horizontal_pane sous l'image de l'espace

This commit is contained in:
Jean Sirmai 2024-05-06 22:19:58 +02:00
parent 7620e30514
commit e9bd2abb7c
Signed by: jean
GPG Key ID: FB3115C340E057E3
6 changed files with 106 additions and 7 deletions

13
cold.c
View File

@ -4,7 +4,6 @@
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());
@ -183,13 +182,13 @@ GtkWidget *get_space_page_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_objects_and_situations_horizontal_pane(), 0, 1, 1, 1);
gtk_grid_attach (GTK_GRID(space_grid), get_a_space_test_image(), 0, 2, 1, 10);
gtk_grid_attach (GTK_GRID(space_grid), get_a_space_test_image(), 0, 1, 1, 4);
gtk_grid_attach (GTK_GRID(space_grid), get_objects_and_situations_horizontal_pane(), 0, 5, 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, 1, 1, 1);
gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_STEP_by_STEP_box()), 1, 2, 1, 1);
gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_XYZ_box()), 1, 3, 1, 1);
gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ZOOM_box()), 1, 4, 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_XYZ_box()), 1, 4, 1, 1);
gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ZOOM_box()), 1, 5, 1, 1);
return space_grid;
}

1
cold.h
View File

@ -20,6 +20,7 @@ GtkWidget *get_a_space_test_image();
GtkScrolledWindow *get_scrolled_gl_area();
GtkBox *get_RUN_STOP_box();
GtkBox *get_STEP_by_STEP_box();
GtkBox *get_CONTROL_box();
GtkBox *get_ZOOM_box();
GtkBox *get_XYZ_box();
GtkWidget *get_scroll_speed();

BIN
cold.o

Binary file not shown.

BIN
main.o

Binary file not shown.

BIN
myprogram

Binary file not shown.

99
warm.c
View File

@ -5,3 +5,102 @@
// 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;
}
*/