summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2009-07-17 12:31:35 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-07-18 20:52:07 +0100
commita5b166c47791986b2f95146f8aebc22e365d975b (patch)
tree22ae2a8f2e41a7c3ae03252c7498c547ad89b254 /examples
parentd409fa6b7c1bfcda75a320f8b7153ab5ea2fe440 (diff)
downloadclutter-gtk-a5b166c47791986b2f95146f8aebc22e365d975b.tar.gz
[examples] Add a Notebook case
Embedding a Stage inside a notebook leads to interesting results: - if you call clutter_actor_show() on the embedded stage you'll probably get an unembedded stage - you might get small artifacts Let's update the gtk-clutter-multistage example by adding Notebook and embedding three stages inside two different pages.
Diffstat (limited to 'examples')
-rw-r--r--examples/gtk-clutter-multistage.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/examples/gtk-clutter-multistage.c b/examples/gtk-clutter-multistage.c
index ef4623a..9120603 100644
--- a/examples/gtk-clutter-multistage.c
+++ b/examples/gtk-clutter-multistage.c
@@ -17,11 +17,12 @@ on_stage2_allocation_changed (ClutterActor *stage_2,
int
main (int argc, char *argv[])
{
- ClutterActor *stage1, *stage2, *tex1, *tex2;
- GtkWidget *window, *clutter1, *clutter2;
- GtkWidget *vbox;
- ClutterColor col1 = { 0xff, 0xff, 0xff, 0xff };
- ClutterColor col2 = { 0, 0, 0, 0xff };
+ ClutterActor *stage0, *stage1, *stage2, *tex1, *tex2;
+ GtkWidget *window, *clutter0, *clutter1, *clutter2;
+ GtkWidget *notebook, *vbox;
+ ClutterColor col0 = { 0xdd, 0xff, 0xdd, 0xff };
+ ClutterColor col1 = { 0xff, 0xff, 0xff, 0xff };
+ ClutterColor col2 = { 0, 0, 0, 0xff };
if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
g_error ("Unable to initialize GtkClutter");
@@ -30,8 +31,19 @@ main (int argc, char *argv[])
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
+ notebook = gtk_notebook_new ();
+ gtk_container_add (GTK_CONTAINER (window), notebook);
+
+ clutter0 = gtk_clutter_embed_new ();
+ gtk_widget_set_size_request (clutter0, 320, 320);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), clutter0,
+ gtk_label_new ("One stage"));
+ stage0 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter0));
+ clutter_stage_set_color (CLUTTER_STAGE (stage0), &col0);
+
vbox = gtk_vbox_new (FALSE, 6);
- gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
+ gtk_label_new ("Two stages"));
clutter1 = gtk_clutter_embed_new ();
gtk_widget_set_size_request (clutter1, 320, 240);
@@ -69,8 +81,6 @@ main (int argc, char *argv[])
tex2);
gtk_widget_show_all (window);
- clutter_actor_show_all (stage1);
- clutter_actor_show_all (stage2);
gtk_main();