When regular Interactive is too little, but SimpleButton is too inflexible. Write your own state view! Class handles keeping track of current button state as well as lets you simulate the state. More specific behavior can be achieved by using flags. All View have to do is implement setState(state, flags) method and handle viewing specific state.

Constructor

new (width:Float, height:Float, ?parent:Object, ?shape:Collider, ?views:Array<IButtonStateView>)

Variables

read onlyflags:ButtonFlags

Current state of the button in regard to mouse interaction.

@:value(0xff)read onlysimState:ButtonState = 0xff

Current simulated state. Disabled if set to 0xff. While simulated state is active, CustomButton keeps track of real button state, but does not invalidate the view.

read onlystate:ButtonState

Flag list the button currently contains. Does not affect state invalidation and used solely for views to utilize.
Most simple use-case is disabling the button.

views:Array<IButtonStateView>

Methods

inlineclearSimulatedState ():Void

invalidate ():Void

Invalidates button and forces invalidate to be called.

setFlag (flag:ButtonFlags, value:Bool):Void

inlinesimulateState (state:ButtonState):Void

Inherited Variables

Defined by EventInteractive

@:value(new EventSignal1())onCheckEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onClickEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onFocusEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onFocusLostEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onKeyDownEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onKeyUpEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onMoveEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onOutEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onOverEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onPushEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onReleaseEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onReleaseOutsideEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onTextInputEvent:EventSignal1<Event> = new EventSignal1()

@:value(new EventSignal1())onWheelEvent:EventSignal1<Event> = new EventSignal1()

Inherited Methods

Defined by EventInteractive