An automatic layout system.
Constructor
new(?parent:Object)
Create a new Flow instance.
Parameters:
parent | An optional parent |
---|
Variables
backgroundTile:Tile
Setting a background tile will create an h2d.ScaleGrid
background which uses the Flow.borderWidth
/Flow.borderHeigh
values for its borders.
It will automatically resize when the reflow is done to cover the whole Flow area.
borderBottom:Int = 0
Bottom border width of the Flow.backgroundTile
.
Does not affect padding by default, which can be enabled with -D flow_border
compilation flag.
If border padding is enabled, Flow.outerHeight
will be affected accordingly even if background tile is not set
and will follow the same constraint limitation as padding.
See also:
write onlyborderHeight:Int
Set the border height of the Flow.backgroundTile
's top and bottom borders.
Does not affect padding by default, which can be enabled with -D flow_border
compilation flag.
If border padding is enabled, Flow.outerHeight
will be affected accordingly even if background tile is not set
and will follow the same constraint limitation as padding.
See also:
borderLeft:Int = 0
Left border width of the Flow.backgroundTile
.
Does not affect padding by default, which can be enabled with -D flow_border
compilation flag.
If border padding is enabled, Flow.outerHeight
will be affected accordingly even if background tile is not set
and will follow the same constraint limitation as padding.
See also:
borderRight:Int = 0
Right border width of the Flow.backgroundTile
.
Does not affect padding by default, which can be enabled with -D flow_border
compilation flag.
If border padding is enabled, Flow.outerHeight
will be affected accordingly even if background tile is not set
and will follow the same constraint limitation as padding.
See also:
borderTop:Int = 0
Top border width of the Flow.backgroundTile
.
Does not affect padding by default, which can be enabled with -D flow_border
compilation flag.
If border padding is enabled, Flow.outerHeight
will be affected accordingly even if background tile is not set
and will follow the same constraint limitation as padding.
See also:
write onlyborderWidth:Int
Set the border width of the Flow.backgroundTile
's left and right borders.
Does not affect padding by default, which can be enabled with -D flow_border
compilation flag.
If border padding is enabled, Flow.outerWidth
will be affected accordingly even if background tile is not set
and will follow the same constraint limitation as padding.
See also:
debug:Bool
When set to true, the Flow will display a debug overlay. Red box around the flow Green box for the client space. Blue boxes for each element.
enableInteractive:Bool
Adds an h2d.Interactive
to the Flow that is accessible through Flow.interactive
field.
This Interactive is automatically resized to cover the whole Flow area.
Flow is added as a bottom-most (after the Flow.backgroundTile
) child as to not impede flow elements with Interactives.
fillHeight:Bool = false
When set to true, if a height constraint is present and minHeight
is null - Flow will expand to fill all the available vertical space
fillWidth:Bool = false
When set to true, if a width constraint is present and minWidth
is null - Flow will expand to fill all the available horizontal space
horizontalAlign:Null<FlowAlign>
Horizontal alignment of elements inside the flow.
See FlowAlign
for more details.
read onlyinnerHeight:Int
Calculate the client height, which is the inner size of the flow without the borders and padding.
See also:
read onlyinnerWidth:Int
Calculate the client width, which is the inner size of the flow without the borders and padding.
See also:
isInline:Bool = true
When isInline is set to false, the flow size will be reported based on its bounds instead of its calculated size.
See also:
layout:FlowLayout = Horizontal
The Flow item layout rules.
See FlowLayout
for specific details on each mode.
maxHeight:Null<Int>
Attempts to limit the Flow outer height to the specified height.
Used as a baseline for overflow when Flow.multiline
is enabled and Flow.layout
is Vertical
.
maxWidth:Null<Int>
Attempts to limit the Flow outer width to the specified width.
Used as a baseline for overflow when Flow.multiline
is enabled and Flow.layout
is Horizontal
.
minHeight:Null<Int>
Ensures that Flow is at least the specified outer height at all times when not null.
minWidth:Null<Int>
Ensures that Flow is at least the specified outer width at all times when not null.
multiline:Bool = false
When set to true, uses specified lineHeight/colWidth instead of maxWidth/maxHeight for alignment.
needReflow:Bool = true
If some sub element gets resized, you need to set reflow to true in order to force
the reflow of elements. You can also directly call Flow.reflow
which will immediately
update all elements positions.
If a reflow is needed, Flow.reflow
will be called before rendering the flow.
Each change in one of the flow properties or addition/removal of elements will set needReflow to true.
read onlyouterHeight:Int
Flow total height Compared to Flow.innerHeight
, it also includes paddings and, if enabled, borders (see Flow.borderHeight
).
See also:
read onlyouterWidth:Int
Flow total width. Compared to Flow.innerWidth
, it also includes paddings and, if enabled, borders (see Flow.borderWidth
).
See also:
overflow:FlowOverflow = Expand
Enabling overflow will treat maxWidth/maxHeight and lineHeight/colWidth constraints as absolute : bigger elements will overflow instead of expanding the limit.
See respective FlowOverflow
values for more details.
write onlypadding:Int
Will set all padding values at the same time.
Note that padding is applied inside the flow boundaries and included in the size constraint, shrinking available space for Flow children.
See also:
paddingBottom:Int = 0
Sets the extra padding along the bottom edge of the Flow.
Note that padding is applied inside the flow boundaries and included in the size constraint, shrinking available space for Flow children.
write onlypaddingHorizontal:Int
Will set Flow.paddingLeft
and Flow.paddingRight
to the given value.
Note that padding is applied inside the flow boundaries and included in the size constraint, shrinking available space for Flow children.
paddingLeft:Int = 0
Sets the extra padding along the left edge of the Flow.
Note that padding is applied inside the flow boundaries and included in the size constraint, shrinking available space for Flow children.
paddingRight:Int = 0
Sets the extra padding along the right edge of the Flow.
Note that padding is applied inside the flow boundaries and included in the size constraint, shrinking available space for Flow children.
paddingTop:Int = 0
Sets the extra padding along the top edge of the Flow.
Note that padding is applied inside the flow boundaries and included in the size constraint, shrinking available space for Flow children.
write onlypaddingVertical:Int
Will set Flow.paddingTop
and Flow.paddingBottom
to the given value.
Note that padding is applied inside the flow boundaries and included in the size constraint, shrinking available space for Flow children.
reverse:Bool = false
When set to true, children are aligned in reverse order.
Note that it does not affect render ordering, and may cause overlap of elements due to them positioned in reverse order.
scrollPosY:Float = 0.
The current scrolling position for the flow content (in pixels). Only applies when overflow is Scroll or Hidden.
scrollWheelSpeed:Float = 30.
The amount of scrolling that is done when using mouse wheel (in pixels).
verticalAlign:Null<FlowAlign>
Vertical alignment of elements inside the flow.
See FlowAlign
for more details.
Methods
addSpacing(v:Int):Void
Adds some spacing by either increasing the padding of the latest non-absolute element or the padding of the flow if there are no elements in it.
The padding affected depends on the Flow.layout
mode.
It's impossible to add spacing with a Stack
Flow layout.
getProperties(e:Object):FlowProperties
Get the per-element properties. Returns null if the element is not currently part of the Flow.
Requesting the properties will cause a reflow regardless if properties values were changed or not.
reflow():Void
Call to force all flowed elements position to be updated.
See Flow.needReflow
for more information.