MxGrid

MxGrid — a flow layout container

Synopsis

                    MxGrid;
ClutterActor *      mx_grid_new                         (void);
void                mx_grid_set_end_align               (MxGrid *self,
                                                         gboolean value);
gboolean            mx_grid_get_end_align               (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_vertical                (MxGrid *self,
                                                         gboolean value);
gboolean            mx_grid_get_vertical                (MxGrid *self);
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_valign                  (MxGrid *self,
                                                         gdouble value);
gdouble             mx_grid_get_valign                  (MxGrid *self);
void                mx_grid_set_halign                  (MxGrid *self,
                                                         gdouble value);
gdouble             mx_grid_get_halign                  (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 and MxScrollable.

Properties

  "allocate-hidden"          gboolean              : Read / Write / Construct
  "column-spacing"           gfloat                : Read / Write / Construct
  "end-align"                gboolean              : Read / Write / Construct
  "halign"                   gdouble               : Read / Write / Construct
  "homogenous-columns"       gboolean              : Read / Write / Construct
  "homogenous-rows"          gboolean              : Read / Write / Construct
  "max-stride"               gint                  : Read / Write / Construct
  "row-spacing"              gfloat                : Read / Write / Construct
  "valign"                   gdouble               : Read / Write / Construct
  "vertical"                 gboolean              : 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:

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

Figure 5. MxGrid flowing across multiple rows

An MxGrid containing 9 child actors; "vertical" is set to the default (FALSE, 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.

MxGrid flowing across multiple rows


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.

MxGrid flowing on a single row


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 "vertical" is set to FALSE. 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.

MxGrid flowing onto two rows


Figure 8. MxGrid flowing into two columns

The same MxGrid 9 children with "vertical" set to TRUE. 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.

MxGrid flowing into two columns


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_end_align ()

void                mx_grid_set_end_align               (MxGrid *self,
                                                         gboolean value);

self :

value :


mx_grid_get_end_align ()

gboolean            mx_grid_get_end_align               (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_vertical ()

void                mx_grid_set_vertical                (MxGrid *self,
                                                         gboolean value);

self :

value :


mx_grid_get_vertical ()

gboolean            mx_grid_get_vertical                (MxGrid *self);

self :

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_valign ()

void                mx_grid_set_valign                  (MxGrid *self,
                                                         gdouble value);

self :

value :


mx_grid_get_valign ()

gdouble             mx_grid_get_valign                  (MxGrid *self);

self :

Returns :


mx_grid_set_halign ()

void                mx_grid_set_halign                  (MxGrid *self,
                                                         gdouble value);

self :

value :


mx_grid_get_halign ()

gdouble             mx_grid_get_halign                  (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 "allocate-hidden" property

  "allocate-hidden"          gboolean              : Read / Write / Construct

This flag determines whether hidden children should be treated allocated or whether they should be skipped from the allocation and treated as if they are not present.

Default value: FALSE


The "column-spacing" property

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

spacing between columns in the layout.

Allowed values: >= 0

Default value: 0


The "end-align" property

  "end-align"                gboolean              : Read / Write / Construct

Right/bottom aligned rows/columns.

Default value: FALSE


The "halign" property

  "halign"                   gdouble               : Read / Write / Construct

Horizontal alignment of items within cells.

Allowed values: [0,1]

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 "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 vertical FALSE, there will be a maximum of 3 children in a row; if vertical is TRUE, there will be a maximum of 3 children in a column.

Allowed values: >= 0

Default value: 0


The "row-spacing" property

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

spacing between rows in the layout.

Allowed values: >= 0

Default value: 0


The "valign" property

  "valign"                   gdouble               : Read / Write / Construct

Vertical alignment of items within cells.

Allowed values: [0,1]

Default value: 0


The "vertical" property

  "vertical"                 gboolean              : Read / Write / Construct

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

Default value: FALSE