Next: , Previous: ClutterBindConstraint, Up: Top


11 ClutterBinLayout

A simple layout manager

11.1 Overview

<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;
     
      /&#x002A; create the layout first &#x002A;/
      layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
                                       CLUTTER_BIN_ALIGNMENT_CENTER);
      box = clutter_box_new (layout); /&#x002A; then the container &#x002A;/
     
      /&#x002A; we can use the layout object to add actors &#x002A;/
      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);
     
      /&#x002A; align to the bottom left &#x002A;/
      clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), label,
                              CLUTTER_BIN_ALIGNMENT_START,
                              CLUTTER_BIN_ALIGNMENT_END);
      /&#x002A; align to the top right &#x002A;/
      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

11.2 Usage

— Function: clutter-bin-layout-new (x_align <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

— Function: clutter-bin-layout-set-alignment (self <clutter-bin-layout>) (child <clutter-actor>) (x_align <clutter-bin-alignment>) (y_align <clutter-bin-alignment>)
— Method: set-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

— Function: clutter-bin-layout-get-alignment (self <clutter-bin-layout>) (child <clutter-actor>) ⇒  (x_align <clutter-bin-alignment>) (y_align <clutter-bin-alignment>)
— Method: get-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

— Function: clutter-bin-layout-add (self <clutter-bin-layout>) (child <clutter-actor>) (x_align <clutter-bin-alignment>) (y_align <clutter-bin-alignment>)
— Method: add

Adds a <clutter-actor> to the container using self and sets the alignment policies for it

This function is equivalent to clutter-container-add-actor and clutter-layout-manager-child-set-property but 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