a pane with two frames; widgets in frames

This commit is contained in:
Jean Sirmai 2024-04-29 04:53:29 +02:00
parent e01ec813bd
commit 3e1c51dff5
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 20 additions and 15 deletions

BIN
exec.o

Binary file not shown.

22
hot.h
View File

@ -32,31 +32,23 @@ void activate (GtkApplication *app, gpointer user_data) {
gtk_selection_model_select_item (stack_selection_model, 1, 1); gtk_selection_model_select_item (stack_selection_model, 1, 1);
printf("selected page name is [%s] \n", gtk_stack_get_visible_child_name (stack)); printf("selected page name is [%s] \n", gtk_stack_get_visible_child_name (stack));
GtkWidget *box_3 = gtk_box_new (0, 0); GtkWidget *box_3 = gtk_box_new (0, 0);
gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("30")); gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("30"));
gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("31")); gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("31"));
gtk_grid_attach (GTK_GRID (grid), box_3, 0, 2, 1, 1); gtk_grid_attach (GTK_GRID (grid), box_3, 0, 2, 1, 1);
GtkWidget *grid_2 = gtk_grid_new();
GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
GtkWidget *frame1 = gtk_frame_new ("hello ?"); GtkWidget *frame1 = gtk_frame_new ("hello ?");
GtkWidget *frame2 = gtk_frame_new ("it's me !"); GtkWidget *frame2 = gtk_frame_new ("it's me !");
gtk_frame_set_child ( GTK_FRAME(frame2), grid_2);
gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1)); gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1));
gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2)); gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2));
// gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN); gtk_widget_set_size_request (hpaned, 400, 200);
// gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN); // gtk_widget_set_size_request (frame1, 50, 100); < utile seulement pour la largeur min/max
// gtk_widget_set_size_request (frame2, 50, 100);
gtk_widget_set_size_request (hpaned, 200, -1); gtk_grid_attach (GTK_GRID (grid), hpaned, 0, 3, 3, 1);
gtk_grid_attach (GTK_GRID (grid_2), gtk_button_new_with_label ("in the right pane"), 0, 0, 1, 1);
// gtk_paned_pack1 (GTK_PANED (hpaned), frame1, TRUE, FALSE);
gtk_widget_set_size_request (frame1, 50, -1);
// gtk_paned_pack2 (GTK_PANED (hpaned), frame2, FALSE, FALSE);
gtk_widget_set_size_request (frame2, 50, -1);
gtk_grid_attach (GTK_GRID (grid), hpaned, 0, 3, 1, 1);
// gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_window_present (GTK_WINDOW (window)); gtk_window_present (GTK_WINDOW (window));
} }

13
warm.h
View File

@ -15,6 +15,9 @@
#include "cold.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
*
GtkWidget *switcher = gtk_stack_switcher_new(); GtkWidget *switcher = gtk_stack_switcher_new();
// GtkWidget *sidebar = gtk_stack_sidebar_new(); // GtkWidget *sidebar = gtk_stack_sidebar_new();
gtk_grid_attach (GTK_GRID (grid), switcher, 0, 1, 3, 1); gtk_grid_attach (GTK_GRID (grid), switcher, 0, 1, 3, 1);
@ -56,4 +59,14 @@
// gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE); // gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
) )
* 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 ( stack_selection_model, TRUE);
// gboolean gtk_selection_model_is_selected (GtkSelectionModel* model, guint position);
// gtk_selection_model_get_selected_item()
*
*
*
*/ */