## ClutterGridLayout

ClutterGridLayout — A layout manager for a grid of actors

## Functions

ClutterLayoutManager * | clutter_grid_layout_new ()
void | clutter_grid_layout_attach ()
void | clutter_grid_layout_attach_next_to ()
ClutterActor * | clutter_grid_layout_get_child_at ()
void | clutter_grid_layout_insert_column ()
void | clutter_grid_layout_insert_row ()
void | clutter_grid_layout_insert_next_to ()
void | clutter_grid_layout_set_orientation ()
ClutterOrientation | clutter_grid_layout_get_orientation ()
void | clutter_grid_layout_set_column_homogeneous ()
gboolean | clutter_grid_layout_get_column_homogeneous ()
void | clutter_grid_layout_set_row_homogeneous ()
gboolean | clutter_grid_layout_get_row_homogeneous ()
void | clutter_grid_layout_set_column_spacing ()
guint | clutter_grid_layout_get_column_spacing ()
void | clutter_grid_layout_set_row_spacing ()
guint | clutter_grid_layout_get_row_spacing ()

## Properties

gboolean | column-homogeneous | Read / Write
guint | column-spacing | Read / Write
ClutterOrientation | orientation | Read / Write
gboolean | row-homogeneous | Read / Write
guint | row-spacing | Read / Write

## Types and Values

enum | ClutterGridPosition
struct | ClutterGridLayout
struct | ClutterGridLayoutClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── ClutterLayoutManager
                ╰── ClutterGridLayout

## Description

ClutterGridLayout is a layout manager which arranges its child widgets in rows and columns. It is a very similar to ClutterTableLayout and ClutterBoxLayout, but it consistently uses ClutterActor's alignment and expansion flags instead of custom child properties.

Children are added using `clutter_grid_layout_attach()`. They can span multiple rows or columns. It is also possible to add a child next to an existing child, using `clutter_grid_layout_attach_next_to()`. The behaviour of ClutterGridLayout when several children occupy the same grid cell is undefined.

ClutterGridLayout can be used like a ClutterBoxLayout by just using `clutter_actor_add_child()`, which will place children next to each other in the direction determined by the “orientation” property.

## Functions

### clutter_grid_layout_new ()

    ClutterLayoutManager *
    clutter_grid_layout_new (void);

Creates a new ClutterGridLayout

#### Returns

the new ClutterGridLayout

### clutter_grid_layout_attach ()

    void
    clutter_grid_layout_attach (ClutterGridLayout *layout,
                                ClutterActor *child,
                                gint left,
                                gint top,
                                gint width,
                                gint height);

Adds a widget to the grid.

The position of `child` is determined by `left` and `top` . The number of 'cells' that `child` will occupy is determined by `width` and `height` .

#### Parameters

layout | a ClutterGridLayout |
child | the ClutterActor to add |
left | the column number to attach the left side of `child` to |
top | the row number to attach the top side of `child` to |
width | the number of columns that `child` will span |
height | the number of rows that `child` will span |

Since 1.12

### clutter_grid_layout_attach_next_to ()

    void
    clutter_grid_layout_attach_next_to (ClutterGridLayout *layout,
                                        ClutterActor *child,
                                        ClutterActor *sibling,
                                        ClutterGridPosition side,
                                        gint width,
                                        gint height);

Adds a actor to the grid.

The actor is placed next to `sibling` , on the side determined by `side` . When `sibling` is `NULL`, the actor is placed in row (for left or right placement) or column 0 (for top or bottom placement), at the end indicated by `side` .

Attaching widgets labeled [1], [2], [3] with `sibling` == `NULL` and `side` == `CLUTTER_GRID_POSITION_LEFT` yields a layout of 3[1].

#### Parameters

layout | a ClutterGridLayout |
child | the actor to add |
sibling | the child of `layout` that `child` will be placed next to, or `NULL` to place `child` at the beginning or end. | [allow-none]
side | the side of `sibling` that `child` is positioned next to |
width | the number of columns that `child` will span |
height | the number of rows that `child` will span |

Since 1.12

### clutter_grid_layout_get_child_at ()

    ClutterActor *
    clutter_grid_layout_get_child_at (ClutterGridLayout *layout,
                                      gint left,
                                      gint top);

Gets the child of `layout` whose area covers the grid cell whose upper left corner is at `left` , `top` .

#### Parameters

layout | a ClutterGridLayout |
left | the left edge of the cell |
top | the top edge of the cell |

#### Returns

the child at the given position, or `NULL`.

[transfer none]

Since 1.12

### clutter_grid_layout_insert_column ()

    void
    clutter_grid_layout_insert_column (ClutterGridLayout *layout,
                                       gint position);

Inserts a column at the specified position.

Children which are attached at or to the right of this position are moved one column to the right. Children which span across this position are grown to span the new column.

#### Parameters

layout | a ClutterGridLayout |
position | the position to insert the column at |

Since 1.12

### clutter_grid_layout_insert_row ()

    void
    clutter_grid_layout_insert_row (ClutterGridLayout *layout,
                                    gint position);

Inserts a row at the specified position.

Children which are attached at or below this position are moved one row down. Children which span across this position are grown to span the new row.

#### Parameters

layout | a ClutterGridLayout |
position | the position to insert the row at |

Since 1.12

### clutter_grid_layout_insert_next_to ()

    void
    clutter_grid_layout_insert_next_to (ClutterGridLayout *layout,
                                        ClutterActor *sibling,
                                        ClutterGridPosition side);

Inserts a row or column at the specified position.

