void clutter_box2_d_tests_clutter_box2_dlayout_manager_tests_test_clutterbox2d_layout_manager_hello_world (ClutterBox2DTestsClutterBox2DLayoutManagerTests* self) {
	ClutterBox2DLayoutManager* manager = NULL;
	ClutterBox2DLayoutManager* _tmp0_ = NULL;
	ClutterActor* world = NULL;
	ClutterActor* _tmp1_ = NULL;
	ClutterActor* actor = NULL;
	ClutterActor* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = clutter_box2_d_layout_manager_new ();
	g_object_ref_sink (_tmp0_);
	manager = _tmp0_;
	_tmp1_ = clutter_actor_new ();
	g_object_ref_sink (_tmp1_);
	world = _tmp1_;
	clutter_actor_set_layout_manager (world, (ClutterLayoutManager*) manager);
	_tmp2_ = clutter_actor_new ();
	g_object_ref_sink (_tmp2_);
	actor = _tmp2_;
	clutter_actor_set_size (actor, (gfloat) 150, (gfloat) 150);
	clutter_actor_set_position (actor, (gfloat) 100, (gfloat) 120);
	clutter_actor_add_child (world, actor);
	_g_object_unref0 (actor);
	_g_object_unref0 (world);
	_g_object_unref0 (manager);
}
예제 #2
0
static void
clutter_group_init (ClutterGroup *self)
{
  ClutterActor *actor = CLUTTER_ACTOR (self);

  self->priv = clutter_group_get_instance_private (self);

  /* turn on some optimization
   *
   * XXX - these so-called "optimizations" are insane and should have never
   * been used. they introduce some weird behaviour that breaks invariants
   * and have to be explicitly worked around.
   *
   * this flag was set by the ClutterFixedLayout, but since that layout
   * manager is now the default for ClutterActor, we set the flag explicitly
   * here, to avoid breaking perfectly working actors overriding the
   * allocate() virtual function.
   *
   * also, we keep this flag here so that it can die once we get rid of
   * ClutterGroup.
   */
  clutter_actor_set_flags (actor, CLUTTER_ACTOR_NO_LAYOUT);

  self->priv->layout = clutter_fixed_layout_new ();
  g_object_ref_sink (self->priv->layout);

  clutter_actor_set_layout_manager (actor, self->priv->layout);
}
예제 #3
0
static void
st_box_layout_init (StBoxLayout *self)
{
  ClutterLayoutManager *layout;

  self->priv = BOX_LAYOUT_PRIVATE (self);
  layout = clutter_box_layout_new ();
  g_signal_connect_swapped (layout, "layout-changed",
                            G_CALLBACK (clutter_actor_queue_relayout), self);
  g_signal_connect (layout, "notify", G_CALLBACK (layout_notify), self);
  clutter_actor_set_layout_manager (CLUTTER_ACTOR (self), layout);
}
예제 #4
0
static void slider_init(Slider *self) {
    SliderPrivate *priv;
    ClutterLayoutManager *layout;
    priv = self->priv = SLIDER_GET_PRIVATE(self);
    priv->pos = 0.5;

    layout = clutter_bin_layout_new(
        CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER);

    ClutterColor col = {127, 127, 127, 255};
    priv->box = clutter_actor_new();
    clutter_actor_set_background_color(priv->box, &col);
    clutter_actor_set_layout_manager(priv->box, layout);
    clutter_actor_set_reactive(CLUTTER_ACTOR(priv->box), TRUE);
    clutter_actor_add_child(CLUTTER_ACTOR(self), priv->box);

    col.red = 40;
    col.green = 40;
    col.blue = 70;
    priv->handle = clutter_actor_new();
    clutter_actor_set_background_color(priv->handle, &col);
    clutter_actor_set_layout_manager(priv->handle, layout);
    clutter_actor_set_reactive(CLUTTER_ACTOR(priv->handle), TRUE);
    clutter_actor_add_child(CLUTTER_ACTOR(self), priv->handle);

    priv->track_clicked = clutter_click_action_new();
    clutter_actor_add_action(CLUTTER_ACTOR(priv->box), priv->track_clicked);
    g_signal_connect(
        priv->track_clicked, "clicked", G_CALLBACK(slider_clicked), self);

    priv->handle_dragged = clutter_drag_action_new();
    clutter_actor_add_action(CLUTTER_ACTOR(priv->handle), priv->handle_dragged);
    g_signal_connect(
        priv->handle_dragged, "drag-motion", G_CALLBACK(handle_dragged), self);

    g_signal_connect(priv->box, "scroll-event", G_CALLBACK(scrolled), self);
    g_signal_connect(priv->handle, "scroll-event", G_CALLBACK(scrolled), self);
}
예제 #5
0
파일: main.c 프로젝트: skim/lcs-desktop
static int lcs_taskbar (int *argc, char ***argv)
{
	gdk_init (argc, argv);
    lcs_clutter_enable_transparency (TRUE);
    gtk_init (argc, argv);
    if (!clutter_init (argc, argv))
    {
        fprintf (stderr, "error initializing clutter");
        exit (1);
    }
    
    ClutterActor *stage = clutter_stage_new ();
    clutter_actor_set_layout_manager (
                         stage, 
                         clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_START,
                                                 CLUTTER_BIN_ALIGNMENT_START));
    clutter_stage_set_use_alpha (CLUTTER_STAGE (stage), TRUE);
    clutter_actor_set_background_color (stage, 
                                        clutter_color_new (255, 255, 255, 96));
    ClutterActor *taskbar = lcs_taskbar_new ();    
    clutter_actor_set_margin (taskbar, 
                              lcs_clutter_margin_new_full (4, 4, 4, 4));
    
    clutter_actor_add_child (stage, taskbar);
    g_signal_connect (stage, "destroy", G_CALLBACK (on_stage_destroy), NULL);

	ClutterAction *drag = clutter_drag_action_new ();
	g_signal_connect (drag, 
	                  "drag-motion", 
	                  G_CALLBACK (on_stage_drag_motion), 
	                  NULL);
	clutter_actor_add_action_with_name (stage, "drag", drag);
	
    clutter_actor_show (stage);
    
    long stagexid = lcs_wm_get_stage_xid (CLUTTER_STAGE(stage));
	g_object_set_data (G_OBJECT (stage), "xid", GINT_TO_POINTER (stagexid));
    lcs_wm_xwindow_set_decorated (stagexid, FALSE);
    lcs_wm_xwindow_set_above (stagexid);
	lcs_wm_xwindow_set_dock (stagexid);

        
    clutter_main ();
	return (0);

}
예제 #6
0
/* Object initialization
 * Create private structure and set up default values
 */
