class RadioButton
package koui.elements
extends Checkbox › Element
A radio button is a special kind of checkbox that is used to select exactly
one option from a set of options. Radio buttons belong to a RadioGroup
that
holds all related radio buttons from which only one option can be selected.
See also:
Constructor
new(group:RadioGroup, label:String)
Creates a new RadioButton
.
Parameters:
group | The |
---|---|
label | The label of this radio button. |
Variables
Methods
Inherited Variables
Defined by Checkbox
private@:value(function() -> @:implicitReturn return { })onCheckedFunc:() ‑> Void = function() -> @:implicitReturn return { }
private@:value(function() -> @:implicitReturn return { })onUncheckedFunc:() ‑> Void = function() -> @:implicitReturn return { }
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 Checkbox
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