2008-10-20 Emmanuele Bassi <ebassi@linux.intel.com>
[clutter-gtk] / examples / gtk-clutter-multistage.c
1 #include <gtk/gtk.h>
2 #include <clutter/clutter.h>
3
4 #include <clutter-gtk/clutter-gtk.h>
5
6 int
7 main (int argc, char *argv[])
8 {
9   ClutterTimeline *timeline;
10   ClutterActor    *stage1, *stage2, *tex1, *tex2;
11   ClutterColor     stage_color = { 0x61, 0x64, 0x8c, 0xff };
12   GtkWidget       *window, *clutter1, *clutter2;
13   GtkWidget       *label, *button, *vbox;
14   GdkPixbuf       *pixbuf;
15   gint             i;
16   ClutterColor     col1 = { 0xff, 0xff, 0xff, 0xff };
17   ClutterColor     col2 = { 0, 0, 0, 0xff };
18
19   if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
20     g_error ("Unable to initialize GtkClutter");
21
22   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
23   g_signal_connect (window, "destroy",
24                     G_CALLBACK (gtk_main_quit), NULL);
25
26   vbox = gtk_vbox_new (FALSE, 6);
27   gtk_container_add (GTK_CONTAINER (window), vbox);
28
29   clutter1 = gtk_clutter_embed_new ();
30   gtk_widget_set_size_request (clutter1, 320, 240);
31   stage1 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter1));
32   clutter_stage_set_color (CLUTTER_STAGE(stage1), &col1);
33   tex1 = gtk_clutter_texture_new_from_stock (clutter1,
34                                              GTK_STOCK_DIALOG_INFO,
35                                              GTK_ICON_SIZE_DIALOG);
36   clutter_actor_set_anchor_point (tex1,
37                                   clutter_actor_get_width (tex1) / 2,
38                                   clutter_actor_get_height (tex1) / 2);
39   clutter_actor_set_position (tex1, 160, 120);
40   clutter_stage_add (stage1, tex1); 
41   clutter_actor_show (tex1);
42
43   gtk_container_add (GTK_CONTAINER (vbox), clutter1);
44
45   clutter2 = gtk_clutter_embed_new ();
46   gtk_widget_set_size_request (clutter2, 320, 240);
47   stage2 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter2));
48   clutter_stage_set_color (CLUTTER_STAGE(stage2), &col2);
49   tex2 = gtk_clutter_texture_new_from_icon_name (clutter1,
50                                                  "user-info",
51                                                  GTK_ICON_SIZE_BUTTON);
52   clutter_actor_set_anchor_point (tex2,
53                                   clutter_actor_get_width (tex2) / 2,
54                                   clutter_actor_get_height (tex2) / 2);
55   clutter_actor_set_position (tex2, 160, 120);
56   clutter_stage_add (stage2, tex2);
57
58   gtk_container_add (GTK_CONTAINER (vbox), clutter2);
59
60   gtk_widget_show_all (window);
61   clutter_actor_show_all (stage1); 
62   clutter_actor_show_all (stage2); 
63
64   gtk_main();
65
66   return 0;
67 }