diff --git a/doc/cookbook/actors.xml b/doc/cookbook/actors.xml index ce274b7ea..4ae735779 100644 --- a/doc/cookbook/actors.xml +++ b/doc/cookbook/actors.xml @@ -770,13 +770,10 @@ clutter_actor_raise (actorB, actorA); - clutter_actor_raise(), - clutter_actor_lower() and related + clutter_actor_set_child_above_sibling(), + clutter_actor_set_child_below_sibling() and related ClutterActor functions set - depth ordering on actors; see also ClutterContainer's - clutter_container_raise_child() and - clutter_container_lower_child() - functions. + depth ordering on actors. diff --git a/doc/cookbook/animations.xml b/doc/cookbook/animations.xml index 66c4fab71..61f44c55b 100644 --- a/doc/cookbook/animations.xml +++ b/doc/cookbook/animations.xml @@ -1588,7 +1588,7 @@ foo_button_pressed_cb (ClutterActor *actor, g_object_set_data_full (G_OBJECT (rig), "script", script, g_object_unref); /* add the rig to the stage */ - clutter_container_add_actor (CLUTTER_CONTAINER (stage), rig); + clutter_actor_add_child (stage, rig); /* place the rig at the same coordinates on the stage as the rectangle */ clutter_actor_set_position (rig, @@ -1596,7 +1596,9 @@ foo_button_pressed_cb (ClutterActor *actor, clutter_actor_get_y (actor)); /* put the rectangle into the top-left corner of the rig */ - clutter_actor_reparent (actor, rig); + g_object_ref (actor); + clutter_actor_remove_child (clutter_actor_get_parent (actor), actor); + clutter_actor_add_child (rig, actor); clutter_actor_set_position (actor, 0, 0); @@ -3120,7 +3122,7 @@ clutter_actor_set_size (rectangle, 60, 60); clutter_actor_add_constraint_with_name (rectangle, "path", constraint); /* add the rectangle to the stage */ -clutter_container_add_actor (CLUTTER_CONTAINER (stage), rectangle); +clutter_actor_add_child (stage, rectangle); diff --git a/doc/cookbook/events.xml b/doc/cookbook/events.xml index 8f937034d..150c59a3e 100644 --- a/doc/cookbook/events.xml +++ b/doc/cookbook/events.xml @@ -557,9 +557,9 @@ clutter_actor_set_clip_to_allocation (viewport, TRUE); -clutter_container_add_actor (CLUTTER_CONTAINER (viewport), texture); +clutter_actor_add_child (viewport, texture); -clutter_container_add_actor (CLUTTER_CONTAINER (stage), viewport); +clutter_actor_add_child (stage, viewport); diff --git a/doc/cookbook/layouts.xml b/doc/cookbook/layouts.xml index 406a4c5d2..4e96a37e0 100644 --- a/doc/cookbook/layouts.xml +++ b/doc/cookbook/layouts.xml @@ -57,7 +57,7 @@ Although Clutter provides plenty of flexibility in how you can use layout management, the simplest way to get started is to - use the built-in ClutterBox class with one of the + use the built-in ClutterActor class with one of the provided ClutterLayoutManager implementations. The pattern for doing this is: @@ -76,11 +76,11 @@ in the layout). - Create a ClutterBox, setting its layout + Create a ClutterActor, setting its layout manager to the one you just created. - Pack actors into the ClutterBox, + Pack actors into the ClutterActor, setting layout properties (if required) as each is added. @@ -94,13 +94,6 @@ how to make use of the different layout manager implementations. - - It is not possible to use a layout manager with an arbitrary - ClutterContainer: you must use a ClutterActor - subclass which can delegate its layout to a layout manager (either - use ClutterBox or write your own). - -
@@ -377,7 +370,7 @@ Solution The most flexible approach is to use a ClutterBinLayout - associated with a ClutterBox: + associated with a ClutterActor: @@ -419,7 +412,7 @@ background = clutter_rectangle_new_with_color (&background_color); * as it should use the default alignment, it can be added * direct to the container, rather than via the layout */ -clutter_container_add_actor (CLUTTER_CONTAINER (box), background); +clutter_actor_add_child (box, background); /* text for the button */ text = clutter_text_new_full ("Sans 15px", "Click me", &text_color); @@ -516,7 +509,7 @@ clutter_actor_raise_top (text); The white space is the stage visible behind the - ClutterBox holding the coloured rectangles. + ClutterActor holding the coloured rectangles. Notice that the layout is the width of the widest actor within it and the height of the tallest. @@ -535,8 +528,9 @@ clutter_actor_raise_top (text); mirrors the order in which actors are added to the layout: the earlier an actor is added, the lower down in the depth order it is. If this isn't what you want, you can fix the depth ordering using - clutter_actor_raise(), - clutter_actor_lower() and their relatives. + clutter_actor_set_child_above_sibling(), + clutter_actor_set_child_below_sibling() and + their relatives.
@@ -550,12 +544,14 @@ clutter_actor_raise_top (text); However, if you have a small number of actors and you need some simple alignment, an alternative is to use - manual positioning inside a ClutterFixedLayout - (or even a ClutterGroup), possibly combined with - ClutterConstraints to align actors with each other - and bind their widths and heights together. See + manual positioning inside a ClutterFixedLayout, possibly + combined with ClutterConstraints to align actors with + each other and bind their widths and heights together. See this section for more details. + + By default, ClutterActor uses a + ClutterFixedLayout as its layout manager.
@@ -832,7 +828,7 @@ clutter_actor_raise_top (text);
Solution - Create a ClutterBox with a + Create a ClutterActor with a ClutterBoxLayout as its layout manager. A ClutterBoxLayout can hold a single row or @@ -862,8 +858,9 @@ clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (box_layout), 5); /* actors are packed into this box; we set its width, but * allow its height to be determined by the children it contains */ -box = clutter_box_new (box_layout); -clutter_box_set_color (CLUTTER_BOX (box), &box_color); +box = clutter_actor_new (); +clutter_actor_set_layout_manager (box, box_layout); +clutter_actor_set_background_color (box, &box_color); clutter_actor_set_position (box, 100, 50); clutter_actor_set_width (box, 200); @@ -881,27 +878,26 @@ clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (box_layout), CLUTTER_BOX_ALIGNMENT_START, /* x-align */ CLUTTER_BOX_ALIGNMENT_START); /* y-align */ -/* pack an actor into the box and set layout properties at the - * same time; note this is more concise if you mostly want to - * use the default properties for the layout - */ -red = clutter_rectangle_new_with_color (&red_color); -clutter_actor_set_size (red, 100, 100); - -clutter_box_pack (CLUTTER_BOX (box), - red, - "x-fill", TRUE, - NULL); - /* 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_rectangle_new_with_color (&red_color); +clutter_actor_set_size (red, 100, 100); + +clutter_actor_add_child (box, blue); + +clutter_layout_manager_child_set (box_layout, + CLUTTER_CONTAINER (box), + blue, + "x-fill", TRUE, + NULL); + blue = clutter_rectangle_new_with_color (&blue_color); clutter_actor_set_size (blue, 100, 100); -clutter_container_add_actor (CLUTTER_CONTAINER (box), blue); +clutter_actor_add_child (box, blue); clutter_layout_manager_child_set (box_layout, CLUTTER_CONTAINER (box), @@ -910,7 +906,7 @@ clutter_layout_manager_child_set (box_layout, NULL); /* put the box on the stage */ -clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); +clutter_actor_add_child (stage, box); ]]>