ClutterBinLayout

## ClutterBinLayout ClutterBinLayout — A simple layout manager |

## Synopsis

    enum                ClutterBinAlignment;
    struct              ClutterBinLayout;
    struct              ClutterBinLayoutClass;
    ClutterLayoutManager * clutter_bin_layout_new           (ClutterBinAlignment x_align,
                                                             ClutterBinAlignment y_align);
    void                clutter_bin_layout_set_alignment    (ClutterBinLayout *self,
                                                             ClutterActor *child,
                                                             ClutterBinAlignment x_align,
                                                             ClutterBinAlignment y_align);
    void                clutter_bin_layout_get_alignment    (ClutterBinLayout *self,
                                                             ClutterActor *child,
                                                             ClutterBinAlignment *x_align,
                                                             ClutterBinAlignment *y_align);
    void                clutter_bin_layout_add              (ClutterBinLayout *self,
                                                             ClutterActor *child,
                                                             ClutterBinAlignment x_align,
                                                             ClutterBinAlignment y_align);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----ClutterLayoutManager
                   +----ClutterBinLayout

## Properties

      "x-align"                  ClutterBinAlignment   : Read / Write
      "y-align"                  ClutterBinAlignment   : Read / Write

## Description

ClutterBinLayout is a layout manager which implements the following policy:

- the preferred size is the maximum preferred size between all the children of the container using the layout;
- each child is allocated in "layers", on on top of the other;
- for each layer there are horizontal and vertical alignment policies.

Figure 4. Bin layout

The image shows a ClutterBinLayout with three layers: a background ClutterCairoTexture, set to fill on both the X and Y axis; a ClutterTexture, set to center on both the X and Y axis; and a ClutterRectangle, set to `CLUTTER_BIN_ALIGNMENT_END` on both the X and Y axis.

Example 5. How to pack actors inside a BinLayout

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);

ClutterBinLayout is available since Clutter 1.2

## Details

### enum ClutterBinAlignment

    typedef enum {
      CLUTTER_BIN_ALIGNMENT_FIXED,
      CLUTTER_BIN_ALIGNMENT_FILL,
      CLUTTER_BIN_ALIGNMENT_START,
      CLUTTER_BIN_ALIGNMENT_END,
      CLUTTER_BIN_ALIGNMENT_CENTER
    } ClutterBinAlignment;

The alignment policies available on each axis for ClutterBinLayout

`CLUTTER_BIN_ALIGNMENT_FIXED` | Fixed position alignment; the ClutterBinLayout will honour the fixed position provided by the actors themselves when allocating them
`CLUTTER_BIN_ALIGNMENT_FILL` | Fill the allocation size
`CLUTTER_BIN_ALIGNMENT_START` | Position the actors at the top or left side of the container, depending on the axis
`CLUTTER_BIN_ALIGNMENT_END` | Position the actors at the bottom or right side of the container, depending on the axis
`CLUTTER_BIN_ALIGNMENT_CENTER` | Position the actors at the center of the container, depending on the axis

Since 1.2

### struct ClutterBinLayout

    struct ClutterBinLayout;

The ClutterBinLayout structure contains only private data and should be accessed using the provided API

Since 1.2

### struct ClutterBinLayoutClass

    struct ClutterBinLayoutClass {
    };

The ClutterBinLayoutClass structure contains only private data and should be accessed using the provided API

Since 1.2

### clutter_bin_layout_new ()

    ClutterLayoutManager * clutter_bin_layout_new           (ClutterBinAlignment x_align,
                                                             ClutterBinAlignment y_align);

Creates a new ClutterBinLayout 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
Returns : | the newly created layout manager

Since 1.2

### clutter_bin_layout_set_alignment ()

    void                clutter_bin_layout_set_alignment    (ClutterBinLayout *self,
                                                             ClutterActor *child,
                                                             ClutterBinAlignment x_align,
                                                             ClutterBinAlignment y_align);

Sets the horizontal and vertical alignment policies to be applied to a `child` of `self`

If `child` is `NULL` then the `x_align` and `y_align` values will be set as the default alignment policies

`self` : | a ClutterBinLayout
`child` : | a child of `container`. [allow-none]
`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_get_alignment ()

    void                clutter_bin_layout_get_alignment    (ClutterBinLayout *self,
                                                             ClutterActor *child,
                                                             ClutterBinAlignment *x_align,
                                                             ClutterBinAlignment *y_align);

Retrieves the horizontal and vertical alignment policies for a child of `self`

If `child` is `NULL` the default alignment policies will be returned instead

`self` : | a ClutterBinLayout
`child` : | a child of `container`. [allow-none]
`x_align` : | return location for the horizontal alignment policy. [out][allow-none]
`y_align` : | return location for the vertical alignment policy. [out][allow-none]

Since 1.2

### clutter_bin_layout_add ()

    void                clutter_bin_layout_add              (ClutterBinLayout *self,
                                                             ClutterActor *child,
                                                             ClutterBinAlignment x_align,
                                                             ClutterBinAlignment y_align);

Adds a ClutterActor 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 ClutterContainer associated to the ClutterBinLayout

`self` : | a ClutterBinLayout
`child` : | a ClutterActor
`x_align` : | horizontal alignment policy for `child`
`y_align` : | vertical alignment policy for `child`

Since 1.2

## Property Details

### The `"x-align"` property

      "x-align"                  ClutterBinAlignment   : Read / Write

The default horizontal alignment policy for actors managed by the ClutterBinLayout

Default value: CLUTTER_BIN_ALIGNMENT_CENTER

Since 1.2

### The `"y-align"` property

      "y-align"                  ClutterBinAlignment   : Read / Write

The default vertical alignment policy for actors managed by the ClutterBinLayout

Default value: CLUTTER_BIN_ALIGNMENT_CENTER

Since 1.2