|
A container that arranges children into a grid. More...
Public Member Functions | |
void | refresh () |
Recalculates the position and size of this control and all its children. | |
Public Attributes | |
bool | autoCellSize |
When true, the cell size is set to the widest/tallest child control. | |
int | colCount |
Number of columns the child controls have been arranged into. This value is calculated automatically when children are added, removed or resized; writing it directly has no effect. | |
int | colSize |
Width of each column. If autoCellSize is set, this will be calculated automatically from the widest child control. | |
int | colSpacing |
Spacing between columns. | |
bool | dynamicSize |
If true, the width or height of this control will be automatically calculated based on the number of child controls (width if fillRowFirst is false, height if fillRowFirst is true). | |
bool | fillRowFirst |
Controls whether rows or columns are filled first. | |
bool | frozen |
When true, the array will not update when new children are added or in response to child resize events. This is useful to prevent unnecessary resizing when adding, removing or resizing a number of child controls. | |
RectSpacingI | padding |
Padding around the top, bottom, left, and right of this control. This reduces the area available for child controls. | |
int | rowCount |
Number of rows the child controls have been arranged into. This value is calculated automatically when children are added, removed or resized; writing it directly has no effect. | |
int | rowSize |
Height of each row. If autoCellSize is set, this will be calculated automatically from the tallest child control. | |
int | rowSpacing |
Spacing between rows. |
A container that arranges children into a grid.
This container maintains a 2D grid of GUI controls. If one is added, deleted, or resized, then the grid is updated. The insertion order into the grid is determined by the internal order of the children (ie. the order of addition).
Children are added to the grid by row or column until they fill the assocated GuiDynamicCtrlArrayControl extent (width or height). For example, a GuiDynamicCtrlArrayControl with 15 children, and fillRowFirst set to true may be arranged as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
If dynamicSize were set to true in this case, the GuiDynamicCtrlArrayControl height would be calculated to fit the 3 rows of child controls.
new GuiDynamicCtrlArrayControl() { colSize = "128"; rowSize = "18"; colSpacing = "2"; rowSpacing = "2"; frozen = "0"; autoCellSize = "1"; fillRowFirst = "1"; dynamicSize = "1"; padding = "0 0 0 0"; //Properties not specific to this control have been omitted from this example. };
void GuiDynamicCtrlArrayControl::refresh | ( | ) |
Recalculates the position and size of this control and all its children.
When true, the cell size is set to the widest/tallest child control.
Number of columns the child controls have been arranged into. This value is calculated automatically when children are added, removed or resized; writing it directly has no effect.
Width of each column. If autoCellSize is set, this will be calculated automatically from the widest child control.
Spacing between columns.
If true, the width or height of this control will be automatically calculated based on the number of child controls (width if fillRowFirst is false, height if fillRowFirst is true).
Controls whether rows or columns are filled first.
If true, controls are added to the grid left-to-right (to fill a row); then rows are added top-to-bottom as shown below:
1 2 3 4 5 6 7 8
If false, controls are added to the grid top-to-bottom (to fill a column); then columns are added left-to-right as shown below:
1 3 5 7 2 4 6 8
When true, the array will not update when new children are added or in response to child resize events. This is useful to prevent unnecessary resizing when adding, removing or resizing a number of child controls.
RectSpacingI GuiDynamicCtrlArrayControl::padding |
Padding around the top, bottom, left, and right of this control. This reduces the area available for child controls.
Number of rows the child controls have been arranged into. This value is calculated automatically when children are added, removed or resized; writing it directly has no effect.
Height of each row. If autoCellSize is set, this will be calculated automatically from the tallest child control.
Spacing between rows.