class Expander
package koui.elements.layouts
extends Layout › Element
Constructor
new(posX:Int, posY:Int, width:Int, height:Int, direction:ExpanderDirection)
Create a new Expander layout. Depending on the direction, either the
given width
or height
is ignored.
Variables
Methods
Inherited Variables
Defined by Layout
@:value(false)absorbEvents:Bool = false
If true
, this Layout does receive events and block sub-elements from
receiving them.
See also:
@:value(false)read onlyinvalidLayout:Bool = false
true
if the layout needs to be recalculated before the next frame.
@:value(false)spreadEvents:Bool = false
If true
, all elements of this layout will receive the same events
as the layout itself. Individual events are not received then.
This behaviour takes effect only if Layout.absorbEvents
is true
.
Defined by Element
private@:value(true)autoRenderChildren:Bool = true
Whether the children of the element are automatically drawn after the element, or whether element must render its children by its own. The latter can be useful if the children need to be drawn in a specified order.
@:value(false)disabled:Bool = false
true
if the element is disabled and should not react to events. Also,
elements might look different if disabled depending on the theme.
private@:value(["" => ["default", "disabled"]])read onlystates:Map<String, Array<String>> = ["" => ["default", "disabled"]]
States for each context element: ctxElement => states
private@:value(false)styleInitialized:Bool = false
Whether this element already initialized its style.
private@:value("_root")tID:String = "_root"
The theme ID of this object. Use this to select which theme settings to apply.
@:value(true)visible:Bool = true
If false
, the element is not visible and will not react to any events.
Inherited Methods
Defined by Layout
calcElementSize(element:Element, parentWidth:Int, parentHeight:Int):Bool
Calculates the size of the given element if the size is defined as dynamic by the element's style, taking the dimension of the parent container and the anchor point into account (the container might be a layout or a subsection for example).
Returns:
Bool Whether the element was resized
invalidateLayout():Void
Mark this layout as invalid so that it is recalculated before the next frame is drawn.
inlinesetPadding(left:Int, right:Int, top:Int, bottom:Int):Void
Sets the padding values of this layout.
Parameters:
left | The left padding |
---|---|
right | The right padding |
top | The top padding |
bottom | The bottom padding |
Defined by Element
finaladdEventListener<T>(eventClass:Class<T>, callback:T ‑> Void):Void
Register a callback to be called if the given event occurs on this element.
Example:
var button = new Button("Hello!");
button.addEventListener(MouseClickEvent, (event: MouseClickEvent) -> {
if (event.mouseButton == Left && event.getState() == ClickStart) {
trace("Clicked!");
}
});
Parameters:
eventClass | The class of the event, must be a subclass of |
---|---|
callback | The callback function to call if the event occurs |
privateinlineinvalidateElem():Void
Notify the parent layout on the next frame that this element has changed its size or position. Use the next frame to make sure we don't waste calculations when more than one value changes during one frame.
inlineisAtPosition(x:Int, y:Int):Bool
Return true
if this element overlaps with the given position. Used
internally for event handling most of the time. Elements may override
this method to provide more detailed mouse interaction.
If the element is invisible, false
is returned.
finalinlinelistensTo<T>(eventClass:Class<T>):Bool
Returns whether this element has a registered event listener for the given event type.
finalinlinelistensToUID<T>(eventTypeUID:String):Bool
Returns whether this element has a registered event listener for the given event type.
finalinlinerenderElement(g:KGraphics, element:Element):Void
Setup the given element for drawing and call its draw method afterwards.
private@:value({ ctxElement : "" })inlinerequireStates(states:Array<String>, ctxElement:String = ""):Void
private@:value({ recursive : true, ctxElement : "" })inlinesetContext(state:String, ctxElement:String = "", recursive:Bool = true):Void
Set the current style context used for drawing. Calling this function is
equivalent to calling setContextState
and setContextElement
. If the
given element name is ""
, the element's tID
is used.
Parameters:
state | |
---|---|
ctxElement |
See also:
setContextElement
setContextState
resetContext
private@:value({ ctxElement : "" })inlinesetContextElement(ctxElement:String = ""):Void
Set the drawing context element but keep the current state. If the given
element name is ""
, the element's tID
is used.
See also:
setContextState
setContext
resetContext
private@:value({ recursive : true })inlinesetContextState(state:String, recursive:Bool = true):Void
Set the drawing context state but keep the current element.
See also:
setContextElement
setContext
resetContext