Responsible for the event handling of elements.

Static variables

private@:value(null)staticelemBlocking:Null<Element> = null

private@:value(null)staticelemFocused:Null<Element> = null

private@:value(null)staticelemHovered:Null<Element> = null

private@:value(new Map<Element,Array<Event>>())staticevents:Map<Element, Array<Event>> = new Map<Element,Array<Event>>()

All currently active events.

private@:value(false)staticinBackground:Bool = false

true if the window is in the background and not focused.

@:value(false)staticread onlyisAltDown:Bool = false

true if the Alt key is held down.

@:value(false)staticread onlyisCtrlDown:Bool = false

true if the Ctrl key is held down.

@:value(false)staticread onlyisShiftDown:Bool = false

true if the Shift key is held down.

staticread onlykeyboard:Null<Keyboard>

private@:value(null)staticlastPressedKey:Null<KeyCode> = null

private@:value(false)staticlastPressedKeyActive:Bool = false

private@:value(0.0)staticlastPressedTime:Float = 0.0

private@:value(false)staticmarkUnblock:Bool = false

Unblock on the next click event

staticread onlymouse:Null<Mouse>

@:value(0)staticread onlymouseDX:Int = 0

The delta x position of the mouse (the difference of the x position to the last frame)

@:value(0)staticread onlymouseDY:Int = 0

The delta y position of the mouse (the difference of the y position to the last frame)

private@:value(false)staticmouseMoved:Bool = false

private@:value(new Vector<Bool>(3))staticmousePressed:Vector<Bool> = new Vector<Bool>(3)

@:value(0)staticread onlymouseX:Int = 0

The x position of the mouse

@:value(0)staticread onlymouseY:Int = 0

The y position of the mouse

Static methods

staticinlineaddEvent(event:Event):Void

Adds an event to the event array. Events are sent in an update loop and not directly at the moment they happen to prevent stack overflows through circular calls and to make the overall process more stable.

private@:allow(koui.elements.Element)staticblock(actuator:Element):Void

staticcheckKeyCodePress():Void

privatestaticcheckMouseHover():Void

privatestaticcheckMousePressed():Void

private@:allow(koui.elements.Element)staticclearFocus():Void

privatestaticgetListeningParent(element:Null<Element>, eventClass:Class<Event>):Null<Element>

Return the lowest element in the parent/layout hierarchy (beginning with and including the passed element) that listens to the given event type.

staticinit():Void

privatestaticonBackground():Void

privatestaticonForeground():Void

privatestaticonKeyboardDown(key:KeyCode):Void

Called on the first frame a key is pressed down.

Parameters:

key

The keycode of the key

privatestaticonKeyboardPress(char:String):Void

Called when a key is pressed down. Note that this is called once on the first frame the key is pressed and after that on a certain time interval to simulate a OS-like input behaviour. Also, this method is only called by keys that represent a character.

Parameters:

char

The character that is pressed down

privatestaticonKeyboardUp(key:KeyCode):Void

Called on the first frame a key is no longer pressed down.

Parameters:

key

The keycode of the key

privatestaticonMouseDown(button:Int, x:Int, y:Int):Void

privatestaticonMouseLeave():Void

privatestaticonMouseMove(x:Int, y:Int, deltaX:Int, deltaY:Int):Void

privatestaticonMouseScroll(scrollDelta:Int):Void

privatestaticonMouseUp(button:Int, x:Int, y:Int):Void

privatestaticonPause():Void

privatestaticonResume():Void

privatestaticonShutdown():Void

staticinlineregisterCutCopyPaste(onCut:() ‑> String, onCopy:() ‑> String, onPaste:String ‑> Void):Void

staticregisterElement(element:Element):Void

staticreset():Void

Cancels ALL events. Used internally most of the time.

private@:value({ forceNow : false })@:allow(koui.elements.Element)staticunblock(forceNow:Bool = false):Void

Unblocks the currently blocking element. The unblocking takes place in the next frame to not react to ongoing events. The forceNow parameter is a way around that behaviour.

Parameters:

forceNow

If true, already unblock in the current frame

staticinlineunregisterCutCopyPaste():Void

staticupdate():Void

Updates all the events and calls registered listeners. Used internally most of the time.