From 21085a50e2f7e736ff55305dc66197275128421d Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 15 Sep 2014 15:13:07 +0200 Subject: [PATCH] Add GtkStack example --- examples/gtk-clutter-multistage.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/gtk-clutter-multistage.c b/examples/gtk-clutter-multistage.c index ca394dd..9f5fd9f 100644 --- a/examples/gtk-clutter-multistage.c +++ b/examples/gtk-clutter-multistage.c @@ -8,7 +8,7 @@ main (int argc, char *argv[]) { ClutterActor *stage0, *stage1, *stage2, *tex1, *tex2; GtkWidget *window, *clutter0, *clutter1, *clutter2; - GtkWidget *notebook, *vbox; + GtkWidget *box, *stack, *stackswitcher, *vbox; ClutterColor col0 = { 0xdd, 0xff, 0xdd, 0xff }; ClutterColor col1 = { 0xff, 0xff, 0xff, 0xff }; ClutterColor col2 = { 0, 0, 0, 0xff }; @@ -21,18 +21,21 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Multiple GtkClutterEmbed"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); - notebook = gtk_notebook_new (); - gtk_container_add (GTK_CONTAINER (window), notebook); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + stackswitcher = gtk_stack_switcher_new (); + stack = gtk_stack_new (); + gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (stackswitcher), GTK_STACK (stack)); + gtk_container_add (GTK_CONTAINER (window), box); + gtk_container_add (GTK_CONTAINER (box), stackswitcher); + gtk_container_add (GTK_CONTAINER (box), stack); clutter0 = gtk_clutter_embed_new (); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), clutter0, - gtk_label_new ("One stage")); + gtk_stack_add_titled (GTK_STACK (stack), clutter0, "one", "One stage"); stage0 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter0)); clutter_actor_set_background_color (stage0, &col0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new ("Two stages")); + gtk_stack_add_titled (GTK_STACK (stack), vbox, "two", "Two stage"); clutter1 = gtk_clutter_embed_new (); gtk_widget_set_size_request (clutter1, 320, 240); -- 2.1.0