pub enum EventPayload<'a> {
Show 31 variants
Clicked,
TextChanged(&'a str),
TextSubmitted(&'a str),
FocusLost,
ProtocolError {
code: u32,
message: &'a str,
},
KeyDown {
key: Key,
shift_key: bool,
ctrl_key: bool,
alt_key: bool,
meta_key: bool,
},
RangeRequested {
start: u32,
count: u32,
},
ValueChanged(f64),
WindowSizeChanged {
width_dp: f32,
height_dp: f32,
class: WindowSizeClass,
height_class: WindowHeightClass,
},
FilesEntered,
FilesDropped(&'a str),
DesignSystemResolved(DesignSystem),
Resync,
LifecycleStart,
LifecycleStop,
NotificationActivated {
action: u32,
key: &'a str,
},
NotificationPermissionChanged(NotificationPermission),
CodeChanged {
version: u32,
start_line: u32,
start_column: u32,
end_line: u32,
end_column: u32,
text: &'a str,
},
CodeEditRejected {
request_id: u32,
base_version: u32,
current_version: u32,
start_line: u32,
start_column: u32,
end_line: u32,
end_column: u32,
},
CodeHovered {
decoration: u64,
line: u32,
column: u32,
phase: HoverPhase,
},
CodeSaveRequested {
version: u32,
},
DecorationActivated {
decoration: u64,
},
AnimationEvent {
animation_id: u32,
kind: AnimationEventKind,
property: AnimatedProperty,
slot: u8,
iteration: u32,
elapsed_ms: f32,
time_nanos: u64,
},
ReducedMotionChanged(ReducedMotion),
Pointer {Show 13 fields
kind: PointerKind,
pointer_id: u32,
pointer_type: PointerType,
x: f32,
y: f32,
buttons: u32,
button: u32,
modifiers: u32,
click_count: u32,
delta_x: f32,
delta_y: f32,
delta_mode: WheelDeltaMode,
timestamp_nanos: u64,
},
ZoomChanged {
k: f32,
os: f32,
level: i32,
},
SelectionChanged {
version: u32,
anchor_line: u32,
anchor_column: u32,
active_line: u32,
active_column: u32,
},
VisibleRangeChanged {
version: u32,
first_line: u32,
last_line: u32,
},
EditorFocusChanged {
focused: bool,
},
FoldChanged {
start_line: u32,
collapsed: bool,
},
CompositionChanged {
composing: bool,
},
}Variants§
Clicked
TextChanged(&'a str)
TextSubmitted(&'a str)
FocusLost
ProtocolError
KeyDown
RangeRequested
The Renderer asks the Host to materialise the visible item range.
ValueChanged(f64)
A control’s new value, in the widget’s own unit: an epoch count for a picker, a position for a slider, 0.0 or 1.0 for a toggle. The Renderer decided how the user reached it, so nothing about calendars, wheels, tracks or thumbs crosses here.
One f64 holds all of them: integers up to 2^53 survive it exactly, so splitting
the event in two would only give the same concept two names.
WindowSizeChanged
The window, or one observed node, moved into a different size class. The Renderer
measures it and sends this only when a class changes, never on every layout pass.
A node_id of 0 is the window; anything else is the node that asked to be
measured.
FilesEntered
Files are over a node that said it would take them. Nothing about what they are: the platforms disagree about what is knowable before a drop, and a screen that only needs to light up does not need to know.
FilesDropped(&'a str)
Files were let go over a node. The paths arrive together, separated by a byte no path on any of the three desktops may contain.
DesignSystemResolved(DesignSystem)
The Renderer resolved the theme and this is what it chose. Sent once and then only when the answer changes, the same way a size class is.
Resync
The Renderer lost its node table and asks for the whole tree again. A recreated Activity is the case that produces it.
LifecycleStart
The platform brought the UI back. Timers and animations resume.
LifecycleStop
The platform stopped the UI. Timers and animations are suppressed, so a process that is not on screen is not asked to draw.
NotificationActivated
The user pressed a notification the application posted. action is 0 for the body
and 1 or 2 for an action button; key is the name the application gave it.
A name rather than a handler, because a notification outlives the component that posted it by hours and a callback dies with its scope.
NotificationPermissionChanged(NotificationPermission)
Whether notifications may be shown, sent once after start and then only when the answer changes.
CodeChanged
One committed edit to a code editor’s document.
The range is in the document as it stood before the edit, and version is the
version the edit produced. Lines and columns count from zero and columns are UTF-16
code units, which is what a language server counts in, so the event can be handed
to one unchanged. Text still being composed by an input method never arrives here:
only what the reader committed does.
CodeEditRejected
An edit the Host asked for and the Renderer did not apply, because the reader had changed the same place since the version the edit was written against.
Fields
CodeHovered
A pointer came to rest over a place in a code editor, or left it. decoration is
the id of the hover anchor under it, or zero where there is none.
CodeSaveRequested
The reader pressed the platform’s save shortcut on a code editor.
DecorationActivated
A decoration was pressed or accepted, named by the id the application gave it.
AnimationEvent
Something happened to an animation the Renderer is playing, sent only for the kinds the animation asked for. It names the node the animation plays on and no handler.
ReducedMotionChanged(ReducedMotion)
Whether the platform asks for reduced motion, sent once after start and then only when the answer changes.
Pointer
A pointer did something inside a node that subscribed to it. Coordinates are in dp
from the node’s top left corner, buttons is what is held now and button is the
one that caused a Down or an Up. timestamp_nanos is on the frame time’s clock.
ZoomChanged
How large the Renderer is drawing: k = os × 1.2^level. Sent once at start and
again whenever any of the three changes. A move to a screen of another density
changes none of them and is not reported.
SelectionChanged
The selection of a code editor moved, or an edit moved it. version is the document
version it is read against, the same series CodeChanged counts, and an edit’s
change always arrives first. Columns are UTF-16 units and never fall between the
two halves of a pair.
VisibleRangeChanged
The lines of a code editor that are on screen changed. Folded lines are skipped, so
first_line and last_line are the first and last lines the reader can see.
EditorFocusChanged
A code editor gained or lost the keyboard focus.
FoldChanged
The reader folded or unfolded the stretch that starts on start_line.
CompositionChanged
An input method started or ended a composition in a code editor. What is being composed stays in the Renderer: only the fact crosses.