static void xfdashboard_view_selector_init(XfdashboardViewSelector *self)
{
	XfdashboardViewSelectorPrivate		*priv;

	priv=self->priv=XFDASHBOARD_VIEW_SELECTOR_GET_PRIVATE(self);

	/* Set up default values */
	priv->viewpad=NULL;
	priv->spacing=0.0f;
	priv->orientation=CLUTTER_ORIENTATION_HORIZONTAL;

	priv->layout=clutter_box_layout_new();
	clutter_box_layout_set_orientation(CLUTTER_BOX_LAYOUT(priv->layout), priv->orientation);

	/* Set up actor */
	clutter_actor_set_reactive(CLUTTER_ACTOR(self), TRUE);
	clutter_actor_set_layout_manager(CLUTTER_ACTOR(self), priv->layout);
}
예제 #7
0
static void
st_icon_init (StIcon *self)
{
  ClutterLayoutManager *layout_manager;

  self->priv = ST_ICON_GET_PRIVATE (self);

  layout_manager = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL,
                                           CLUTTER_BIN_ALIGNMENT_FILL);
  clutter_actor_set_layout_manager (CLUTTER_ACTOR (self), layout_manager);

  self->priv->icon_size = DEFAULT_ICON_SIZE;
  self->priv->prop_icon_size = -1;

  self->priv->shadow_pipeline = NULL;
  self->priv->shadow_width = -1;
  self->priv->shadow_height = -1;
}
예제 #8
0
/* object init: create a private structure and pack
 * composed ClutterActors into it
 */
