pub enum Event {
Show 33 variants
PointerEntered {
id: WidgetId,
},
PointerExited {
id: WidgetId,
},
PointerMoved {
id: WidgetId,
position: Point,
},
PointerPressed {
id: WidgetId,
button: MouseButton,
position: Point,
count: u8,
},
PointerReleased {
id: WidgetId,
button: MouseButton,
position: Point,
count: u8,
},
Clicked {
id: WidgetId,
button: MouseButton,
count: u8,
},
Scrolled {
id: WidgetId,
delta: Point,
},
KeyPressed {
id: WidgetId,
key: Key,
modifiers: Modifiers,
repeat: bool,
},
KeyReleased {
id: WidgetId,
key: Key,
modifiers: Modifiers,
},
TextEntered {
id: WidgetId,
text: String,
},
FocusGained {
id: WidgetId,
},
FocusLost {
id: WidgetId,
},
Activated {
id: WidgetId,
},
Toggled {
id: WidgetId,
checked: bool,
},
ValueChanged {
id: WidgetId,
},
SelectionChanged {
id: WidgetId,
},
TextChanged {
id: WidgetId,
},
EditingFinished {
id: WidgetId,
},
Triggered {
id: WidgetId,
action: String,
},
ContextMenuRequested {
id: WidgetId,
position: Point,
},
PropertyChanged {
id: WidgetId,
name: String,
},
ViewportChanged {
id: WidgetId,
offset: Point,
},
Shown {
id: WidgetId,
},
Hidden {
id: WidgetId,
},
Resized {
id: WidgetId,
size: Size,
},
Moved {
id: WidgetId,
origin: Point,
},
Removed {
id: WidgetId,
},
WindowResized {
size: Size,
},
WindowFocusChanged {
focused: bool,
},
CloseRequested,
Tick {
elapsed: Duration,
},
Engine(EngineEvent),
Custom(CustomEvent),
}Expand description
An event generated by Pushrod or by a Widget.
Widgets receive these in Widget::handle_event, and
applications receive the ones Widgets emit through callbacks or
Engine::next_event. Positions are in window
coordinates.
Variants§
PointerEntered
The pointer moved onto widget id.
PointerExited
The pointer moved off widget id.
PointerMoved
The pointer moved. Sent to the capturing widget, or the one under the pointer.
PointerPressed
A mouse button went down over widget id.
Fields
The button that went down.
PointerReleased
A mouse button went up. Sent to the widget that captured the press.
Fields
The button that went up.
Clicked
Widget id was clicked.
Fields
The button used.
Scrolled
The wheel or trackpad scrolled over widget id.
Fields
KeyPressed
A key went down (or repeated) while widget id had the keyboard.
Fields
KeyReleased
A key went up while widget id had the keyboard.
Fields
TextEntered
Text was typed into widget id.
FocusGained
Widget id became the keyboard focus.
FocusLost
Widget id stopped being the keyboard focus.
Activated
Widget id was activated.
Toggled
Widget id was toggled.
ValueChanged
The value of widget id changed.
SelectionChanged
The selection of widget id changed.
TextChanged
The text of widget id changed.
EditingFinished
Editing in widget id finished.
Triggered
A named action was triggered by widget id.
ContextMenuRequested
A context menu was requested at position over widget id.
PropertyChanged
A property of widget id changed.
ViewportChanged
The visible area of scrolling widget id moved.
Shown
Widget id became visible.
Hidden
Widget id became hidden.
Resized
Widget id changed size.
Moved
Widget id changed origin.
Removed
Widget id was removed from the tree.
WindowResized
The window changed size.
WindowFocusChanged
The window gained or lost focus.
CloseRequested
The user asked to close the window.
Tick
A frame passed while a widget animates.
Engine(EngineEvent)
An action Pushrod performed internally.
Custom(CustomEvent)
An application- or library-defined event.
Implementations§
Source§impl Event
impl Event
Sourcepub fn payload<T: Any>(&self) -> Option<&T>
pub fn payload<T: Any>(&self) -> Option<&T>
Reads the payload of a custom event as a T.
§Returns
The payload, or None if this is not Event::Custom or the payload is not a T.
Sourcepub fn widget_id(&self) -> Option<WidgetId>
pub fn widget_id(&self) -> Option<WidgetId>
The widget a widget-addressed event is for.
§Returns
The WidgetId, or None for window-level, engine, custom and raw events.