GtkWidget *get_run_rules_page_new(){ <<< un début (@see 'hot.c')

This commit is contained in:
Jean Sirmai 2024-05-11 07:57:37 +02:00
parent 8e4be2ff08
commit 1248bff327
Signed by: jean
GPG Key ID: FB3115C340E057E3
9 changed files with 170 additions and 44 deletions

114
(notes)
View File

@ -2,6 +2,7 @@
https://docs.gtk.org/gtk4/visual_index.html widgets gallery https://docs.gtk.org/gtk4/visual_index.html widgets gallery
https://forge.a-lec.org/gem-graph/gem-graph-client/src/branch/devel/Makefile https://forge.a-lec.org/gem-graph/gem-graph-client/src/branch/devel/Makefile
https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management
https://docs.gtk.org/gtk4/section-text-widget.html texts
https://docs.gtk.org/gtk4/drag-and-drop.html drag-and-drop https://docs.gtk.org/gtk4/drag-and-drop.html drag-and-drop
https://docs.gtk.org/gtk4/class.GestureZoom.html GtkGestureZoom https://docs.gtk.org/gtk4/class.GestureZoom.html GtkGestureZoom
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -29,3 +30,116 @@ gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1); n fois
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
TODO (or NOT TODO)
GtkWidget *get_text_view(){ // WTF ?!& @Grr #~!
// https://docs.gtk.org/gtk4/section-text-widget.html
GtkWidget *my_view = gtk_text_view_new ();
GtkTextTagTable *my_table = gtk_text_tag_table_new ();
GtkTextBuffer *my_buffer = gtk_text_buffer_new (my_table);
gtk_text_buffer_set_text (my_buffer, "Hello, this is some text", -1);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (my_view), my_buffer);
/* Now you might put the view in a container and display it on the
* screen; when the user edits the text, signals on the buffer
* will be emitted, such as "changed", "insert_text", and so on.
*/
return my_view;
}
//------------------------------------------------------------------------------
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;
}
/*
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;
}
*/

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
//#include "cold.h" #include "hot.h"
#include "display.h" #include "display.h"
#include "contain.h" #include "contain.h"
#include "texts.h" #include "texts.h"
@ -64,26 +64,9 @@ GtkWidget *get_run_help_page_new(){
return run_help_grid; return run_help_grid;
} }
/*
GtkWidget *get_run_rules_page_new(){ GtkWidget *get_run_rules_page_new(){ @see hot.c 2024-05-11 } (line 166)
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 *get_edit_space_page_new(){
GtkWidget *space_grid = gtk_grid_new(); GtkWidget *space_grid = gtk_grid_new();
@ -179,5 +162,7 @@ void activate (GtkApplication *app, gpointer user_data) {
gtk_paned_set_position (GTK_PANED (run_xor_edit_horizontal_pane), W_IMAGE + 350); // '350' : AD HOC gtk_paned_set_position (GTK_PANED (run_xor_edit_horizontal_pane), W_IMAGE + 350); // '350' : AD HOC
gtk_window_set_child (window, GTK_WIDGET(run_xor_edit_horizontal_pane)); gtk_window_set_child (window, GTK_WIDGET(run_xor_edit_horizontal_pane));
gtk_window_present (GTK_WINDOW (window)); gtk_window_present (GTK_WINDOW (window));
gtk_notebook_set_current_page (run_notebook, 1); // @see hot.c 2024-05-11 (line 68)
} }

View File

@ -1 +1,3 @@
contain.o: contain.c display.h contain.h texts.h contain.o: contain.c hot.h warm.h \
/gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \
cold.h display.h contain.h texts.h

View File

@ -15,25 +15,3 @@
void activate (GtkApplication *app, gpointer user_data); void activate (GtkApplication *app, gpointer user_data);
/*
GtkWidget *get_run_space_left_box();
GtkWidget *get_run_space_right_box();
GtkWidget *get_run_space_page_new();
GtkWidget *get_run_rules_page_new();
GtkWidget *get_run_measures_page_new();
GtkWidget *get_run_results_page_new();
GtkWidget *get_run_discuss_page_new();
GtkWidget *get_run_help_page_new();
GtkWidget *get_edit_space_page_new();
GtkWidget *get_edit_rules_page_new();
GtkWidget *get_edit_measures_page_new();
GtkWidget *get_edit_results_page_new();
GtkWidget *get_edit_discuss_page_new();
GtkWidget *get_edit_help_page_new();
*/

BIN
contain.o

Binary file not shown.

46
hot.c
View File

@ -14,3 +14,49 @@
// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL // GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL
GtkWidget *get_run_rules_page_new(){
GtkPaned *hpaned = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles");
GtkWidget *édition_de_la_règle_sélectionnée = gtk_frame_new ("Édition de la règle sélectionnée");
gtk_paned_set_start_child (hpaned, GTK_WIDGET (arbre_des_règles));
gtk_paned_set_end_child (hpaned, GTK_WIDGET (édition_de_la_règle_sélectionnée));
// gtk_widget_set_size_request (GTK_WIDGET (hpaned), W, H);
gtk_paned_set_wide_handle (hpaned, TRUE);
return GTK_WIDGET (hpaned);
}
/*
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;
}
*/

1
hot.h
View File

@ -12,3 +12,4 @@
#include "display.h" #include "display.h"
#include "contain.h" #include "contain.h"
GtkWidget *get_run_rules_page_new();

BIN
hot.o

Binary file not shown.

BIN
myprogram

Binary file not shown.