static void
cb_button_init (CbButton *self)
{
  CbButtonPrivate *priv;
  ClutterLayoutManager *layout;

  priv = self->priv = CB_BUTTON_GET_PRIVATE (self);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);

  /* the only child of this actor is a ClutterBox with a
   * ClutterBinLayout: painting and allocation of the actor basically
   * involves painting and allocating this child box
   */
  layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
                                   CLUTTER_BIN_ALIGNMENT_CENTER);

  priv->child = clutter_actor_new ();
  clutter_actor_set_layout_manager (priv->child, layout);

  /* set the parent of the ClutterBox to this instance */
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->child);

  /* add text label to the button; see the ClutterText API docs
   * for more information about available properties
   */
  priv->label = g_object_new (CLUTTER_TYPE_TEXT,
                              "line-alignment", PANGO_ALIGN_CENTER,
                              "ellipsize", PANGO_ELLIPSIZE_END,
                              NULL);

  clutter_actor_add_child (priv->child, priv->label);

  /* add a ClutterClickAction on this actor, so we can proxy its
   * "clicked" signal into a signal from this actor
   */
  priv->click_action = clutter_click_action_new ();
  clutter_actor_add_action (CLUTTER_ACTOR (self), priv->click_action);

  g_signal_connect (priv->click_action,
                    "clicked",
                    G_CALLBACK (cb_button_clicked),
                    NULL);
}
예제 #9
0
static void meta_switcher_init(MetaSwitcher *self)
{
    MetaSwitcherPrivate* priv = self->priv = meta_switcher_get_instance_private(self);
    priv->selected_id = -1;

    priv->top = clutter_actor_new();
    ClutterLayoutManager* box = clutter_box_layout_new();
    clutter_box_layout_set_use_animations(CLUTTER_BOX_LAYOUT(box), TRUE);
    clutter_box_layout_set_easing_duration(CLUTTER_BOX_LAYOUT(box), 200);
    clutter_box_layout_set_easing_mode(CLUTTER_BOX_LAYOUT(box), CLUTTER_LINEAR);
    g_object_set(box, "spacing", 10, NULL);
    clutter_actor_set_layout_manager(priv->top, box);

    g_object_connect(G_OBJECT(priv->top), "signal::destroy", _emit_destroy, self, NULL);
    g_object_connect(priv->top,
            "signal::button-press-event", on_button_press, self,
            "signal::key-press-event", on_key_press, self,
            "signal::key-release-event", on_key_release, self,
            "signal::captured-event", on_captured_event, self,
            NULL);
    clutter_actor_hide(priv->top);
}
예제 #10
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage, *box, *bg, *icon, *emblem, *label;
  ClutterLayoutManager *layout;
  ClutterContent *canvas, *image;
  ClutterColor *color;
  ClutterAction *action;
  GdkPixbuf *pixbuf;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  /* prepare the stage */
  stage = clutter_stage_new ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "BinLayout");
  clutter_actor_set_background_color (stage, CLUTTER_COLOR_Aluminium2);
  clutter_actor_set_size (stage, 640, 480);
  clutter_actor_show (stage);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  /* this is our BinLayout, with its default alignments */
  layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
                                   CLUTTER_BIN_ALIGNMENT_CENTER);

  /* the main container; this actor will use the BinLayout to lay
   * out its children; we use the anchor point to keep it centered
   * on the same position even when we change its size
   */
  box = clutter_actor_new ();
  clutter_actor_set_layout_manager (box, layout);
  clutter_actor_add_constraint (box, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
  clutter_actor_set_position (box, 320, 240);
  clutter_actor_set_reactive (box, TRUE);
  clutter_actor_set_name (box, "box");
  clutter_actor_add_child (stage, box);

  /* the background is drawn using a canvas content */
  canvas = clutter_canvas_new ();
  g_signal_connect (canvas, "draw", G_CALLBACK (on_canvas_draw), NULL);
  clutter_canvas_set_size (CLUTTER_CANVAS (canvas), 200, 200);

  /* this is the background actor; we want it to fill the whole
   * of the allocation given to it by its parent
   */
  bg = clutter_actor_new ();
  clutter_actor_set_name (bg, "background");
  clutter_actor_set_size (bg, 200, 200);
  clutter_actor_set_content (bg, canvas);
  clutter_actor_set_x_expand (bg, TRUE);
  clutter_actor_set_y_expand (bg, TRUE);
  clutter_actor_set_x_align (bg, CLUTTER_ACTOR_ALIGN_FILL);
  clutter_actor_set_y_align (bg, CLUTTER_ACTOR_ALIGN_FILL);
  clutter_actor_add_child (box, bg);
  /* we use the ::transitions-completed signal to get notification
   * of the end of the sizing animation; this allows us to redraw
   * the canvas only once the animation has stopped
   */
  g_signal_connect (box, "transitions-completed",
                    G_CALLBACK (redraw_canvas),
                    canvas);

  /* we use GdkPixbuf to load an image from our data directory */
  pixbuf = gdk_pixbuf_new_from_file (TESTS_DATADIR G_DIR_SEPARATOR_S "redhand.png", NULL);
  image = clutter_image_new ();
  clutter_image_set_data (CLUTTER_IMAGE (image),
                          gdk_pixbuf_get_pixels (pixbuf),
                          gdk_pixbuf_get_has_alpha (pixbuf)
                            ? COGL_PIXEL_FORMAT_RGBA_8888
                            : COGL_PIXEL_FORMAT_RGB_888,
                          gdk_pixbuf_get_width (pixbuf),
                          gdk_pixbuf_get_height (pixbuf),
                          gdk_pixbuf_get_rowstride (pixbuf),
                          NULL);
  g_object_unref (pixbuf);

  /* this is the icon; it's going to be centered inside the box actor.
   * we use the content gravity to keep the aspect ratio of the image,
   * and the scaling filters to get a better result when scaling the
   * image down.
   */
  icon = clutter_actor_new ();
  clutter_actor_set_name (icon, "icon");
  clutter_actor_set_size (icon, 196, 196);
  clutter_actor_set_x_expand (icon, TRUE);
  clutter_actor_set_y_expand (icon, TRUE);
  clutter_actor_set_x_align (icon, CLUTTER_ACTOR_ALIGN_CENTER);
  clutter_actor_set_y_align (icon, CLUTTER_ACTOR_ALIGN_CENTER);
  clutter_actor_set_content_gravity (icon, CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT);
  clutter_actor_set_content_scaling_filters (icon,
                                             CLUTTER_SCALING_FILTER_TRILINEAR,
                                             CLUTTER_SCALING_FILTER_LINEAR);
  clutter_actor_set_content (icon, image);
  clutter_actor_add_child (box, icon);

  color = clutter_color_new (g_random_int_range (0, 255),
                             g_random_int_range (0, 255),
                             g_random_int_range (0, 255),
                             224);

  /* this is the emblem: a small rectangle with a random color, that we
   * want to put in the bottom right corner
   */
  emblem = clutter_actor_new ();
  clutter_actor_set_name (emblem, "emblem");
  clutter_actor_set_size (emblem, 48, 48);
  clutter_actor_set_background_color (emblem, color);
  clutter_actor_set_x_expand (emblem, TRUE);
  clutter_actor_set_y_expand (emblem, TRUE);
  clutter_actor_set_x_align (emblem, CLUTTER_ACTOR_ALIGN_END);
  clutter_actor_set_y_align (emblem, CLUTTER_ACTOR_ALIGN_END);
  clutter_actor_set_reactive (emblem, TRUE);
  clutter_actor_set_opacity (emblem, 0);
  clutter_actor_add_child (box, emblem);
  clutter_color_free (color);

  /* when clicking on the emblem, we want to perform an action */
  action = clutter_click_action_new ();
  clutter_actor_add_action (emblem, action);
  g_signal_connect (action, "clicked", G_CALLBACK (on_emblem_clicked), box);
  g_signal_connect (action, "long-press", G_CALLBACK (on_emblem_long_press), box);

  /* whenever the pointer enters the box, we show the emblem; we hide
   * the emblem when the pointer leaves the box
   */
  g_signal_connect (box,
                    "enter-event", G_CALLBACK (on_box_enter),
                    emblem);
  g_signal_connect (box,
                    "leave-event", G_CALLBACK (on_box_leave),
                    emblem);

  /* a label, that we want to position at the top and center of the box */
  label = clutter_text_new ();
  clutter_actor_set_name (label, "text");
  clutter_text_set_text (CLUTTER_TEXT (label), "A simple test");
  clutter_actor_set_x_expand (label, TRUE);
  clutter_actor_set_x_align (label, CLUTTER_ACTOR_ALIGN_CENTER);
  clutter_actor_set_y_expand (label, TRUE);
  clutter_actor_set_y_align (label, CLUTTER_ACTOR_ALIGN_START);
  clutter_actor_add_child (box, label);

  clutter_main ();

  return EXIT_SUCCESS;
}
예제 #11
0
int
main (int argc, char *argv[])
{
  ClutterActor *video;

  /* So we can fade out at the end. */
  clutter_x11_set_use_argb_visual (TRUE);

  if (clutter_gst_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return EXIT_FAILURE;

  if (argc < 2)
    {
      g_print ("Usage: %s [OPTIONS] <video file>\n", argv[0]);
      return EXIT_FAILURE;
    }

  if (!clutter_color_from_string (&bg_color, BG_COLOR))
    {
      g_warning ("Invalid BG_COLOR");
      exit (1);
    }

  stage = clutter_stage_new ();

  /* Clutter's full-screening code does not allow us to
   * set both that and _NET_WM_STATE_ABOVE, so do the state
   * management ourselves for now. */
#if 0
  clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE);
#endif

  /* Clutter will set maximum size restrictions (meaning not
   * full screen) unless I set this. */
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);

  clutter_stage_set_use_alpha (CLUTTER_STAGE (stage), TRUE);

  clutter_actor_set_background_color (stage, &bg_color);
  clutter_actor_set_layout_manager (stage,
                                    clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FIXED,
                                                            CLUTTER_BIN_ALIGNMENT_FIXED));

  clutter_actor_realize (stage);
  set_above_and_fullscreen ();

  video = clutter_gst_video_texture_new ();
  clutter_actor_set_x_expand (video, TRUE);
  clutter_actor_set_y_expand (video, TRUE);
  clutter_actor_set_x_align (video, CLUTTER_ACTOR_ALIGN_CENTER);
  clutter_actor_set_y_align (video, CLUTTER_ACTOR_ALIGN_CENTER);
  set_idle_material (CLUTTER_GST_VIDEO_TEXTURE (video));

  g_signal_connect (video,
                    "eos",
                    G_CALLBACK (on_video_texture_eos),
                    NULL);

  g_signal_connect (stage,
                    "destroy",
                    G_CALLBACK (clutter_main_quit),
                    NULL);

  clutter_media_set_filename (CLUTTER_MEDIA (video), argv[1]);
  clutter_stage_hide_cursor (CLUTTER_STAGE (stage));

  clutter_actor_add_child (stage, video);

  g_signal_connect (stage, "key-press-event", G_CALLBACK (key_press_cb), NULL);

  clutter_media_set_playing (CLUTTER_MEDIA (video), TRUE);
  clutter_actor_show (stage);
  clutter_main ();

  return EXIT_SUCCESS;
}
예제 #12
0
int
main (int argc, char *argv[])
{
	ClutterActor *stage, *box, *bg, *bg2, *inset, *labelContainer,
	             *contentContainer, *labelbg, *fixed, *upper, *lower, *lowerInner;
	ClutterLayoutManager *layout, *labelContainer_l, *layoutFixed;
	ClutterTimeline *timeline;
	ClutterContent *canvas, *canvas1;

	ClutterColor color_with_trans = {0,0,0,0};
	clutter_x11_set_use_argb_visual (TRUE);

	if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
	    return (1);

	/* prepare the stage */
	stage = clutter_stage_new ();
	clutter_stage_set_use_alpha (CLUTTER_STAGE (stage), TRUE);
	clutter_stage_set_color (CLUTTER_STAGE (stage), &color_with_trans);
	clutter_stage_set_title (CLUTTER_STAGE (stage), "IPLocation Database");
	clutter_actor_set_background_color (stage, CLUTTER_COLOR_WHITE);
	clutter_actor_set_size (stage, 648, 246);
	clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
	clutter_actor_show (stage);
	g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

	layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
			CLUTTER_BIN_ALIGNMENT_CENTER);

	box = clutter_actor_new ();
	clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0));
	clutter_actor_set_background_color (box, CLUTTER_COLOR_WHITE);
	clutter_actor_set_layout_manager (box, layout);
	clutter_actor_add_constraint (box, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 1));
	clutter_actor_set_name (box, "box");
	clutter_actor_add_child (stage, box);


	bg = clutter_actor_new ();
	//clutter_actor_set_background_color (bg, clutter_color_new (50, 50, 50, 255));
	clutter_actor_set_name (bg, "background");
	clutter_actor_set_reactive (bg, TRUE);
	//clutter_actor_set_x_expand (bg, TRUE);
	//clutter_actor_set_y_expand (bg, TRUE);
	clutter_actor_set_x_align (bg, CLUTTER_ACTOR_ALIGN_END);
	clutter_actor_set_y_align (bg, CLUTTER_ACTOR_ALIGN_FILL);
	canvas1 = clutter_canvas_new ();
	clutter_canvas_set_size (CLUTTER_CANVAS (canvas1), 300, 300);
	clutter_actor_set_content (bg, canvas1);
	/*clutter_actor_set_content_scaling_filters (bg2,
		 CLUTTER_SCALING_FILTER_TRILINEAR,
		 CLUTTER_SCALING_FILTER_LINEAR);*/
	g_object_unref (canvas1);
	clutter_actor_add_child (box, bg);


	bg2 = clutter_actor_new ();
	//clutter_actor_set_background_color (bg2, clutter_color_new (0, 100, 100, 255*.5));
	clutter_actor_set_name (bg2, "background");
	clutter_actor_set_reactive (bg2, TRUE);
	clutter_actor_set_size (bg2, 0, 0);
	//clutter_actor_set_x_expand (bg2, TRUE);
	//clutter_actor_set_y_expand (bg2, TRUE);
	clutter_actor_set_x_align (bg2, CLUTTER_ACTOR_ALIGN_END);
	clutter_actor_set_y_align (bg2, CLUTTER_ACTOR_ALIGN_FILL);
	clutter_actor_set_clip_to_allocation(bg2, TRUE);
	clutter_actor_add_child (box, bg2);
	clutter_actor_set_layout_manager (bg2, clutter_box_layout_new ());
	canvas = clutter_canvas_new ();
	clutter_canvas_set_size (CLUTTER_CANVAS (canvas), 300, 300);
	clutter_actor_set_content (bg2, canvas);
	/*clutter_actor_set_content_scaling_filters (bg2,
		 CLUTTER_SCALING_FILTER_TRILINEAR,
		 CLUTTER_SCALING_FILTER_LINEAR);*/
	g_object_unref (canvas);


	inset = clutter_actor_new ();
	//clutter_actor_set_background_color (inset, clutter_color_new (255, 0, 0, 255));
	clutter_actor_set_name (inset, "inset");
	clutter_actor_set_reactive (inset, TRUE);


	clutter_actor_set_margin_top (inset, 18);
	clutter_actor_set_margin_right (inset, 18);
	clutter_actor_set_margin_bottom (inset, 18);
	clutter_actor_set_margin_left (inset, 48);
	//clutter_actor_set_x_expand (inset, TRUE);
	//clutter_actor_set_y_expand (inset, TRUE);
	clutter_actor_set_x_align (inset, CLUTTER_ACTOR_ALIGN_FILL);
	clutter_actor_set_y_align (inset, CLUTTER_ACTOR_ALIGN_FILL);
	clutter_actor_set_clip_to_allocation(inset, TRUE);
	clutter_actor_add_child (bg2, inset);


	layout = clutter_box_layout_new ();
	clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (layout),
	                                    TRUE);
	clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layout), 5);
	clutter_actor_set_layout_manager (inset, layout);


	labelContainer = clutter_actor_new ();
	clutter_actor_set_size (labelContainer, 0, 35);
	//clutter_actor_set_background_color (labelContainer, clutter_color_new (34, 134, 158, 255));
	clutter_actor_set_name (labelContainer, "labelContainer");
	clutter_actor_set_reactive (labelContainer, TRUE);
	//clutter_actor_set_x_expand (labelContainer, TRUE);
	//clutter_actor_set_y_expand (labelContainer, TRUE);
	clutter_actor_add_child (inset, labelContainer);

	labelContainer_l = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
			CLUTTER_BIN_ALIGNMENT_CENTER);
	clutter_actor_set_layout_manager (labelContainer, labelContainer_l);


	labelbg = clutter_actor_new ();
	clutter_actor_set_background_color (labelbg, clutter_color_new (34, 134, 158, 255));
	clutter_actor_set_name (labelbg, "labelbg");
	//clutter_actor_set_x_expand (labelbg, TRUE);
	clutter_actor_set_size (labelbg, 0, 35);
	clutter_actor_set_x_align (labelbg, CLUTTER_ACTOR_ALIGN_START);
	clutter_actor_set_y_align (labelbg, CLUTTER_ACTOR_ALIGN_FILL);
	clutter_actor_add_child (labelContainer, labelbg);


	contentContainer = clutter_actor_new ();
	clutter_actor_set_size (contentContainer, 0, 0);

	clutter_actor_set_background_color (contentContainer, clutter_color_new (0.290196*255, 0.427451*255, 0.462745*255, 255));
	clutter_actor_set_name (contentContainer, "labelContainer");
	//clutter_actor_set_x_expand (contentContainer, TRUE);
	//clutter_actor_set_y_expand (contentContainer, TRUE);
	clutter_actor_set_layout_manager (contentContainer, clutter_fixed_layout_new ());
	clutter_actor_add_child (inset, contentContainer);

	fixed = clutter_actor_new ();
	clutter_actor_set_background_color (fixed, clutter_color_new (9, 53, 71, 255));
	clutter_actor_set_name (fixed, "fixed");
	clutter_actor_set_size (fixed, 582, 210-40);
	clutter_actor_set_position (fixed, 582, 0);
	layoutFixed = clutter_box_layout_new ();
	clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (layoutFixed),
		                                TRUE);
	clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layoutFixed), 8);
	clutter_actor_set_layout_manager (fixed, layoutFixed);
	clutter_actor_add_child (contentContainer, fixed);


	//------------------------------------------------------------------------//

	lower = clutter_actor_new ();
	clutter_actor_set_size (lower, 0, 0);
	clutter_actor_set_name (lower, "lower");
	//clutter_actor_set_x_expand (lower, TRUE);
	//clutter_actor_set_y_expand (lower, TRUE);
	clutter_actor_set_margin_right (lower, 8);
	clutter_actor_set_margin_top (lower, 8);
	clutter_actor_set_margin_left (lower, 8);
	clutter_actor_set_layout_manager (lower, clutter_fixed_layout_new ());
	clutter_actor_set_clip_to_allocation(lower, TRUE);
	clutter_actor_add_child (fixed, lower);

	lowerInner = clutter_actor_new ();
	clutter_actor_set_background_color (lowerInner, clutter_color_new (255, 255, 255, 30));
	clutter_actor_set_name (lowerInner, "fixed");
	clutter_actor_set_size (lowerInner, 566, 113);
	clutter_actor_set_position (lowerInner, 566, 0);
	clutter_actor_add_child (lower, lowerInner);


	upper = clutter_actor_new ();
	clutter_actor_set_size (upper, 0, 33);
	clutter_actor_set_name (upper, "upper");
	clutter_actor_set_x_expand (upper, TRUE);
	//clutter_actor_set_y_expand (upper, TRUE);
	clutter_actor_set_margin_bottom (upper, 8);
	clutter_actor_set_margin_right (upper, 8);
	clutter_actor_set_margin_left (upper, 8);
	//clutter_actor_set_layout_manager (upper, clutter_fixed_layout_new ());
	clutter_actor_add_child (fixed, upper);


	timeline = clutter_timeline_new (57/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "first", (40-35)/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "second", (46-35)/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "third", (51-35)/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "fourth", (52-35)/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "fifth", (58-35)/24.*1000);

	g_signal_connect (timeline, "marker-reached::first", G_CALLBACK (plate1anim), bg);
	g_signal_connect (timeline, "marker-reached::second", G_CALLBACK (plate2anim), bg2);
	g_signal_connect (timeline, "marker-reached::third", G_CALLBACK (plate3anim), labelbg);
	g_signal_connect (timeline, "marker-reached::fourth", G_CALLBACK (plate4anim), fixed);
	g_signal_connect (timeline, "marker-reached::fifth", G_CALLBACK (plate5anim), lowerInner);
	g_signal_connect (canvas1, "draw", G_CALLBACK (draw_1), NULL);
	g_signal_connect (bg, "paint", G_CALLBACK (on_actor_resize), canvas);
	g_signal_connect (canvas, "draw", G_CALLBACK (draw), NULL);
	g_signal_connect (bg2, "paint", G_CALLBACK (on_actor_resize), canvas);


	clutter_content_invalidate (canvas);

	clutter_timeline_start (timeline);
	clutter_main ();

	return (EXIT_SUCCESS);
}
예제 #13
0
int
main (int argc, char *argv[])
{
  ClutterLayoutManager *layout;
  ClutterActor *box;
  ClutterActor *stage;
  ClutterActor *texture;
  CoglHandle *cogl_texture;
  GError *error = NULL;
  gfloat width;

  const gchar *filename = "redhand.png";

  if (argc > 1)
    filename = argv[1];

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
                                   CLUTTER_BIN_ALIGNMENT_CENTER);

  box = clutter_actor_new ();
  clutter_actor_set_layout_manager (box, layout);
  clutter_actor_set_background_color (box, &box_color);

  texture = clutter_texture_new_from_file (filename, &error);

  if (error != NULL)
    g_error ("Error loading file %s; message was:\n%s",
             filename,
             error->message);

  /*
   * get a reference to the underlying Cogl texture
   * for copying onto each Clutter texture placed into the layout
   */
  cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (texture));

  /*
   * add gradually turning and shrinking textures,
   * smallest one last; each actor ends up on top
   * of the one added just before it
   */
  for (width = STAGE_SIDE * 0.75; width >= STAGE_SIDE * 0.0625; width -= STAGE_SIDE * 0.0625)
    {
      ClutterActor *texture_copy = clutter_texture_new ();
      clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (texture_copy),
                                        cogl_texture);
      clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture_copy),
                                             TRUE);
      clutter_actor_set_z_rotation_from_gravity (texture_copy,
                                                 (gfloat)(width * 0.5) - (STAGE_SIDE * 0.03125),
                                                 CLUTTER_GRAVITY_CENTER);
      clutter_actor_set_width (texture_copy, width);
      clutter_actor_add_child (box, texture_copy);
    }

  clutter_actor_add_constraint (box, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
  clutter_actor_add_child (stage, box);

  clutter_actor_show (stage);

  clutter_main ();

  return 0;
}
예제 #14
0
int
main (int   argc,
      char *argv[])
{
  ClutterActor *stage;
  ClutterLayoutManager *box_layout;
  ClutterActor *box;
  ClutterActor *yellow;
  ClutterActor *red;
  ClutterActor *blue;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, 400, 400);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  /* create a ClutterBoxLayout */
  box_layout = clutter_box_layout_new ();

  /* configure it to lay out actors vertically */
  clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (box_layout), TRUE);

  /* put 5px of spacing between actors */
  clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (box_layout), 5);

  /* actors are packed into this actor; we set its width, but
   * allow its height to be determined by the children it contains
   */
  box = clutter_actor_new ();
  clutter_actor_set_layout_manager (box, box_layout);
  clutter_actor_set_background_color (box, CLUTTER_COLOR_White);
  clutter_actor_set_position (box, 100, 50);
  clutter_actor_set_width (box, 200);

  /* pack an actor into the layout and set all layout properties on it
   * at the same time
   */
  yellow = clutter_actor_new ();
  clutter_actor_set_background_color (yellow, CLUTTER_COLOR_Yellow);
  clutter_actor_set_size (yellow, 100, 100);

  clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (box_layout),
                           yellow,
                           FALSE,                         /* expand */
                           TRUE,                          /* x-fill */
                           FALSE,                         /* y-fill */
                           CLUTTER_BOX_ALIGNMENT_START,   /* x-align */
                           CLUTTER_BOX_ALIGNMENT_START);  /* y-align */

  /* add an actor to the box as a container and set layout properties
   * afterwards; the latter is useful if you want to change properties on
   * actors already inside a layout, but note that you have to
   * pass the function both the layout AND the container
   */
  red = clutter_actor_new ();
  clutter_actor_set_background_color (red, CLUTTER_COLOR_Red);
  clutter_actor_set_size (red, 100, 100);

  clutter_actor_add_child (box, red);
  clutter_layout_manager_child_set (box_layout,
                                    CLUTTER_CONTAINER (box),
                                    red,
                                    "x-fill", TRUE,
                                    NULL);

  blue = clutter_actor_new ();
  clutter_actor_set_background_color (blue, CLUTTER_COLOR_Blue);
  clutter_actor_set_size (blue, 100, 100);

  clutter_actor_add_child (box, blue);
  clutter_layout_manager_child_set (box_layout,
                                    CLUTTER_CONTAINER (box),
                                    blue,
                                    "x-fill", TRUE,
                                    NULL);

  /* put the box on the stage */
  clutter_actor_add_child (stage, box);

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
예제 #15
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage, *box;
  ClutterLayoutManager *layout;
  GError *error;
  gint i;

  error = NULL;
  if (clutter_init_with_args (&argc, &argv,
                              NULL,
                              entries,
                              NULL,
                              &error) != CLUTTER_INIT_SUCCESS)
    {
      g_print ("Unable to run flow-layout: %s", error->message);
      g_error_free (error);

      return EXIT_FAILURE;
    }

  stage = clutter_stage_new ();
  clutter_actor_set_background_color (stage, CLUTTER_COLOR_LightSkyBlue);
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Flow Layout");
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  layout = clutter_flow_layout_new (vertical ? CLUTTER_FLOW_VERTICAL
                                             : CLUTTER_FLOW_HORIZONTAL);
  clutter_flow_layout_set_homogeneous (CLUTTER_FLOW_LAYOUT (layout),
                                       is_homogeneous);
  clutter_flow_layout_set_column_spacing (CLUTTER_FLOW_LAYOUT (layout),
                                          x_spacing);
  clutter_flow_layout_set_row_spacing (CLUTTER_FLOW_LAYOUT (layout),
                                       y_spacing);

  box = clutter_actor_new ();
  clutter_actor_set_layout_manager (box, layout);
  clutter_actor_set_background_color (box, CLUTTER_COLOR_Aluminium2);
  clutter_actor_add_child (stage, box);

  if (!fixed_size)
    clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0));

  clutter_actor_set_position (box, 0, 0);
  clutter_actor_set_name (box, "box");

  for (i = 0; i < n_rects; i++)
    {
      ClutterColor color = CLUTTER_COLOR_INIT (255, 255, 255, 255);
      gfloat width, height;
      ClutterActor *rect;
      gchar *name;

      name = g_strdup_printf ("rect%02d", i);

      clutter_color_from_hls (&color,
                              360.0 / n_rects * i,
                              0.5,
                              0.8);
      rect = clutter_actor_new ();
      clutter_actor_set_background_color (rect, &color);

      if (random_size)
        {
          width = g_random_int_range (50, 100);
          height = g_random_int_range (50, 100);
        }
      else
        width = height = 50.f;

      clutter_actor_set_size (rect, width, height);
      clutter_actor_set_name (rect, name);

      clutter_actor_add_child (box, rect);

      g_free (name);
    }

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
int
main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterLayoutManager *layout;
  ClutterActor *box;
  ClutterActor *rect;
  ClutterActor *text;
  ClutterState *transitions;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "btn");
  clutter_actor_set_background_color (stage, &stage_color);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL,
                                   CLUTTER_BIN_ALIGNMENT_FILL);

  box = clutter_actor_new ();
  clutter_actor_set_layout_manager (box, layout);
  clutter_actor_set_position (box, 25, 25);
  clutter_actor_set_reactive (box, TRUE);
  clutter_actor_set_size (box, 100, 30);

  /* background for the button */
  rect = clutter_rectangle_new_with_color (&yellow);
  clutter_actor_add_child (box, rect);

  /* text for the button */
  text = clutter_text_new_full ("Sans 10pt", "Hover me", &white);

  /*
   * NB don't set the height, so the actor assumes the height of the text;
   * then when added to the bin layout, it gets centred on it;
   * also if you don't set the width, the layout goes gets really wide;
   * the 10pt text fits inside the 30px height of the rectangle
   */
  clutter_actor_set_width (text, 100);
  clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout),
                          text,
                          CLUTTER_BIN_ALIGNMENT_CENTER,
                          CLUTTER_BIN_ALIGNMENT_CENTER);

  /* animations */
  transitions = clutter_state_new ();
  clutter_state_set (transitions, NULL, "fade-out",
                     box, "opacity", CLUTTER_LINEAR, 180,
                     NULL);

 /*
  * NB you can't use an easing mode where alpha > 1.0 if you're
  * animating to a value of 255, as the value you're animating
  * to will possibly go > 255
  */
  clutter_state_set (transitions, NULL, "fade-in",
                     box, "opacity", CLUTTER_LINEAR, 255,
                     NULL);

  clutter_state_set_duration (transitions, NULL, NULL, 50);

  clutter_state_warp_to_state (transitions, "fade-out");

  g_signal_connect (box,
                    "enter-event",
                    G_CALLBACK (_pointer_enter_cb),
                    transitions);

  g_signal_connect (box,
                    "leave-event",
                    G_CALLBACK (_pointer_leave_cb),
                    transitions);

  /* bind the stage size to the box size + 50px in each axis */
  clutter_actor_add_constraint (stage, clutter_bind_constraint_new (box, CLUTTER_BIND_HEIGHT, 50.0));
  clutter_actor_add_constraint (stage, clutter_bind_constraint_new (box, CLUTTER_BIND_WIDTH, 50.0));

  clutter_actor_add_child (stage, box);

  clutter_actor_show (stage);

  clutter_main ();

  g_object_unref (transitions);

  return 0;
}
예제 #17
0
static void
add_actor (ClutterActor *box,
           gint          left,
           gint          top,
           gint          width,
           gint          height)
{
  ClutterLayoutManager *layout;
  ClutterActor *rect, *text;
  ClutterColor color;

  clutter_color_from_hls (&color,
                          g_random_double_range (0.0, 360.0),
                          0.5,
                          0.5);
  color.alpha = 255;

  rect = clutter_actor_new ();
  clutter_actor_set_layout_manager (rect, clutter_bin_layout_new ());
  clutter_actor_set_background_color (rect, &color);
  clutter_actor_set_reactive (rect, TRUE);

  if (random_size)
    clutter_actor_set_size (rect,
                            g_random_int_range (40, 80),
                            g_random_int_range (40, 80));
  else
    clutter_actor_set_size (rect, 60, 60);

  clutter_actor_set_x_expand (rect, default_expand);
  clutter_actor_set_y_expand (rect, default_expand);

  if (!default_expand)
    {
      clutter_actor_set_x_align (rect, CLUTTER_ACTOR_ALIGN_CENTER);
      clutter_actor_set_y_align (rect, CLUTTER_ACTOR_ALIGN_CENTER);
    }

  if (random_align)
    {
      clutter_actor_set_x_align (rect, g_random_int_range (0, 3));
      clutter_actor_set_y_align (rect, g_random_int_range (0, 3));
    }

  text = clutter_text_new_with_text ("Sans 8px", NULL);
  clutter_text_set_line_alignment (CLUTTER_TEXT (text),
                                   PANGO_ALIGN_CENTER);
  clutter_actor_add_child (rect, text);

  g_signal_connect (rect, "button-release-event",
                    G_CALLBACK (button_release_cb), NULL);
  g_signal_connect (rect, "notify::x-expand",
                    G_CALLBACK (changed_cb), text);
  g_signal_connect (rect, "notify::y-expand",
                    G_CALLBACK (changed_cb), text);
  g_signal_connect (rect, "notify::x-align",
                    G_CALLBACK (changed_cb), text);
  g_signal_connect (rect, "notify::y-align",
                    G_CALLBACK (changed_cb), text);

  layout = clutter_actor_get_layout_manager (box);
  if (use_box)
    clutter_actor_add_child (box, rect);
  else
    clutter_grid_layout_attach (CLUTTER_GRID_LAYOUT (layout), rect,
                                left, top, width, height);
  changed_cb (rect, NULL, text);
}
예제 #18
0
G_MODULE_EXPORT gint
test_text_field_main (gint    argc,
                      gchar **argv)
{
  ClutterActor *stage;
  ClutterActor *box, *label, *entry;
  ClutterLayoutManager *table;
  PangoAttrList *entry_attrs;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return EXIT_FAILURE;

  stage = clutter_stage_new ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Text Fields");
  clutter_actor_set_background_color (stage, CLUTTER_COLOR_Black);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  table = clutter_table_layout_new ();
  clutter_table_layout_set_column_spacing (CLUTTER_TABLE_LAYOUT (table), 6);
  clutter_table_layout_set_row_spacing (CLUTTER_TABLE_LAYOUT (table), 6);

  box = clutter_actor_new ();
  clutter_actor_set_layout_manager (box, table);
  clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -24.0));
  clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -24.0));
  clutter_actor_set_position (box, 12, 12);
  clutter_actor_add_child (stage, box);

  label = create_label (CLUTTER_COLOR_White, "<b>Input field:</b>");
  g_object_set (label, "min-width", 150.0, NULL);
  clutter_actor_add_child (box, label);
  clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), label,
                                    "row", 0,
                                    "column", 0,
                                    "x-expand", FALSE,
                                    "y-expand", FALSE,
                                    NULL);

  entry_attrs = pango_attr_list_new ();
  pango_attr_list_insert (entry_attrs, pango_attr_underline_new (PANGO_UNDERLINE_ERROR));
  pango_attr_list_insert (entry_attrs, pango_attr_underline_color_new (65535, 0, 0));
  entry = create_entry (CLUTTER_COLOR_Black, "somme misspeeled textt", entry_attrs, 0, 0);
  clutter_actor_add_child (box, entry);
  clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), entry,
                                    "row", 0,
                                    "column", 1,
                                    "x-expand", TRUE,
                                    "x-fill", TRUE,
                                    "y-expand", FALSE,
                                    NULL);
  clutter_actor_grab_key_focus (entry);

  label = create_label (CLUTTER_COLOR_White, "<b>A very long password field:</b>");
  clutter_actor_add_child (box, label);
  clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), label,
                                    "row", 1,
                                    "column", 0,
                                    "x-expand", FALSE,
                                    "y-expand", FALSE,
                                    NULL);

  entry = create_entry (CLUTTER_COLOR_Black, "password", NULL, '*', 8);
  clutter_actor_add_child (box, entry);
  clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), entry,
                                    "row", 1,
                                    "column", 1,
                                    "x-expand", TRUE,
                                    "x-fill", TRUE,
                                    "y-expand", FALSE,
                                    NULL);

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
예제 #19
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage, *box, *instructions;
  ClutterLayoutManager *stage_layout, *grid_layout;
  GError *error = NULL;

  if (clutter_init_with_args (&argc, &argv,
                              NULL,
                              entries,
                              NULL,
                              &error) != CLUTTER_INIT_SUCCESS)
    {
      g_print ("Unable to run grid-layout: %s", error->message);
      g_error_free (error);

      return EXIT_FAILURE;
    }

  stage = clutter_stage_new ();
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
  stage_layout = clutter_box_layout_new ();
  clutter_box_layout_set_orientation (CLUTTER_BOX_LAYOUT (stage_layout),
                                      CLUTTER_ORIENTATION_VERTICAL);
  clutter_actor_set_layout_manager (stage, stage_layout);

  grid_layout = clutter_grid_layout_new ();
  if (is_vertical)
    clutter_grid_layout_set_orientation (CLUTTER_GRID_LAYOUT (grid_layout),
                                         CLUTTER_ORIENTATION_VERTICAL);
  box = clutter_actor_new ();
  clutter_actor_set_background_color (box, CLUTTER_COLOR_LightGray);
  clutter_actor_set_x_expand (box, TRUE);
  clutter_actor_set_y_expand (box, TRUE);
  clutter_actor_set_layout_manager (box, grid_layout);
  clutter_actor_add_child (stage, box);
  clutter_actor_set_x_align (box, CLUTTER_ACTOR_ALIGN_FILL);
  clutter_actor_set_y_align (box, CLUTTER_ACTOR_ALIGN_FILL);

  add_actor (box, 0, 0, 1, 1);
  add_actor (box, 1, 0, 1, 1);
  add_actor (box, 2, 0, 1, 1);
  add_actor (box, 0, 1, 1, 1);
  add_actor (box, 1, 1, 2, 1);
  add_actor (box, 0, 2, 3, 1);
  add_actor (box, 0, 3, 2, 2);
  add_actor (box, 2, 3, 1, 1);
  add_actor (box, 2, 4, 1, 1);

  instructions = clutter_text_new_with_text ("Sans 12px", INSTRUCTIONS);
  clutter_actor_set_margin_top (instructions, 4);
  clutter_actor_set_margin_left (instructions, 4);
  clutter_actor_set_margin_bottom (instructions, 4);
  clutter_actor_add_child (stage, instructions);
  clutter_actor_set_x_align (instructions, CLUTTER_ACTOR_ALIGN_FILL);
  clutter_actor_set_y_align (instructions, CLUTTER_ACTOR_ALIGN_CENTER);

  g_signal_connect (stage, "destroy",
                    G_CALLBACK (clutter_main_quit), NULL);
  g_signal_connect (stage, "key-release-event",
                    G_CALLBACK (key_release_cb), box);

  clutter_actor_show (stage);

  clutter_main ();

  return 0;
}