pub trait EventHandlersExt: Sized + LayoutExt {
Show 30 methods
// Required method
fn get_event_handlers(
&mut self,
) -> &mut FxHashMap<EventName, EventHandlerType>;
// Provided methods
fn on_mouse_down(
self,
on_mouse_down: impl Into<EventHandler<Event<MouseEventData>>>,
) -> Self { ... }
fn on_mouse_up(
self,
on_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>,
) -> Self { ... }
fn on_mouse_move(
self,
on_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>,
) -> Self { ... }
fn on_global_mouse_up(
self,
on_global_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>,
) -> Self { ... }
fn on_global_mouse_down(
self,
on_global_mouse_down: impl Into<EventHandler<Event<MouseEventData>>>,
) -> Self { ... }
fn on_global_mouse_move(
self,
on_global_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>,
) -> Self { ... }
fn on_capture_global_mouse_move(
self,
on_capture_global_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>,
) -> Self { ... }
fn on_capture_global_mouse_up(
self,
on_capture_global_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>,
) -> Self { ... }
fn on_key_down(
self,
on_key_down: impl Into<EventHandler<Event<KeyboardEventData>>>,
) -> Self { ... }
fn on_key_up(
self,
on_key_up: impl Into<EventHandler<Event<KeyboardEventData>>>,
) -> Self { ... }
fn on_global_key_down(
self,
on_global_key_down: impl Into<EventHandler<Event<KeyboardEventData>>>,
) -> Self { ... }
fn on_global_key_up(
self,
on_global_key_up: impl Into<EventHandler<Event<KeyboardEventData>>>,
) -> Self { ... }
fn on_wheel(
self,
on_wheel: impl Into<EventHandler<Event<WheelEventData>>>,
) -> Self { ... }
fn on_touch_cancel(
self,
on_touch_cancel: impl Into<EventHandler<Event<TouchEventData>>>,
) -> Self { ... }
fn on_touch_start(
self,
on_touch_start: impl Into<EventHandler<Event<TouchEventData>>>,
) -> Self { ... }
fn on_touch_move(
self,
on_touch_move: impl Into<EventHandler<Event<TouchEventData>>>,
) -> Self { ... }
fn on_touch_end(
self,
on_touch_end: impl Into<EventHandler<Event<TouchEventData>>>,
) -> Self { ... }
fn on_pointer_press(
self,
on_pointer_press: impl Into<EventHandler<Event<PointerEventData>>>,
) -> Self { ... }
fn on_pointer_down(
self,
on_pointer_down: impl Into<EventHandler<Event<PointerEventData>>>,
) -> Self { ... }
fn on_pointer_enter(
self,
on_pointer_enter: impl Into<EventHandler<Event<PointerEventData>>>,
) -> Self { ... }
fn on_pointer_leave(
self,
on_pointer_leave: impl Into<EventHandler<Event<PointerEventData>>>,
) -> Self { ... }
fn on_file_drop(
self,
on_file_drop: impl Into<EventHandler<Event<FileEventData>>>,
) -> Self { ... }
fn on_global_file_hover(
self,
on_global_file_hover: impl Into<EventHandler<Event<FileEventData>>>,
) -> Self { ... }
fn on_global_file_hover_cancelled(
self,
on_global_file_hover_cancelled: impl Into<EventHandler<Event<FileEventData>>>,
) -> Self { ... }
fn on_ime_preedit(
self,
on_ime_preedit: impl Into<EventHandler<Event<ImePreeditEventData>>>,
) -> Self { ... }
fn on_sized(
self,
on_sized: impl Into<EventHandler<Event<SizedEventData>>>,
) -> Self { ... }
fn on_press(
self,
on_press: impl Into<EventHandler<Event<PressEventData>>>,
) -> Self { ... }
fn on_secondary_press(
self,
on_pointer_press: impl Into<EventHandler<Event<PressEventData>>>,
) -> Self { ... }
fn on_all_press(
self,
on_press: impl Into<EventHandler<Event<PressEventData>>>,
) -> Self { ... }
}Required Methods§
fn get_event_handlers(&mut self) -> &mut FxHashMap<EventName, EventHandlerType>
Provided Methods§
fn on_mouse_down( self, on_mouse_down: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self
fn on_mouse_up( self, on_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self
fn on_mouse_move( self, on_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self
fn on_global_mouse_up( self, on_global_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self
fn on_global_mouse_down( self, on_global_mouse_down: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self
fn on_global_mouse_move( self, on_global_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self
fn on_capture_global_mouse_move( self, on_capture_global_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self
fn on_capture_global_mouse_up( self, on_capture_global_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self
fn on_key_down( self, on_key_down: impl Into<EventHandler<Event<KeyboardEventData>>>, ) -> Self
fn on_key_up( self, on_key_up: impl Into<EventHandler<Event<KeyboardEventData>>>, ) -> Self
fn on_global_key_down( self, on_global_key_down: impl Into<EventHandler<Event<KeyboardEventData>>>, ) -> Self
fn on_global_key_up( self, on_global_key_up: impl Into<EventHandler<Event<KeyboardEventData>>>, ) -> Self
fn on_wheel( self, on_wheel: impl Into<EventHandler<Event<WheelEventData>>>, ) -> Self
fn on_touch_cancel( self, on_touch_cancel: impl Into<EventHandler<Event<TouchEventData>>>, ) -> Self
fn on_touch_start( self, on_touch_start: impl Into<EventHandler<Event<TouchEventData>>>, ) -> Self
fn on_touch_move( self, on_touch_move: impl Into<EventHandler<Event<TouchEventData>>>, ) -> Self
fn on_touch_end( self, on_touch_end: impl Into<EventHandler<Event<TouchEventData>>>, ) -> Self
fn on_pointer_press( self, on_pointer_press: impl Into<EventHandler<Event<PointerEventData>>>, ) -> Self
fn on_pointer_down( self, on_pointer_down: impl Into<EventHandler<Event<PointerEventData>>>, ) -> Self
fn on_pointer_enter( self, on_pointer_enter: impl Into<EventHandler<Event<PointerEventData>>>, ) -> Self
fn on_pointer_leave( self, on_pointer_leave: impl Into<EventHandler<Event<PointerEventData>>>, ) -> Self
fn on_file_drop( self, on_file_drop: impl Into<EventHandler<Event<FileEventData>>>, ) -> Self
fn on_global_file_hover( self, on_global_file_hover: impl Into<EventHandler<Event<FileEventData>>>, ) -> Self
fn on_global_file_hover_cancelled( self, on_global_file_hover_cancelled: impl Into<EventHandler<Event<FileEventData>>>, ) -> Self
fn on_ime_preedit( self, on_ime_preedit: impl Into<EventHandler<Event<ImePreeditEventData>>>, ) -> Self
fn on_sized( self, on_sized: impl Into<EventHandler<Event<SizedEventData>>>, ) -> Self
Sourcefn on_press(
self,
on_press: impl Into<EventHandler<Event<PressEventData>>>,
) -> Self
fn on_press( self, on_press: impl Into<EventHandler<Event<PressEventData>>>, ) -> Self
This is generally the best event in which to run “press” logic, this might be called onClick, onActivate, or onConnect in other platforms.
Gets triggered when:
- Click: There is a
MouseUpevent (Left button) with the in the same element that there had been aMouseDownjust before - Touched: There is a
TouchEndevent in the same element that there had been aTouchStartjust before - Activated: The element is focused and there is a keydown event pressing the OS activation key (e.g Space, Enter)
Sourcefn on_secondary_press(
self,
on_pointer_press: impl Into<EventHandler<Event<PressEventData>>>,
) -> Self
fn on_secondary_press( self, on_pointer_press: impl Into<EventHandler<Event<PressEventData>>>, ) -> Self
Also called the context menu click in other platforms. Gets triggered when:
- Click: There is a
MouseUp(Right button) event in the same element that there had been aMouseDownjust before
Sourcefn on_all_press(
self,
on_press: impl Into<EventHandler<Event<PressEventData>>>,
) -> Self
fn on_all_press( self, on_press: impl Into<EventHandler<Event<PressEventData>>>, ) -> Self
Gets triggered when:
- Click: There is a
MouseUpevent (Any button) with the in the same element that there had been aMouseDownjust before - Touched: There is a
TouchEndevent in the same element that there had been aTouchStartjust before - Activated: The element is focused and there is a keydown event pressing the OS activation key (e.g Space, Enter)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.