GTK4_GG_hack/hot.c

104 lines
5.6 KiB
C
Raw Normal View History

2024-04-27 16:16:21 +02:00
#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h>
2024-04-29 23:43:04 +02:00
#include "hot.h"
#include "warm.h"
#include "cold.h"
GtkWidget *get_space_page_new(){
2024-04-30 18:59:44 +02:00
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
2024-04-30 07:17:00 +02:00
2024-04-30 09:16:40 +02:00
GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new());
2024-04-30 13:06:46 +02:00
gtk_scrolled_window_set_min_content_width (scrolled, 600);
2024-04-30 09:16:40 +02:00
gtk_scrolled_window_set_min_content_height (scrolled, 600);
2024-04-30 18:59:44 +02:00
// GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000);
// GtkAdjustment *height = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000);
2024-04-30 09:16:40 +02:00
// (value, lower, upper, step_increment, page_increment, page_size)
2024-04-30 18:59:44 +02:00
GtkWidget *GLarea = gtk_gl_area_new();
gtk_scrolled_window_set_child (scrolled, GLarea);
// https://docs.gtk.org/gtk4/class.GLArea.html
2024-04-30 13:06:46 +02:00
2024-04-30 18:59:44 +02:00
GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
2024-04-30 13:06:46 +02:00
gtk_box_append (controls_box, gtk_button_new_with_label ("RUN / STOP"));
gtk_box_append (controls_box, gtk_button_new_with_label ("slow down / speed up"));
gtk_box_append (controls_box, gtk_button_new_with_label ("step by step"));
2024-04-30 18:59:44 +02:00
// GtkLevelBar *buffer = GTK_LEVEL_BAR (gtk_level_bar_new ());
// GtkWidget *buffer = gtk_level_bar_new_for_interval (0, 100000);
// gtk_level_bar_set_mode (buffer, GTK_LEVEL_BAR_MODE_CONTINUOUS); //_DISCRETE
gtk_box_append (controls_box, gtk_button_new_with_label ("---- buffer ----"));
2024-04-30 07:17:00 +02:00
GtkBox *XYZ_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2
2024-04-30 13:06:46 +02:00
// GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier
// (double min, double max, double step, const char** icons)
2024-04-30 18:59:44 +02:00
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);
2024-04-30 13:06:46 +02:00
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);
2024-04-30 18:59:44 +02:00
GtkWidget *bottom_grid = gtk_grid_new();
gtk_grid_attach (GTK_GRID(bottom_grid), GTK_WIDGET(controls_box), 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID(bottom_grid), gtk_button_new_with_label ("Objects / Situations (transparences, styles)"), 0, 1, 1, 1);
gtk_grid_attach (GTK_GRID(bottom_grid), gtk_button_new_with_label ("zoom, +/- grid,\npresentation,\nstyles,..."), 1, 0, 1, 2);
GtkWidget *space_grid = gtk_grid_new();
gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(scrolled), 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(XYZ_box), 1, 0, 1, 1);
gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(bottom_grid), 0, 1, 2, 1); // ?! échec x_size
// gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("?"), 1, 1, 1, 1);
2024-04-29 23:43:04 +02:00
return space_grid;
}
2024-04-30 18:59:44 +02:00
/*
gg/draw.c: * Draws the current buffer to a gl_area
gg/draw.c: * @param gl_area, ptr to the gl_area widget
gg/init.c: * Initializes the buffer of a gl_area
gg/init.c: * @param gl_area, ptr to the gl_area widget
gg/init.c: * Initializes the shaders of a gl_area and link them to a program
gg/init.c: * @param gl_area, ptr to the gl_area widget
gg/graphics.c: * @param gl_area, ptr to the gl_area widget
gg/graphics.c: * Shutdowns a gl_area
gg/graphics.c: * @param gl_area, ptr to the gl_area widget
gg/GtkGLArea.c: void *gl_area;
gg/GtkGLArea.c: gtk_widget_queue_draw((GtkWidget*)(stack_index[i].gl_area));
gg/GtkGLArea.c: GtkWidget *gl_area;
gg/GtkGLArea.c: gl_area = GTK_WIDGET(gtk_gl_area_new());
gg/GtkGLArea.c: assert(gl_area);
gg/GtkGLArea.c: //gtk_widget_set_size_request(gl_area, 1000, 1000);
gg/GtkGLArea.c: gtk_gl_area_set_auto_render(GTK_GL_AREA(gl_area), true);
gg/GtkGLArea.c: gtk_widget_set_hexpand(gl_area, TRUE);
gg/GtkGLArea.c: gtk_widget_set_vexpand(gl_area, TRUE);
gg/GtkGLArea.c: //gtk_widget_set_halign(gl_area, GTK_ALIGN_CENTER);
gg/GtkGLArea.c: //gtk_widget_set_valign(gl_area, GTK_ALIGN_CENTER);
gg/GtkGLArea.c: g_signal_connect(GTK_GL_AREA(gl_area),
gg/GtkGLArea.c: g_signal_connect(gl_area,
gg/GtkGLArea.c: g_signal_connect(gl_area,
gg/GtkGLArea.c: stack_index[stack_index_size-1].gl_area = (void*)gl_area;
gg/GtkGLArea.c: gtk_box_append(GTK_BOX(target_widget), gl_area);
gg/GtkGLArea.c: gtk_widget_show(GTK_WIDGET(gl_area));
gg/events.c: if(gtk_gl_area_get_error(area) != NULL) {
gg/events.c: gtk_gl_area_make_current(GTK_GL_AREA(widget));
gg/events.c: if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
gg/events.c: gtk_gl_area_set_auto_render(GTK_GL_AREA(widget), true);
gg/events.c: gtk_gl_area_make_current(GTK_GL_AREA(widget));
gg/events.c: if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
gg/graphics.h: * Structure describing a gl_area and its parameters, used to create a table
gg/graphics.h: * of Gem-graph client current gl_areas
gg/graphics.h: * Dynamic array of ptrs to dynamically allocated gl_area_entry
gg/graphics.h: * Initializes a gl_area
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
gg/graphics.h: * Draws the current buffer to a gl_area
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
gg/graphics.h: * Shutdowns a gl_area
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
gg/graphics.h: * Initializes the shaders of a gl_area and link them to a program
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
gg/graphics.h: * Initializes the buffer of a gl_area
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
*/