Interface Event
-
- All Implemented Interfaces:
public interface EventEvents are how PolyUI communicates between components and to the user.
Everything from mouse clicks, key presses, text input changes, initialization and destruction of components are communicated through events.
(since 1.3.1) events can be destructured, like so:
drawable.onClick { (x, y) -> // access and use the x and y position of the mouse with a prettier syntax }These events can be dispatched by your own components, and you can add your own events - though PolyUI comes with 22 events by default.
Some events are specific, requiring constructor parameters to ensure that for example, only single, left-click events are handled by any given handler. others are non-specific, like Focused.UnmappedInput and receive any matching event of the type.
by default, an event is non-specific. in order to make it specific, override the equals and hashCode methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceEvent.MouseEvents related to the mouse.
public interfaceEvent.LifetimeEvents related to the lifetime of a component.
public abstract classEvent.ChangeEvents related to specific things that occur in some components, for example when a switch is toggled, a slider is moved or a text is changed.
These events can be cancelled, meaning that the change in state will not occur.
public interfaceEvent.FocusedEvents for focusable components (components which receive keyboard input)
In order to receive these events, the focusable flag must be
true.
-