interactive: Use the newly added CLUTTER_ALIGN_BOTH value

We center a lot of stuff using ClutterAlignConstraints.
This commit is contained in:
Emmanuele Bassi 2011-10-15 18:35:45 +01:00
parent 1e51961f7a
commit f75dfcfd8b
5 changed files with 6 additions and 13 deletions

View File

@ -216,8 +216,7 @@ test_actors_main (int argc, char *argv[])
oh->group = clutter_group_new(); oh->group = clutter_group_new();
clutter_actor_set_name (oh->group, "Group"); clutter_actor_set_name (oh->group, "Group");
g_signal_connect (oh->group, "destroy", G_CALLBACK (on_group_destroy), oh); g_signal_connect (oh->group, "destroy", G_CALLBACK (on_group_destroy), oh);
clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
clutter_actor_add_constraint (oh->group, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0f)); clutter_actor_add_constraint (oh->group, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0f));
oh->hand = g_new (ClutterActor*, n_hands); oh->hand = g_new (ClutterActor*, n_hands);

View File

@ -186,11 +186,8 @@ test_constraints_main (int argc, char *argv[])
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
/* align the center rectangle to the center of the stage */ /* align the center rectangle to the center of the stage */
constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5); constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5);
clutter_actor_add_constraint_with_name (rect, "x-align", constraint); clutter_actor_add_constraint_with_name (rect, "align", constraint);
constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5);
clutter_actor_add_constraint_with_name (rect, "y-align", constraint);
/* this is the equivalent of the DesaturateEffect; we cannot animate /* this is the equivalent of the DesaturateEffect; we cannot animate
* the factor because the animation API only understands GObject * the factor because the animation API only understands GObject

View File

@ -88,8 +88,7 @@ test_scrolling_main (int argc, char *argv[])
scroll = clutter_group_new (); scroll = clutter_group_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), scroll); clutter_container_add_actor (CLUTTER_CONTAINER (stage), scroll);
clutter_actor_set_size (scroll, RECT_WIDTH, RECT_HEIGHT); clutter_actor_set_size (scroll, RECT_WIDTH, RECT_HEIGHT);
clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
clutter_actor_set_clip_to_allocation (scroll, TRUE); clutter_actor_set_clip_to_allocation (scroll, TRUE);
/* viewport: the actual container for the children; we scroll it using /* viewport: the actual container for the children; we scroll it using

View File

@ -27,8 +27,7 @@ test_snap_constraint_main (int argc,
clutter_actor_set_size (layer_a, 100.0, 25.0); clutter_actor_set_size (layer_a, 100.0, 25.0);
/* the first layer is anchored to the middle of the stage */ /* the first layer is anchored to the middle of the stage */
clutter_actor_add_constraint (layer_a, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); clutter_actor_add_constraint (layer_a, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
clutter_actor_add_constraint (layer_a, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
/* second layer, with no implicit size */ /* second layer, with no implicit size */
layer_b = clutter_rectangle_new_with_color (CLUTTER_COLOR_DarkButter); layer_b = clutter_rectangle_new_with_color (CLUTTER_COLOR_DarkButter);

View File

@ -41,8 +41,7 @@ test_state_script_main (int argc, char *argv[])
button = CLUTTER_ACTOR (clutter_script_get_object (script, "button")); button = CLUTTER_ACTOR (clutter_script_get_object (script, "button"));
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button); clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
clutter_script_connect_signals (script, NULL); clutter_script_connect_signals (script, NULL);