MxGrid

## MxGrid MxGrid — a flow layout container |

## Synopsis

                        MxGrid;
    ClutterActor *      mx_grid_new                         (void);
    void                mx_grid_set_line_alignment          (MxGrid *self,
                                                             MxAlign value);
    gboolean            mx_grid_get_line_alignment          (MxGrid *self);
    void                mx_grid_set_homogenous_rows         (MxGrid *self,
                                                             gboolean value);
    gboolean            mx_grid_get_homogenous_rows         (MxGrid *self);
    void                mx_grid_set_homogenous_columns      (MxGrid *self,
                                                             gboolean value);
    gboolean            mx_grid_get_homogenous_columns      (MxGrid *self);
    void                mx_grid_set_orientation             (MxGrid *grid,
                                                             MxOrientation orientation);
    MxOrientation       mx_grid_get_orientation             (MxGrid *grid);
    void                mx_grid_set_row_spacing             (MxGrid *self,
                                                             gfloat value);
    gfloat              mx_grid_get_row_spacing             (MxGrid *self);
    void                mx_grid_set_column_spacing          (MxGrid *self,
                                                             gfloat value);
    gfloat              mx_grid_get_column_spacing          (MxGrid *self);
    void                mx_grid_set_child_y_align           (MxGrid *self,
                                                             MxAlign value);
    MxAlign             mx_grid_get_child_y_align           (MxGrid *self);
    void                mx_grid_set_child_x_align           (MxGrid *self,
                                                             MxAlign value);
    MxAlign             mx_grid_get_child_x_align           (MxGrid *self);
    void                mx_grid_set_max_stride              (MxGrid *self,
                                                             gint value);
    gint                mx_grid_get_max_stride              (MxGrid *self);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----ClutterActor
                   +----MxWidget
                         +----MxGrid
                               +----MxItemView

## Implemented Interfaces

MxGrid implements ClutterScriptable, MxStylable, ClutterContainer, MxScrollable and MxFocusable.

## Properties

      "child-x-align"            MxAlign               : Read / Write / Construct
      "child-y-align"            MxAlign               : Read / Write / Construct
      "column-spacing"           gfloat                : Read / Write / Construct
      "homogenous-columns"       gboolean              : Read / Write / Construct
      "homogenous-rows"          gboolean              : Read / Write / Construct
      "line-alignment"           MxAlign               : Read / Write / Construct
      "max-stride"               gint                  : Read / Write / Construct
      "orientation"              MxOrientation         : Read / Write / Construct
      "row-spacing"              gfloat                : Read / Write / Construct

## Description

MxGrid is a layout container that arranges its children by placing them in a single line and wrapping round to a new line when the edge of the container is reached.

This layout is particularly flexible, with the following configuration possibilities:

- Column and row spacing are controllable ("column_spacing" and "row_spacing")

- Column and row sizes can be made consistent, regardless of the size of the contained actors ("homogenous_columns" and "homogenous_rows")

- Prefer to pack children vertically first, rather than horizontally ("orientation")

- Specify the maximum number of rows or columns to allow in the layout, to prevent it from being excessively stretched ("max_stride").

To demonstrate how these settings interact, here are a few images.

Figure 5. MxGrid flowing across multiple rows

