[GUI] Event propagation in Widget 2.x

The MicroUI 2.x events (touch, buttons…) are sent to the application in the same order as they are generated.
In MicroUI, events are sent to the controller of the displayable that is shown on the display.
In MWT, events are sent to the controller of the Desktop that dispatches the event to its children widgets.

Pointer Events

Pointer events are grouped in sessions. A session starts when the pointer is pressed, and ends when the pointer is released.
While no renderable consumes the events, they are sent to the renderable that is under the pointer, then sent to all its parent hierarchy. Once a renderable has consumed an event, every other event in the session is sent to it.
The renderable under the pointer is requested using Desktop.panelAt() and Panel.getWidgetAt(). By default every widget is considered as a rectangular area. This area can be modified by subclassing Widget.contains().

Other Events

For other events, the events are sent to the focus owner of the active panel, then sent to all its parent hierarchy while the event is not consumed.

image

1 Like