diff --git a/cold.c b/cold.c index 4562d78..94916a1 100644 --- a/cold.c +++ b/cold.c @@ -1,5 +1,6 @@ #include #include +#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)); +} /*----------------------------------------------------------------------------*/ diff --git a/cold.h b/cold.h index 89737f9..c6caa5b 100644 --- a/cold.h +++ b/cold.h @@ -2,7 +2,18 @@ #include 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(); + diff --git a/exec.o b/exec.o index 9a45135..9723bd6 100755 Binary files a/exec.o and b/exec.o differ diff --git a/hot.c b/hot.c index ee69459..e711e60 100644 --- a/hot.c +++ b/hot.c @@ -1,3 +1,13 @@ #include #include +#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; +} + diff --git a/hot.h b/hot.h index 4fd021b..5ca0eb2 100644 --- a/hot.h +++ b/hot.h @@ -3,4 +3,4 @@ #include "warm.h" #include "cold.h" -void activate (GtkApplication *app, gpointer user_data); + diff --git a/main.c b/main.c index b5a1712..f88d883 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,6 @@ #include "hot.h" +#include "warm.h" +#include "cold.h" int main (int argc, char **argv) { diff --git a/warm.c b/warm.c index 49c7d09..4a3c59b 100644 --- a/warm.c +++ b/warm.c @@ -1,8 +1,61 @@ #include #include +#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"); diff --git a/warm.h b/warm.h index 8d348a1..44b0e9a 100644 --- a/warm.h +++ b/warm.h @@ -14,6 +14,7 @@ #include #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()