cleaning +++

This commit is contained in:
Jean Sirmai 2024-04-29 23:43:04 +02:00
parent 92cc46c9ac
commit d0e04d4901
Signed by: jean
GPG Key ID: FB3115C340E057E3
8 changed files with 99 additions and 4 deletions

18
cold.c
View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h>
#include "cold.h"
void print_text(GtkWidget *widget, gpointer data) {g_print (data);}
@ -18,6 +19,23 @@ void window_bar(GtkWindow *window, char *title){
gtk_window_set_titlebar (window, titlebar); // header_bar
}
void activate (GtkApplication *app, gpointer user_data) {
GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app));
window_bar (window, "window");
GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new());
gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_LEFT);
gtk_notebook_append_page (notebook, get_space_page_new(), gtk_label_new ("space"));
gtk_notebook_append_page (notebook, get_rules_page_new(), gtk_label_new ("rules"));
gtk_notebook_append_page (notebook, get_measures_page_new(),gtk_label_new ("measures"));
gtk_notebook_append_page (notebook, get_results_page_new(), gtk_label_new ("results"));
gtk_notebook_append_page (notebook, get_discuss_page_new(), gtk_label_new ("interpret"));
gtk_notebook_append_page (notebook, get_help_page_new(), gtk_label_new ("help"));
gtk_window_set_child (window, GTK_WIDGET(notebook));
gtk_window_present (GTK_WINDOW (window));
}
/*----------------------------------------------------------------------------*/

11
cold.h
View File

@ -2,7 +2,18 @@
#include <gtk/gtk.h>
void print_text(GtkWidget *widget, gpointer data);
void click_print_do (GtkWindow *window, GtkWidget *grid,
char *label, char *text, int x, int y, int w, int h);
void window_bar(GtkWindow *window, char *title);
void activate (GtkApplication *app, gpointer user_data);
GtkWidget *get_space_page_new();
GtkWidget *get_rules_page_new();
GtkWidget *get_measures_page_new();
GtkWidget *get_results_page_new();
GtkWidget *get_discuss_page_new();
GtkWidget *get_help_page_new();

BIN
exec.o

Binary file not shown.

10
hot.c
View File

@ -1,3 +1,13 @@
#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h>
#include "hot.h"
#include "warm.h"
#include "cold.h"
GtkWidget *get_space_page_new(){
GtkWidget * space_grid = gtk_grid_new();
gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("Hi babe...here am I !"), 0, 0, 1, 1);
return space_grid;
}

2
hot.h
View File

@ -3,4 +3,4 @@
#include "warm.h"
#include "cold.h"
void activate (GtkApplication *app, gpointer user_data);

2
main.c
View File

@ -1,4 +1,6 @@
#include "hot.h"
#include "warm.h"
#include "cold.h"
int main (int argc, char **argv)
{

57
warm.c
View File

@ -1,8 +1,61 @@
#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h>
#include "warm.h"
#include "cold.h"
void activate (GtkApplication *app, gpointer user_data) {
GtkWidget *get_measures_page_new(){
GtkWidget *measures_grid = gtk_grid_new();
gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("movements"), 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transports"), 1, 0, 1, 1);
gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transformations"), 2, 0, 1, 1);
gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("objects counts"), 0, 1, 1, 1);
gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("situations counts"), 1, 1, 1, 1);
return measures_grid;
}
GtkWidget *get_results_page_new(){
GtkWidget *results_grid = gtk_grid_new();
gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Here are some results :"), 0, 0, 1, 1);
return results_grid;
}
GtkWidget *get_discuss_page_new(){
GtkWidget *discuss_grid = gtk_grid_new();
gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Interpretations"), 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Discussions"), 0, 1, 1, 1);
return discuss_grid;
}
GtkWidget *get_help_page_new(){
GtkWidget *help_grid = gtk_grid_new();
gtk_grid_attach (GTK_GRID (help_grid), gtk_button_new_with_label ("Can I help you ?"), 0, 0, 1, 1);
return help_grid;
}
GtkWidget *get_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, 800, 600);
gtk_widget_set_size_request (frame1, 300, 0); // < utile seulement pour la largeur min/max
// gtk_widget_set_size_request (frame2, 50, 100);
// gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID (grid_3), gtk_button_new_with_label ("in the right pane"), 0, 0, 1, 1);
return rules_grid;
}
/*void activate (GtkApplication *app, gpointer user_data) {
GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app));
window_bar (window, "window");
GtkWidget *grid = gtk_grid_new();
@ -51,7 +104,7 @@ void activate (GtkApplication *app, gpointer user_data) {
/*
*
static void activate_old (GtkApplication *app, gpointer user_data) {
GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app));
window_bar (window, "window");

3
warm.h
View File

@ -14,6 +14,7 @@
#include <gtk-4.0/gtk/gtk.h>
#include "cold.h"
/*
* https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
* https://stackoverflow.com/questions/20122232/gtklistc-code-how-to-get-the-selection-of-a-gtklist
@ -62,7 +63,7 @@
* Toujours pas moyen de voir les stack pages !
// gtk_stack_page_set_visible (GTK_STACK_PAGE (gtk_stack_get_visible_child (stack)), TRUE);
// gtk_stack_page_set_visible ( GTK_WIDGET(gtk_stack_get_visible_child (stack)), TRUE);
// gtk_stack_page_set_visible GTK_WIDGET(gtk_stack_get_visible_child (stack)), TRUE);
// gtk_stack_page_set_visible ( stack_selection_model, TRUE);
// gboolean gtk_selection_model_is_selected (GtkSelectionModel* model, guint position);
// gtk_selection_model_get_selected_item()