pub struct OutgoingEvent {
pub message_type: &'static str,
pub session: String,
pub family: String,
pub id: String,
pub value: Option<Value>,
pub tag: Option<String>,
pub modifiers: Option<KeyModifiers>,
pub data: Option<Value>,
pub captured: Option<bool>,
}Expand description
An event written to stdout by the renderer.
All events share a flat struct with optional fields. There are two constructor patterns:
- Widget events (click, input, toggle, etc.) use
idto identify the source widget. Built viabare. - Subscription events (key_press, cursor_moved, window_opened,
etc.) use
tagto identify the subscription that requested them. Built viatagged. Theidfield is empty.
Extension authors emit custom events via
extension_event.
Fields§
§message_type: &'static strAlways "event".
session: StringSession that produced this event.
family: StringEvent type (e.g. "click", "key_press", "window_opened").
id: StringSource widget node ID (widget events) or empty (subscription events).
value: Option<Value>Primary value payload (e.g. input text, slider value, selected option).
tag: Option<String>Subscription tag identifying which subscription requested this event.
modifiers: Option<KeyModifiers>Keyboard modifier state at the time of the event.
data: Option<Value>Flexible extra data for events that carry additional fields beyond the standard id/value/tag/modifiers shape.
captured: Option<bool>Whether the event was captured (consumed) by an iced widget before reaching the subscription listener. Present on keyboard, mouse, touch, and IME events; absent on widget-level events.
Implementations§
Source§impl OutgoingEvent
impl OutgoingEvent
Sourcepub fn with_captured(self, captured: bool) -> Self
pub fn with_captured(self, captured: bool) -> Self
Mark the event with its capture status.
Sourcepub fn with_session(self, session: impl Into<String>) -> Self
pub fn with_session(self, session: impl Into<String>) -> Self
Set the session ID for this event.
Source§impl OutgoingEvent
impl OutgoingEvent
Sourcepub fn generic(
family: impl Into<String>,
id: String,
data: Option<Value>,
) -> Self
pub fn generic( family: impl Into<String>, id: String, data: Option<Value>, ) -> Self
Generic widget event with a family string and optional data payload. Used for on_open, on_close, sort, and other events.
Sourcepub fn extension_event(family: String, id: String, data: Option<Value>) -> Self
pub fn extension_event(family: String, id: String, data: Option<Value>) -> Self
Convenience constructor for extension-emitted events.
pub fn click(id: String) -> Self
pub fn input(id: String, value: String) -> Self
pub fn submit(id: String, value: String) -> Self
pub fn toggle(id: String, checked: bool) -> Self
pub fn slide(id: String, value: f64) -> Self
pub fn slide_release(id: String, value: f64) -> Self
pub fn select(id: String, value: String) -> Self
pub fn key_press(tag: String, data: &KeyEventData) -> Self
pub fn key_release(tag: String, data: &KeyEventData) -> Self
pub fn modifiers_changed(tag: String, modifiers: KeyModifiers) -> Self
pub fn cursor_moved(tag: String, x: f32, y: f32) -> Self
pub fn cursor_entered(tag: String) -> Self
pub fn cursor_left(tag: String) -> Self
pub fn wheel_scrolled( tag: String, delta_x: f32, delta_y: f32, unit: &str, ) -> Self
pub fn finger_pressed(tag: String, finger_id: u64, x: f32, y: f32) -> Self
pub fn finger_moved(tag: String, finger_id: u64, x: f32, y: f32) -> Self
pub fn finger_lifted(tag: String, finger_id: u64, x: f32, y: f32) -> Self
pub fn finger_lost(tag: String, finger_id: u64, x: f32, y: f32) -> Self
pub fn ime_opened(tag: String) -> Self
pub fn ime_preedit( tag: String, text: String, cursor: Option<Range<usize>>, ) -> Self
pub fn ime_commit(tag: String, text: String) -> Self
pub fn ime_closed(tag: String) -> Self
pub fn window_opened( tag: String, window_id: String, position: Option<(f32, f32)>, width: f32, height: f32, scale_factor: f32, ) -> Self
pub fn window_closed(tag: String, window_id: String) -> Self
pub fn window_close_requested(tag: String, window_id: String) -> Self
pub fn window_moved(tag: String, window_id: String, x: f32, y: f32) -> Self
pub fn window_resized( tag: String, window_id: String, width: f32, height: f32, ) -> Self
pub fn window_focused(tag: String, window_id: String) -> Self
pub fn window_unfocused(tag: String, window_id: String) -> Self
pub fn window_rescaled( tag: String, window_id: String, scale_factor: f32, ) -> Self
pub fn file_hovered(tag: String, window_id: String, path: String) -> Self
pub fn file_dropped(tag: String, window_id: String, path: String) -> Self
pub fn files_hovered_left(tag: String, window_id: String) -> Self
pub fn animation_frame(tag: String, timestamp_millis: u128) -> Self
pub fn theme_changed(tag: String, mode: String) -> Self
pub fn sensor_resize(id: String, width: f32, height: f32) -> Self
pub fn canvas_press(id: String, x: f32, y: f32, button: String) -> Self
pub fn canvas_release(id: String, x: f32, y: f32, button: String) -> Self
pub fn canvas_move(id: String, x: f32, y: f32) -> Self
pub fn canvas_scroll( id: String, x: f32, y: f32, delta_x: f32, delta_y: f32, ) -> Self
pub fn mouse_right_press(id: String) -> Self
pub fn mouse_right_release(id: String) -> Self
pub fn mouse_middle_press(id: String) -> Self
pub fn mouse_middle_release(id: String) -> Self
pub fn mouse_double_click(id: String) -> Self
pub fn mouse_enter(id: String) -> Self
pub fn mouse_exit(id: String) -> Self
pub fn mouse_area_move(id: String, x: f32, y: f32) -> Self
pub fn mouse_area_scroll(id: String, delta_x: f32, delta_y: f32) -> Self
pub fn pane_resized(id: String, split: String, ratio: f32) -> Self
pub fn pane_dragged( id: String, kind: &str, pane: String, target: Option<String>, region: Option<&str>, edge: Option<&str>, ) -> Self
pub fn pane_clicked(id: String, pane: String) -> Self
pub fn pane_focus_cycle(id: String, pane: String) -> Self
pub fn paste(id: String, text: String) -> Self
Sourcepub fn scripting_key_press(key: String, modifiers_json: Value) -> Self
pub fn scripting_key_press(key: String, modifiers_json: Value) -> Self
Key press event from scripting (no full KeyEventData).
Sourcepub fn scripting_key_release(key: String, modifiers_json: Value) -> Self
pub fn scripting_key_release(key: String, modifiers_json: Value) -> Self
Key release event from scripting (no full KeyEventData).
Sourcepub fn scripting_cursor_moved(x: f64, y: f64) -> Self
pub fn scripting_cursor_moved(x: f64, y: f64) -> Self
Cursor moved event from scripting.
Sourcepub fn scripting_scroll(delta_x: f64, delta_y: f64) -> Self
pub fn scripting_scroll(delta_x: f64, delta_y: f64) -> Self
Scroll event from scripting.
pub fn option_hovered(id: String, value: String) -> Self
pub fn scroll( id: String, abs_x: f32, abs_y: f32, rel_x: f32, rel_y: f32, bounds_w: f32, bounds_h: f32, content_w: f32, content_h: f32, ) -> Self
Trait Implementations§
Source§impl Debug for OutgoingEvent
impl Debug for OutgoingEvent
Auto Trait Implementations§
impl Freeze for OutgoingEvent
impl RefUnwindSafe for OutgoingEvent
impl Send for OutgoingEvent
impl Sync for OutgoingEvent
impl Unpin for OutgoingEvent
impl UnsafeUnpin for OutgoingEvent
impl UnwindSafe for OutgoingEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more