MxGrid

## MxGrid MxGrid — a flow layout container |

## Synopsis

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

## 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

### struct MxGridClass

    struct MxGridClass {
      MxWidgetClass parent_class;

      /* padding for future expansion */
      void (*_padding_0) (void);
      void (*_padding_1) (void);
      void (*_padding_2) (void);
      void (*_padding_3) (void);
      void (*_padding_4) (void);
    };

### mx_grid_new ()

    ClutterActor *      mx_grid_new                         (void);

### mx_grid_set_line_alignment ()

    void                mx_grid_set_line_alignment          (MxGrid *self,
                                                             MxAlign value);

### mx_grid_get_line_alignment ()

    gboolean            mx_grid_get_line_alignment          (MxGrid *self);

### mx_grid_set_homogenous_rows ()

    void                mx_grid_set_homogenous_rows         (MxGrid *self,
                                                             gboolean value);

### mx_grid_get_homogenous_rows ()

    gboolean            mx_grid_get_homogenous_rows         (MxGrid *self);

### mx_grid_set_homogenous_columns ()

    void                mx_grid_set_homogenous_columns      (MxGrid *self,
                                                             gboolean value);

### mx_grid_get_homogenous_columns ()

    gboolean            mx_grid_get_homogenous_columns      (MxGrid *self);

### mx_grid_set_orientation ()

    void                mx_grid_set_orientation             (MxGrid *grid,
                                                             MxOrientation orientation);

### mx_grid_get_orientation ()

    MxOrientation       mx_grid_get_orientation             (MxGrid *grid);

### mx_grid_set_row_spacing ()

    void                mx_grid_set_row_spacing             (MxGrid *self,
                                                             gfloat value);

### mx_grid_get_row_spacing ()

    gfloat              mx_grid_get_row_spacing             (MxGrid *self);

### mx_grid_set_column_spacing ()

    void                mx_grid_set_column_spacing          (MxGrid *self,
                                                             gfloat value);

### mx_grid_get_column_spacing ()

    gfloat              mx_grid_get_column_spacing          (MxGrid *self);

### mx_grid_set_child_y_align ()

    void                mx_grid_set_child_y_align           (MxGrid *self,
                                                             MxAlign value);

### mx_grid_get_child_y_align ()

    MxAlign             mx_grid_get_child_y_align           (MxGrid *self);

### mx_grid_set_child_x_align ()

    void                mx_grid_set_child_x_align           (MxGrid *self,
                                                             MxAlign value);

### mx_grid_get_child_x_align ()

    MxAlign             mx_grid_get_child_x_align           (MxGrid *self);

### mx_grid_set_max_stride ()

    void                mx_grid_set_max_stride              (MxGrid *self,
                                                             gint value);

### mx_grid_get_max_stride ()

    gint                mx_grid_get_max_stride              (MxGrid *self);