Class GridLayout
Object
|
+--GridLayout
-
Direct Known Subclasses:
-
FlowLayout
- class
GridLayout
Defined in grid_layout.js
Field Summary |
var |
alignment
|
<static> <final> int |
COL_MAJOR
A constant that tells GridLayout to first fill all the columns in row 0,
before wrapping to row 1. |
<static> <final> int |
ROW_MAJOR
A constant that tells GridLayout to first fill all the rows in column 0,
before wrapping to column 1. |
Constructor Summary |
GridLayout
(<int> majority, <int> count, <Container> container, <Function> sizingFunc)
Creates a grid layout manager.
|
Method Summary |
Container
|
getContainer()
Returns a reference to the Container governed
by this GridLayout .
|
void
|
layout(<boolean> flushCache)
Causes the GridLayout to resize and reposition the children
of its container according to the sizing function passed to its constructor.
|
alignment
var alignment
COL_MAJOR
<static> <final> int COL_MAJOR
A constant that tells GridLayout
to first fill all the columns in row 0,
before wrapping to row 1.
ROW_MAJOR
<static> <final> int ROW_MAJOR
A constant that tells GridLayout
to first fill all the rows in column 0,
before wrapping to column 1.
GridLayout
function GridLayout(<int> majority, <int> count, <Container> container, <Function> sizingFunc)
Creates a grid layout manager.
Parameters:
majority
- one of GridLayout.ROW_MAJOR
or GridLayout.COL_MAJOR
.
count
- the number of rows or columns in the grid.
container
- the container whose children will be governed this layout manager
sizingFunc
- a function taking the following parameters: children
- a WidgetList
of the children being laid out rows
- the number of rows in the grid cols
- the number of columns in the grid availWidth
- the width available to the layout, expressed as an instance of Pixels
availHeight
- the height available to the layout, expressed as an instance of Pixels
pixelsPerEm
- the number of pixels per em for the current container as an int
flushCache
- a boolean
indicating whether or not to flush any cached values that the sizing function is maintaining
sizingFunc
must return an object with the following properties: lefts
- an array of integers. The value lefts[i]
is the number of pixels in from the left edge of container
to place the left edge of cell i
in each row of the grid. tops
- an array of integers. The value tops[i]
is the number of pixels down from the top edge of container
to place the top edge of cell i
in each column of the grid. widths
- an array of integers. The value widths[i]
is the number of pixels wide to make the i
'th cell in each row of the grid. heights
- an array of integers. The value heights[i]
is the number of pixels tall to make the i
'th cell in each column of the grid. nothingChanged
- (Optional) a boolean
indicating whether or not to proceed with the layout algorithm. If nothingChanged
is true
then no further processing will be done for this widget or any of its children. The default is false
, which implies all of this widget's children will be visited.
getContainer
Container getContainer()
Returns a reference to the Container
governed
by this GridLayout
.
Returns:
the Container
this GridLayout is responsible for
layout
void layout(<boolean> flushCache)
Causes the GridLayout
to resize and reposition the children
of its container according to the sizing function passed to its constructor.
Parameters:
flushCache
- (Optional) - if flushCache
is true
then any cached data that the GridLayout
is maintaining will be ignored and size and position data will be recalculated for all the widgets governed by the GridLayout
. If flushCache
is false
then the GridLayout
will use as much cached data as it can to improve performance. Defaults to false
.
