A simple layout manager
<clutter-bin-layout> is a layout manager which implements the
following policy:
(The missing figure, bin-layout
The image shows a <clutter-bin-layout> with three layers: a
background <clutter-cairo-texture>, set to fill on both the X and
Y axis; a <clutter-texture>, set to center on both the X and Y
axis; and a <clutter-rectangle>, set to
‘CLUTTER_BIN_ALIGNMENT_END’ on both the X and Y axis.
The following code shows how to build a composite actor with a texture and a background, and add controls overlayed on top. The background is set to fill the whole allocation, whilst the texture is centered; there is a control in the top right corner and a label in the bottom, filling out the whole allocated width.
ClutterLayoutManager *manager;
ClutterActor *box;
/* create the layout first */
layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
CLUTTER_BIN_ALIGNMENT_CENTER);
box = clutter_box_new (layout); /* then the container */
/* we can use the layout object to add actors */
clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), background,
CLUTTER_BIN_ALIGNMENT_FILL,
CLUTTER_BIN_ALIGNMENT_FILL);
clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), icon,
CLUTTER_BIN_ALIGNMENT_CENTER,
CLUTTER_BIN_ALIGNMENT_CENTER);
/* align to the bottom left */
clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), label,
CLUTTER_BIN_ALIGNMENT_START,
CLUTTER_BIN_ALIGNMENT_END);
/* align to the top right */
clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), button,
CLUTTER_BIN_ALIGNMENT_END,
CLUTTER_BIN_ALIGNMENT_START);
<clutter-bin-layout> is available since Clutter 1.2
<clutter-bin-alignment>) (y_align <clutter-bin-alignment>) ⇒ (ret <clutter-layout-manager>)Creates a new
<clutter-bin-layout>layout manager
- x-align
- the default alignment policy to be used on the horizontal axis
- y-align
- the default alignment policy to be used on the vertical axis
- ret
- the newly created layout manager
Since 1.2
<clutter-bin-layout>) (child <clutter-actor>) (x_align <clutter-bin-alignment>) (y_align <clutter-bin-alignment>)Sets the horizontal and vertical alignment policies to be applied to a child of self
If child is ‘
#f’ then the x-align and y-align values will be set as the default alignment policies
- self
- a
<clutter-bin-layout>- child
- a child of container.
- x-align
- the horizontal alignment policy to be used for the child inside container
- y-align
- the vertical aligment policy to be used on the child inside container
Since 1.2
<clutter-bin-layout>) (child <clutter-actor>) ⇒ (x_align <clutter-bin-alignment>) (y_align <clutter-bin-alignment>)Retrieves the horizontal and vertical alignment policies for a child of self
If child is ‘
#f’ the default alignment policies will be returned instead
- self
- a
<clutter-bin-layout>- child
- a child of container.
- x-align
- return location for the horizontal alignment policy.
- y-align
- return location for the vertical alignment policy.
Since 1.2
<clutter-bin-layout>) (child <clutter-actor>) (x_align <clutter-bin-alignment>) (y_align <clutter-bin-alignment>)Adds a
<clutter-actor>to the container using self and sets the alignment policies for itThis function is equivalent to
clutter-container-add-actorandclutter-layout-manager-child-set-propertybut it does not require a pointer to the<clutter-container>associated to the<clutter-bin-layout>
- self
- a
<clutter-bin-layout>- child
- a
<clutter-actor>- x-align
- horizontal alignment policy for child
- y-align
- vertical alignment policy for child
Since 1.2