class HorizontalLayoutData
package feathers.layout
extends EventDispatcher
implements ILayoutData
Provides optional percentage sizing for children of containers that use
HorizontalLayout
.
Events:
openfl.events.Event.CHANGE | Dispatched when a property of the layout data changes, which triggers the container to invalidate. |
---|
1.0.0
.See also:
Static methods
staticfill():HorizontalLayoutData
Creates HorizontalLayoutData
that fills the parent container, with the
percentWidth
and percentHeight
both set to 100.0
.
In the following example, one of the container's children fills the container's bounds:
var container = new LayoutGroup();
container.layout = new HorizontalLayout();
var child = new Label();
child.layoutData = HorizontalLayoutData.fill();
container.addChild(child);
1.0.0
.See also:
staticfillHorizontal(percentWidth:Float = 100.0):HorizontalLayoutData
Creates HorizontalLayoutData
that fills the width of the parent
container, with the ability to optionally specify a percentage value to
pass to percentWidth
.
In the following example, one of the container's children fills the container's width:
var container = new LayoutGroup();
container.layout = new HorizontalLayout();
var child = new Label();
child.layoutData = HorizontalLayoutData.fillHorizontal();
container.addChild(child);
1.0.0
.See also:
staticfillVertical(percentHeight:Float = 100.0):HorizontalLayoutData
Creates HorizontalLayoutData
that fills the height of the parent
container, with the ability to optionally specify a percentage value to
pass to percentHeight
.
In the following example, one of the container's children fills the container's height:
var container = new LayoutGroup();
container.layout = new HorizontalLayout();
var child = new Label();
child.layoutData = HorizontalLayoutData.fillHorizontal();
container.addChild(child);
1.0.0
.See also:
Constructor
new(?percentWidth:Float, ?percentHeight:Float)
Creates a new HorizontalLayoutData
object from the given arguments.
1.0.0
.Variables
marginLeft:Null<Float>
Extra space, measured in pixels, that is inserted before this item in the layout.
This item's marginLeft
value will be added to the layout's gap
value and the previous item's marginRight
value to create the total
space between items. If this is the first item in the layout, nothing
will be added to this item's marginLeft
value.
Negative values are allowed for the margins.
1.1.0
.See also:
marginRight:Null<Float>
Extra space, measured in pixels, that is inserted after this item in the layout.
This item's marginRight
value will be added to the layout's gap
value and the next item's marginLeft
value to create the total space
between items. If this is the last item in the layout, nothing will be
added too the marginRight
value.
Negative values are allowed for the margins.
1.1.0
.See also:
percentHeight:Null<Float>
The height of the layout object, as a percentage of the parent container's height.
A percentage may be specified in the range from 0.0
to 100.0
. If the
value is set to null
, this property is ignored.
Tip: If all children of the same container will have the percentHeight
value set to 100.0
, it's better for performance to set
HorizontalLayout.verticalAlign
to VerticalAlign.JUSTIFY
instead.
In the following example, the height of a container's child is set to 50% of the container's height:
var container = new LayoutGroup();
container.layout = new HorizontalLayout();
var percentages = new HorizontalLayoutData();
percentages.percentHeight = 50.0;
var child = new Label();
child.layoutData = percentages;
container.addChild(child);
1.0.0
.percentWidth:Null<Float>
The width of the layout object, as a percentage of the parent container's width.
A percentage may be specified in the range from 0.0
to 100.0
. If the
value is set to null
, this property is ignored and the standard width
in pixels will be used.
The parent container will calculate the sum of all of its children with
explicit pixel widths, and then the remaining space will be distributed
to children with percent widths. Additionally, if the total sum
of percentWidth
values exceeds 100.0
, all percentWidth
values will
be normalized to the range from 0.0
to 100.0
.
In the following example, the width of a container's child is set to 50% of the container's width:
var container = new LayoutGroup();
container.layout = new HorizontalLayout();
var percentages = new HorizontalLayoutData();
percentages.percentWidth = 50.0;
var child = new Label();
child.layoutData = percentages;
container.addChild(child);
1.0.0
.