|
Sydney | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Function | +--FlexibleSizingFunction
Defined in flexible_sizing_function.js
Constructor Summary | |
FlexibleSizingFunction
(<float> hMargin, <float> vMargin, <float> hGutter, <float> vGutter)
Creates a sizing function suitable for use with a GridLayout .
|
Method Summary | |
Object
|
getColumnWidth(<int> column)
Returns the width of the given column. |
Object
|
getDefaultColumnWidth()
|
Object
|
getDefaultRowHeight()
|
Object
|
getRowHeight(<int> row)
Returns the height of the given row. |
boolean
|
isColumnDefault(<int> column)
Returns true if and only if column column has no specified width.
|
boolean
|
isRowDefault(<int> row)
Returns true if and only if row row has no specified height.
|
void
|
setBottomMargin(<float> bMargin)
Sets the bottom margin to bMargin pixels.
|
void
|
setColumnWidth(<int> column, <float> width, <float> weight, <boolean> usePixels)
Sets the width of column column to width .
|
void
|
setDefaultColumnWidth(<float> width, <boolean> canGrow, <boolean> usePixels)
Sets the default column width to width .
|
void
|
setDefaultRowHeight(<float> height, <boolean> canGrow, <boolean> usePixels)
Sets the default row height to height .
|
void
|
setHorizontalMargin(<float> hMargin)
Sets both the left and right margins to hMargin pixels.
|
void
|
setLeftMargin(<float> lMargin)
Sets the left margin to lMargin pixels.
|
void
|
setRightMargin(<float> rMargin)
Sets the right margin to rMargin pixels.
|
void
|
setRowHeight(<int> row, <float> height, <float> weight, <boolean> usePixels)
Sets the height of row row to height .
|
void
|
setTopMargin(<float> tMargin)
Sets the top margin to tMargin pixels.
|
void
|
setVerticalMargin(<float> vMargin)
Sets both the top and bottom margins to vMargin pixels.
|
<static> boolean
|
computeSizes(<int> cells, <int> availSize, <float> pixelsPerEm, <Array> sizeCache, <Array> edgeCache, <Hash> cellDimensions, <float> reservedSize, <float> reservedWeight, <Object> defaultSize, <float> marginOne, <float> marginTwo, <float> gutter)
Computes either the horizontal or vertical dimensions of a grid's cells. |
Constructor Detail |
function FlexibleSizingFunction(<float> hMargin, <float> vMargin, <float> hGutter, <float> vGutter)
GridLayout
.
The parameters to the constructor are explained visually below:
^ | ||||||
| | ||||||
Top Margin | ||||||
| | ||||||
v | ||||||
<- Left Margin -> | Widget | Widget | Widget | <- Right Margin -> | ||
^ | ||||||
| | ||||||
vGutter | ||||||
| | ||||||
v | ||||||
Widget | <- hGutter -> | Widget | <- hGutter -> | Widget | ||
^ | ||||||
| | ||||||
vGutter | ||||||
| | ||||||
v | ||||||
Widget | Widget | Widget | ||||
^ | ||||||
| | ||||||
Top Margin | ||||||
| | ||||||
v |
hMargin
- the number of pixels to use as the left and right margins
vMargin
- the number of pixels to use as the top and bottom margins
hGutter
- how many pixels to put to the left and right of each widget
vGutter
- how many pixels to put above and below each widget
Method Detail |
Object getColumnWidth(<int> column)
column
- the index of the column to query
column
Object getDefaultColumnWidth()
Object getDefaultRowHeight()
Object getRowHeight(<int> row)
row
- the index of the row to query
row
boolean isColumnDefault(<int> column)
true
if and only if column column
has no specified width.
column
- the index of the column to query
true
if column column
will be sized to the default column width and false
otherwise
boolean isRowDefault(<int> row)
true
if and only if row row
has no specified height.
row
- the index of the row to query
true
if row row
will be sized to the default row height and false
otherwise
void setBottomMargin(<float> bMargin)
bMargin
pixels.
bMargin
- the new height of the bottom margin
void setColumnWidth(<int> column, <float> width, <float> weight, <boolean> usePixels)
column
to width
. To set the given
column back to the default settings, pass only column
. width
is
a number of ems unless usePixels
is true
. If weight
is zero then the given column will not grow (it will always be exactly width
units wide). If weight
is non-zero, then the given column will always be at
least width
units wide but will grow larger if there is extra space. The sum
of the column weights must be between zero and one.
column
- the index of column to affect
width
- the width of the column as a float
weight
- (Optional) - a number between zero and one indicating what portion of extra space should be allocated to this column. Defaults to zero.
usePixels
- (Optional) - a boolean
indicating whether width
is a number of ems or pixels. Defaults to false
.
void setDefaultColumnWidth(<float> width, <boolean> canGrow, <boolean> usePixels)
width
. If canGrow
is true
then width
is interpreted as a minimum width. If usePixels
is
true
then width
is interpreted as a pixel value, otherwise it is
interpreted as an em value. canGrow
and usePixels
both default to
false
.
width
- the number of ems (or pixels, if usePixels
is true
) wide to make columns with unspecified width. width
is an float
and must be non-negative.
canGrow
- (Optional) - a boolean
indicating whether or not default-width columns can grow wider than their specified minimum width. If canGrow
is true then columns with no specified width will grow to use up any extra available width.
usePixels
- (Optional) - a boolean
indicating whether to interpret width
as a number of pixels or a number of ems. width
is a number of pixels if and only if usePixels is true
.
void setDefaultRowHeight(<float> height, <boolean> canGrow, <boolean> usePixels)
height
. If canGrow
is true
then height
is interpreted as a minimum height. If usePixels
is
true
then height
is interpreted as a pixel value, otherwise it is
interpreted as an em value. canGrow
and usePixels
both default to
false
.
height
- the number of ems (or pixels, if usePixels
is true
) tall to make rows with unspecified height. height
is a float
and must be non-negative.
canGrow
- (Optional) - a boolean
indicating whether or not default-height rows can grow taller than their specified minimum height. If canGrow
is true then rows with no specified height will grow to use up any extra available height.
usePixels
- (Optional) - a boolean
indicating whether to interpret height
as a number of pixels or a number of ems. height
is a number of pixels if and only if usePixels is true
.
void setHorizontalMargin(<float> hMargin)
hMargin
pixels.
hMargin
- the new width of the horizontal margins
void setLeftMargin(<float> lMargin)
lMargin
pixels.
lMargin
- the new width of the left margin
void setRightMargin(<float> rMargin)
rMargin
pixels.
rMargin
- the new width of the right margin
void setRowHeight(<int> row, <float> height, <float> weight, <boolean> usePixels)
row
to height
. To set the given row back
to the default settings, pass only row
. height
is a number of ems
unless usePixels
is true
. If weight
is zero then the
given row will not grow (it will always be exactly height
units tall). If
weight
is non-zero, then the given row will always be at least height
units tall but will grow larger if there is extra space. The sum of the row weights must be
between zero and one.
row
- the index of row to affect
height
- the height of the row as a float
weight
- (Optional) - a number between zero and one indicating what portion of extra space should be allocated to this row. Defaults to zero.
usePixels
- (Optional) a boolean
indicating whether height
is a number of ems or pixels. Defaults to false
.
void setTopMargin(<float> tMargin)
tMargin
pixels.
tMargin
- the new height of the top margin
void setVerticalMargin(<float> vMargin)
vMargin
pixels.
vMargin
- the new height of the vertical margins
<static> boolean computeSizes(<int> cells, <int> availSize, <float> pixelsPerEm, <Array> sizeCache, <Array> edgeCache, <Hash> cellDimensions, <float> reservedSize, <float> reservedWeight, <Object> defaultSize, <float> marginOne, <float> marginTwo, <float> gutter)
cells
- the number of cells in this direction
availSize
- the number of pixels available in this dimension
pixelsPerEm
- the number of pixels per em
sizeCache
- a reference to an array in which cell sizes will be stored
edgeCache
- a reference to an array in which cell edge co-ordinates will be stored
cellDimensions
- a Hash
from cell number to dimension spec for each cell with predefined dimensions
reservedSize
- the total number of pixels reserved by cells with predefined dimensions
reservedWeight
- the total fraction of ‘extra space’ reserved by cells with predefined dimensions
defaultSize
- a dimension spec to apply to cells with no predefined dimensions
marginOne
- the number of pixels to use for either the top or left margin
marginTwo
- the number of pixels to use for either the bottom or right margin
gutter
- the number of pixels of gutter to apply
true
if sizeCache
or edgeCache
changed and false
otherwise
|
Sydney | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |