class Element
package koui.elements
extended by Layout, Button, Checkbox, Dropdown, Label, Panel, Progressbar, Slider, TextInput
The base class of all elements.
Variables
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.
Methods
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 |
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.