The new row or column is placed next to `sibling` , on the side determined by `side` . If `side` is `CLUTTER_GRID_POSITION_LEFT` or `CLUTTER_GRID_POSITION_BOTTOM`, a row is inserted. If `side` is `CLUTTER_GRID_POSITION_LEFT` of `CLUTTER_GRID_POSITION_RIGHT`, a column is inserted.

#### Parameters

layout | a ClutterGridLayout |
sibling | the child of `layout` that the new row or column will be placed next to |
side | the side of `sibling` that `child` is positioned next to |

Since 1.12

### clutter_grid_layout_set_orientation ()

    void
    clutter_grid_layout_set_orientation (ClutterGridLayout *layout,
                                         ClutterOrientation orientation);

Sets the orientation of the `layout`

#### Parameters

layout | a ClutterGridLayout |
orientation | the orientation of the ClutterGridLayout |

Since 1.12

### clutter_grid_layout_get_orientation ()

    ClutterOrientation
    clutter_grid_layout_get_orientation (ClutterGridLayout *layout);

Retrieves the orientation of the `layout` .

#### Parameters

layout | a ClutterGridLayout |

#### Returns

the orientation of the layout

Since 1.12

### clutter_grid_layout_set_column_homogeneous ()

    void
    clutter_grid_layout_set_column_homogeneous
                                   (ClutterGridLayout *layout,
                                    gboolean homogeneous);

Sets whether all columns of `layout` will have the same width.

#### Parameters

layout | a ClutterGridLayout |
homogeneous | `TRUE` to make columns homogeneous |

Since 1.12

### clutter_grid_layout_get_column_homogeneous ()

    gboolean
    clutter_grid_layout_get_column_homogeneous
                                   (ClutterGridLayout *layout);

Returns whether all columns of `layout` have the same width.

#### Parameters

layout | a ClutterGridLayout |

#### Returns

whether all columns of `layout` have the same width.

### clutter_grid_layout_set_row_homogeneous ()

    void
    clutter_grid_layout_set_row_homogeneous
                                   (ClutterGridLayout *layout,
                                    gboolean homogeneous);

Sets whether all rows of `layout` will have the same height.

#### Parameters

layout | a ClutterGridLayout |
homogeneous | `TRUE` to make rows homogeneous |

Since 1.12

### clutter_grid_layout_get_row_homogeneous ()

    gboolean
    clutter_grid_layout_get_row_homogeneous
                                   (ClutterGridLayout *layout);

Returns whether all rows of `layout` have the same height.

#### Parameters

layout | a ClutterGridLayout |

#### Returns

whether all rows of `layout` have the same height.

Since 1.12

### clutter_grid_layout_set_column_spacing ()

    void
    clutter_grid_layout_set_column_spacing
                                   (ClutterGridLayout *layout,
                                    guint spacing);

Sets the spacing between columns of `layout`

#### Parameters

layout | a ClutterGridLayout |
spacing | the spacing between columns of the layout, in pixels |

Since 1.12

### clutter_grid_layout_get_column_spacing ()

    guint
    clutter_grid_layout_get_column_spacing
                                   (ClutterGridLayout *layout);

Retrieves the spacing set using `clutter_grid_layout_set_column_spacing()`

#### Parameters

layout | a ClutterGridLayout |

#### Returns

the spacing between coluns of `layout`

Since 1.12

### clutter_grid_layout_set_row_spacing ()

    void
    clutter_grid_layout_set_row_spacing (ClutterGridLayout *layout,
                                         guint spacing);

Sets the spacing between rows of `layout`

#### Parameters

layout | a ClutterGridLayout |
spacing | the spacing between rows of the layout, in pixels |

Since 1.12

### clutter_grid_layout_get_row_spacing ()

    guint
    clutter_grid_layout_get_row_spacing (ClutterGridLayout *layout);

Retrieves the spacing set using `clutter_grid_layout_set_row_spacing()`

#### Parameters

layout | a ClutterGridLayout |

#### Returns

the spacing between rows of `layout`

Since 1.12

## Types and Values

### enum ClutterGridPosition

Grid position modes.

#### Members

CLUTTER_GRID_POSITION_LEFT | left position |
CLUTTER_GRID_POSITION_RIGHT | right position |
CLUTTER_GRID_POSITION_TOP | top position |
CLUTTER_GRID_POSITION_BOTTOM | bottom position |

Since 1.12

### struct ClutterGridLayout

    struct ClutterGridLayout;

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

Since 1.12

### struct ClutterGridLayoutClass

    struct ClutterGridLayoutClass {
    };

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

Since 1.12

## Property Details

### The `“column-homogeneous”` property

      “column-homogeneous”       gboolean

Whether all columns of the layout should have the same width

Flags: Read / Write

Default value: FALSE

Since 1.12

### The `“column-spacing”` property

      “column-spacing”           guint

The amount of space in pixels between two consecutive columns

Flags: Read / Write

Default value: 0

Since 1.12

### The `“orientation”` property

      “orientation”              ClutterOrientation

The orientation of the layout, either horizontal or vertical

Flags: Read / Write

Default value: CLUTTER_ORIENTATION_HORIZONTAL

Since 1.12

### The `“row-homogeneous”` property

      “row-homogeneous”          gboolean

Whether all rows of the layout should have the same height

Flags: Read / Write

Default value: FALSE

Since 1.12

### The `“row-spacing”` property

      “row-spacing”              guint

The amount of space in pixels between two consecutive rows

Flags: Read / Write

Default value: 0

Since 1.12

## See Also

ClutterTableLayout, ClutterBoxLayout