/usr/share/SuperCollider/HelpSource/Classes/GridLayout.schelp is in supercollider-common 1:3.8.0~repack-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | CLASS:: GridLayout
summary:: A layout that organizes views in a grid
categories:: GUI>Layout
related:: Classes/HLayout, Classes/VLayout, Classes/StackLayout, Guides/GUI-Layout-Management
DESCRIPTION::
GridLayout distributes its space into a strong::grid of rows and columns::, where each item can occupy strong::one or more cells::.
You can construct the layout in two ways using link::#*rows:: and link::#*columns::. In the former constructor you pass arrays of items by rows, and in the latter by columns. Items can also be added later using link::#-add:: and link::#-addSpanning::. To remove an item, simply use link::Classes/View#-remove:: for views, or link::Classes/QObject#-destroy:: for views or layouts.
It is possible to add more than one view into the same cell. The last added view will be the top-most. However, it is most probably more convenient to use a link::Classes/StackLayout:: for that purpose.
The layout manages the grid size automatically: you can add an item at any row and cell number. When items are added or removed, the grid will re-adjust according to the last occupied row and column.
subsection:: Fine tuning
Each item can be assigned an strong::alignment:: either at layout link::#*rows#construction:: or later using link::#-setAlignment::. An item will then get at most its default size, if available (see: link::Classes/View#-sizeHint::), and will be aligned within its cell according to the specified alignment.
Each row or column can be assigned a strong::stretch factor:: using link::#-setRowStretch:: and link::#-setColumnStretch::. Rows or columns that would otherwise get equal space are then distributed according to the relative proportions of their stretch factors.
Each row or column can also be assigned a strong::minimum:: size using link::#-setMinRowHeight:: and link::#-setMinColumnWidth::, to override the size constraints imposed by the contained views.
In addition to adjusting the spacing between cells using link::Classes/Layout#-spacing:: you can control the spacing between rows and between columns separately using link::#-hSpacing:: and link::#-vSpacing::.
subsection:: Leaving empty space
You can leave any cell empty by not placing any item into it, or at link::#*rows#construction:: using code::nil:: instead of a view or another layout. Note though that the empty cells will always be regarded as freely stretchable and will not impose any constraints on space distribution.
CLASSMETHODS::
PRIVATE:: key
PRIVATE:: qtClass
METHOD:: rows
Creates a GridLayout and fills each row with an array of items given as arguments.
argument:: ... rows
Each argument is an Array of items to form a consecutive row. An item can be a strong::view::, another strong::layout::, or strong::nil:: for an empty cell.
discussion::
You can make an item span more than one cell by wrapping it into an Array, followed by pairs of (\rows, number) and/or (\columns, number). You can also assign an alignment to an item by following it with a pair of (\align, alignment). \rows, \columns, and \align can be abbreviated with \r, \c, and \a, respectively. For possible alignment values see link::Reference/gui_alignments::.
The simplified syntax for placing key-value pairs into an array comes handy (see link::Reference/Syntax-Shortcuts#Creating Arrays with key-value pairs::, and the example below).
Example:
Code::
(
w=Window().layout_( GridLayout.rows(
[Slider2D(), Slider2D(), [Slider(), rows:2]],
[Slider2D(), Slider2D()],
[[Slider().orientation_(\horizontal), columns:2]]
)).front;
)
::
METHOD:: columns
Creates a GridLayout and fills each column with an array of items given as arguments.
argument:: ... cols
Each argument is an Array of items to form a consecutive column. An item can be a strong::view::, another strong::layout::, or strong::nil:: for an empty cell.
discussion::
To make an item span several cells, or assign an alignment to it, the same instructions as for link::#*rows:: apply.
INSTANCEMETHODS::
METHOD:: add
Adds an item into the cell at specified row and column.
argument:: item
The item can be a strong::view:: or another strong::layout::.
argument:: row
The row index.
argument:: column
The column index.
argument:: align
A symbol denoting the alignment, or nil. See link::Reference/gui_alignments:: for possible values.
METHOD:: addSpanning
Adds an item into the grid so as to occupy several cells.
argument:: item
The item can be a strong::view:: or another strong::layout::.
argument:: row
The row index.
argument:: column
The column index.
argument:: rowSpan
The amount of cells to occupy in vertical direction.
argument:: columnSpan
The amount of cells to occupy in horizontal direction.
argument:: align
A symbol denoting the alignment, or nil. See link::Reference/gui_alignments:: for possible values.
METHOD:: hSpacing
The spacing between columns, in Integer amount of pixels.
METHOD:: vSpacing
The spacing between rows, in Integer amount of pixels.
METHOD:: setRowStretch
Sets the stretch factor of a row. By default rows have a stretch factor of 0. If a larger factor is assigned to a row, rows will get their space redistributed according to the relative proportions of their factors.
argument:: row
The index of a row.
argument:: factor
An Integer.
METHOD:: setColumnStretch
Sets the stretch factor of a column. By default columns have a stretch factor of 0. If a larger factor is assigned to a column, columns will get their space redistributed according to the relative proportions of their factors.
argument:: column
The index of a column.
argument:: factor
An Integer.
METHOD:: setAlignment
Sets the alignment of an item managed by the layout.
argument:: item
A view or a layout managed by this layout, or a Point of which x denotes the column index and y the row index of an item.
argument:: align
A symbol denoting the alignment. See link::Reference/gui_alignments:: for possible values.
METHOD:: minRowHeight
Gets the minimum height assigned to a row.
argument:: row
The index of a row.
METHOD:: setMinRowHeight
Sets the minimum height of row.
argument:: row
The index of a row.
argument:: height
An Integer amount of pixels.
METHOD:: minColumnWidth
Gets the minimum width assigned to a column.
argument:: column
The index of a column.
METHOD:: setMinColumnWidth
Sets the minimum width of a column.
argument:: column
The index of a column.
argument:: width
An Integer amount of pixels.
|