An MxGrid containing 9 child actors; "orientation" is set to the default (MX_ORIENTATION_HORIZONTAL, i.e. lay out horizontally first); "max_stride" has not been set (so there's no maximum row size); "column_spacing" and "row_spacing" have been set so that there is spacing between cells vertically and horizontally.

Figure 6. MxGrid flowing on a single row

The image shows the same MxGrid with its children flowing into one row. This is the layout's response to being resized horizontally.

Figure 7. MxGrid flowing onto two rows

The same MxGrid with 9 children wrapping onto two rows: notice how the "odd" rectangle is on the end of a row, rather than at the bottom of a column. This is because preference is being given to packing onto the end of rows, rather than columns, because "orientation" is set to MX_ORIENTATION_HORIZONTAL. Even though there is room for the rectangle at the bottom of the column, the layout prefers to place children onto the end of a row if there is room.

Figure 8. MxGrid flowing into two columns

The same MxGrid 9 children with "orientation" set to MX_ORIENTATION_VERTICAL. This time, the layout wraps onto two columns rather than two rows. Even though there is room on the end of the rows for the children, the preference is for them to be placed on the bottom of columns, or into new columns, before being added to rows.

## Details

### MxGrid

    typedef struct _MxGrid MxGrid;

The contents of the this structure are private and should only be accessed through the public API.

### mx_grid_new ()

    ClutterActor *      mx_grid_new                         (void);

Returns : |

### mx_grid_set_line_alignment ()

    void                mx_grid_set_line_alignment          (MxGrid *self,
                                                             MxAlign value);

`self` : |
`value` : |

### mx_grid_get_line_alignment ()

    gboolean            mx_grid_get_line_alignment          (MxGrid *self);

`self` : |
Returns : |

### mx_grid_set_homogenous_rows ()

    void                mx_grid_set_homogenous_rows         (MxGrid *self,
                                                             gboolean value);

`self` : |
`value` : |

### mx_grid_get_homogenous_rows ()

    gboolean            mx_grid_get_homogenous_rows         (MxGrid *self);

`self` : |
Returns : |

### mx_grid_set_homogenous_columns ()

    void                mx_grid_set_homogenous_columns      (MxGrid *self,
                                                             gboolean value);

`self` : |
`value` : |

### mx_grid_get_homogenous_columns ()

    gboolean            mx_grid_get_homogenous_columns      (MxGrid *self);

`self` : |
Returns : |

### mx_grid_set_orientation ()

    void                mx_grid_set_orientation             (MxGrid *grid,
                                                             MxOrientation orientation);

`grid` : |
`orientation` : |

### mx_grid_get_orientation ()

    MxOrientation       mx_grid_get_orientation             (MxGrid *grid);

`grid` : |
Returns : |

### mx_grid_set_row_spacing ()

    void                mx_grid_set_row_spacing             (MxGrid *self,
                                                             gfloat value);

`self` : |
`value` : |

### mx_grid_get_row_spacing ()

    gfloat              mx_grid_get_row_spacing             (MxGrid *self);

`self` : |
Returns : |

### mx_grid_set_column_spacing ()

    void                mx_grid_set_column_spacing          (MxGrid *self,
                                                             gfloat value);

`self` : |
`value` : |

### mx_grid_get_column_spacing ()

    gfloat              mx_grid_get_column_spacing          (MxGrid *self);

`self` : |
Returns : |

### mx_grid_set_child_y_align ()

    void                mx_grid_set_child_y_align           (MxGrid *self,
                                                             MxAlign value);

`self` : |
`value` : |

### mx_grid_get_child_y_align ()

    MxAlign             mx_grid_get_child_y_align           (MxGrid *self);

`self` : |
Returns : |

### mx_grid_set_child_x_align ()

    void                mx_grid_set_child_x_align           (MxGrid *self,
                                                             MxAlign value);

`self` : |
`value` : |

### mx_grid_get_child_x_align ()

    MxAlign             mx_grid_get_child_x_align           (MxGrid *self);

`self` : |
Returns : |

### mx_grid_set_max_stride ()

    void                mx_grid_set_max_stride              (MxGrid *self,
                                                             gint value);

`self` : |
`value` : |

### mx_grid_get_max_stride ()

    gint                mx_grid_get_max_stride              (MxGrid *self);

`self` : |
Returns : |

## Property Details

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

      "child-x-align"            MxAlign               : Read / Write / Construct

Horizontal alignment of items within cells.

Default value: MX_ALIGN_START

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

      "child-y-align"            MxAlign               : Read / Write / Construct

Vertical alignment of items within cells.

Default value: MX_ALIGN_START

### The `"column-spacing"` property

      "column-spacing"           gfloat                : Read / Write / Construct

spacing between columns in the layout.

Allowed values: >= 0

Default value: 0

### The `"homogenous-columns"` property

      "homogenous-columns"       gboolean              : Read / Write / Construct

Should all columns have the same height?.

Default value: FALSE

### The `"homogenous-rows"` property

      "homogenous-rows"          gboolean              : Read / Write / Construct

Should all rows have the same height?.

Default value: FALSE

### The `"line-alignment"` property

      "line-alignment"           MxAlign               : Read / Write / Construct

Alignment of rows/columns.

Default value: MX_ALIGN_START

### The `"max-stride"` property

      "max-stride"               gint                  : Read / Write / Construct

Maximum number of rows or columns, depending on orientation. For example, if max-stride is set to 3 with orientation MX_ORIENTATION_HORIZONTAL, there will be a maximum of 3 children in a row; if orientation is MX_ORIENTATION_VERTICAL, there will be a maximum of 3 children in a column.

Allowed values: >= 0

Default value: 0

### The `"orientation"` property

      "orientation"              MxOrientation         : Read / Write / Construct

Pack children vertically (in columns), instead of horizontally (in rows).

Default value: MX_ORIENTATION_HORIZONTAL

### The `"row-spacing"` property

      "row-spacing"              gfloat                : Read / Write / Construct

spacing between rows in the layout.

Allowed values: >= 0

Default value: 0