essai gtk_paned_new()
This commit is contained in:
parent
6c2fbc3eaf
commit
5f2b9cad30
47
hot.h
47
hot.h
|
@ -22,34 +22,37 @@ void activate (GtkApplication *app, gpointer user_data) {
|
|||
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), stack);
|
||||
// gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), stack);
|
||||
|
||||
// GtkWidget *page_0 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
||||
// GtkWidget *page_1 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
||||
GtkWidget *box_0 = gtk_box_new (0, 0);
|
||||
GtkWidget *box_1 = gtk_box_new (0, 0);
|
||||
GtkWidget *box_2 = gtk_box_new (0, 0);
|
||||
GtkWidget *box_3 = gtk_box_new (0, 0);
|
||||
gtk_box_append (GTK_BOX (box_0), gtk_button_new_with_label ("00"));
|
||||
gtk_box_append (GTK_BOX (box_0), gtk_button_new_with_label ("01"));
|
||||
gtk_box_append (GTK_BOX (box_1), gtk_button_new_with_label ("10"));
|
||||
gtk_box_append (GTK_BOX (box_1), gtk_button_new_with_label ("11"));
|
||||
gtk_box_append (GTK_BOX (box_2), gtk_button_new_with_label ("20"));
|
||||
gtk_box_append (GTK_BOX (box_2), gtk_button_new_with_label ("21"));
|
||||
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"));
|
||||
GtkWidget *box_0 = gtk_box_new (0, 0);
|
||||
GtkWidget *box_1 = gtk_box_new (0, 0);
|
||||
GtkWidget *box_2 = gtk_box_new (0, 0);
|
||||
gtk_stack_add_titled (stack, box_0, "n°0", "A");
|
||||
gtk_stack_add_titled (stack, box_1, "n°1", "B");
|
||||
gtk_stack_add_titled (stack, box_2, "n°2", "C");
|
||||
gtk_grid_attach (GTK_GRID (grid), box_3, 0, 2, 1, 1);
|
||||
|
||||
|
||||
// GtkStackPage *page_2 = gtk_stack_add_titled (stack, box_1, "any name", "C");
|
||||
// gtk_stack_page_set_name (page_2, "n°2");
|
||||
|
||||
GtkSelectionModel *stack_selection_model = gtk_stack_get_pages (stack);
|
||||
gtk_selection_model_select_item (stack_selection_model, 1, 1);
|
||||
printf("selected page name is [%s] \n", gtk_stack_get_visible_child_name (stack));
|
||||
|
||||
|
||||
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 ("31"));
|
||||
gtk_grid_attach (GTK_GRID (grid), box_3, 0, 2, 1, 1);
|
||||
|
||||
GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
GtkWidget *frame1 = gtk_frame_new ("hello ?");
|
||||
GtkWidget *frame2 = gtk_frame_new ("it's me !");
|
||||
// gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN);
|
||||
// gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN);
|
||||
|
||||
gtk_widget_set_size_request (hpaned, 200, -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);
|
||||
|
||||
printf("selected page name is [%s] (how do I get its title ?)\n",
|
||||
gtk_stack_get_visible_child_name (stack));
|
||||
|
||||
// gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
||||
|
||||
|
|
43
warm.h
43
warm.h
|
@ -14,3 +14,46 @@
|
|||
#include <gtk-4.0/gtk/gtk.h>
|
||||
#include "cold.h"
|
||||
|
||||
/*
|
||||
GtkWidget *switcher = gtk_stack_switcher_new();
|
||||
// GtkWidget *sidebar = gtk_stack_sidebar_new();
|
||||
gtk_grid_attach (GTK_GRID (grid), switcher, 0, 1, 3, 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);
|
||||
|
||||
// GtkWidget *page_0 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
||||
// GtkWidget *page_1 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
||||
GtkWidget *box_0 = gtk_box_new (0, 0);
|
||||
GtkWidget *box_1 = gtk_box_new (0, 0);
|
||||
GtkWidget *box_2 = gtk_box_new (0, 0);
|
||||
GtkWidget *box_3 = gtk_box_new (0, 0);
|
||||
gtk_box_append (GTK_BOX (box_0), gtk_button_new_with_label ("00"));
|
||||
gtk_box_append (GTK_BOX (box_0), gtk_button_new_with_label ("01"));
|
||||
gtk_box_append (GTK_BOX (box_1), gtk_button_new_with_label ("10"));
|
||||
gtk_box_append (GTK_BOX (box_1), gtk_button_new_with_label ("11"));
|
||||
gtk_box_append (GTK_BOX (box_2), gtk_button_new_with_label ("20"));
|
||||
gtk_box_append (GTK_BOX (box_2), gtk_button_new_with_label ("21"));
|
||||
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_stack_add_titled (stack, box_0, "n°0", "A");
|
||||
gtk_stack_add_titled (stack, box_1, "n°1", "B");
|
||||
gtk_stack_add_titled (stack, box_2, "n°2", "C");
|
||||
gtk_grid_attach (GTK_GRID (grid), box_3, 0, 2, 1, 1);
|
||||
GtkWidget* combo = gtk_combo_box_new_with_entry (void);
|
||||
gtk_grid_attach (GTK_GRID (grid), combo, 0, 2, 2, 1);
|
||||
|
||||
// GtkStackPage *page_2 = gtk_stack_add_titled (stack, box_1, "any name", "C");
|
||||
// gtk_stack_page_set_name (page_2, "n°2");
|
||||
|
||||
GtkSelectionModel *stack_selection_model = gtk_stack_get_pages (stack);
|
||||
gtk_selection_model_select_item (stack_selection_model, 1, 1);
|
||||
|
||||
printf("selected page name is [%s] (how do I get its title ?)\n",
|
||||
gtk_stack_get_visible_child_name (stack));
|
||||
|
||||
// gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
||||
)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue