2024-04-27 16:16:21 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <gtk-4.0/gtk/gtk.h>
|
2024-04-28 08:38:55 +02:00
|
|
|
#include "warm.h"
|
|
|
|
#include "cold.h"
|
|
|
|
|
|
|
|
void activate (GtkApplication *app, gpointer user_data) {
|
|
|
|
GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app));
|
2024-04-28 09:14:08 +02:00
|
|
|
window_bar (window, "window");
|
2024-04-28 08:38:55 +02:00
|
|
|
GtkWidget *grid = gtk_grid_new();
|
2024-04-28 09:14:08 +02:00
|
|
|
gtk_window_set_child (window, grid);
|
2024-04-28 08:38:55 +02:00
|
|
|
|
2024-04-28 09:14:08 +02:00
|
|
|
click_print_do (NULL, grid, "(I)", "n°1\n", 0,0,1,1);
|
|
|
|
click_print_do (NULL, grid, "(II)", "n°2\n", 1,0,1,1);
|
|
|
|
click_print_do (window, grid, "Quit", "bye !\n", 2,0,1,2);
|
2024-04-28 08:38:55 +02:00
|
|
|
|
|
|
|
GtkWidget *switcher = gtk_stack_switcher_new();
|
|
|
|
// GtkWidget *sidebar = gtk_stack_sidebar_new();
|
2024-04-28 09:14:08 +02:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), switcher, 0, 2, 2, 1);
|
|
|
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (switcher), GTK_ORIENTATION_VERTICAL);
|
|
|
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (switcher), GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
GtkStack *stack = GTK_STACK (gtk_stack_new());
|
|
|
|
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), stack);
|
|
|
|
// gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), stack);
|
|
|
|
|
2024-04-28 08:38:55 +02:00
|
|
|
GtkWidget *page_0 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
|
|
|
GtkWidget *page_1 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
|
|
|
gtk_stack_add_titled (stack, page_0, "n°0", "A");
|
|
|
|
gtk_stack_add_titled (stack, page_1, "n°1", "B");
|
|
|
|
|
2024-04-28 09:14:08 +02:00
|
|
|
GtkWidget *box_1 = gtk_box_new (0, 6); // 6 = spacing
|
2024-04-28 08:38:55 +02:00
|
|
|
|
2024-04-28 09:14:08 +02:00
|
|
|
GtkStackPage *page_2 = gtk_stack_add_titled (stack, box_1, "any name", "C");
|
|
|
|
gtk_stack_page_set_name (page_2, "n°2");
|
2024-04-28 08:38:55 +02:00
|
|
|
|
2024-04-28 09:14:08 +02:00
|
|
|
printf("selected page name is [%s] (how do I get its title ?)\n",
|
|
|
|
gtk_stack_get_visible_child_name (stack));
|
2024-04-28 08:38:55 +02:00
|
|
|
|
|
|
|
GtkSelectionModel *stack_selection_model = gtk_stack_get_pages (stack);
|
|
|
|
gtk_selection_model_select_item (stack_selection_model, 2, 1);
|
|
|
|
|
|
|
|
// gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (window));
|
|
|
|
}
|
2024-04-27 16:16:21 +02:00
|
|
|
|