Trait EventHandlersExt

Source
pub trait EventHandlersExt: Sized + LayoutExt {
Show 30 methods // Required method fn get_event_handlers( &mut self, ) -> &mut HashMap<EventName, EventHandlerType, FxBuildHasher>; // 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§

Source

fn get_event_handlers( &mut self, ) -> &mut HashMap<EventName, EventHandlerType, FxBuildHasher>

Provided Methods§

Source

fn on_mouse_down( self, on_mouse_down: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self

Source

fn on_mouse_up( self, on_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self

Source

fn on_mouse_move( self, on_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self

Source

fn on_global_mouse_up( self, on_global_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self

Source

fn on_global_mouse_down( self, on_global_mouse_down: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self

Source

fn on_global_mouse_move( self, on_global_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self

Source

fn on_capture_global_mouse_move( self, on_capture_global_mouse_move: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self

Source

fn on_capture_global_mouse_up( self, on_capture_global_mouse_up: impl Into<EventHandler<Event<MouseEventData>>>, ) -> Self

Source

fn on_key_down( self, on_key_down: impl Into<EventHandler<Event<KeyboardEventData>>>, ) -> Self

Source

fn on_key_up( self, on_key_up: impl Into<EventHandler<Event<KeyboardEventData>>>, ) -> Self

Source

fn on_global_key_down( self, on_global_key_down: impl Into<EventHandler<Event<KeyboardEventData>>>, ) -> Self

Source

fn on_global_key_up( self, on_global_key_up: impl Into<EventHandler<Event<KeyboardEventData>>>, ) -> Self

Source

fn on_wheel( self, on_wheel: impl Into<EventHandler<Event<WheelEventData>>>, ) -> Self

Source

fn on_touch_cancel( self, on_touch_cancel: impl Into<EventHandler<Event<TouchEventData>>>, ) -> Self

Source

fn on_touch_start( self, on_touch_start: impl Into<EventHandler<Event<TouchEventData>>>, ) -> Self

Source

fn on_touch_move( self, on_touch_move: impl Into<EventHandler<Event<TouchEventData>>>, ) -> Self

Source

fn on_touch_end( self, on_touch_end: impl Into<EventHandler<Event<TouchEventData>>>, ) -> Self

Source

fn on_pointer_press( self, on_pointer_press: impl Into<EventHandler<Event<PointerEventData>>>, ) -> Self

Source

fn on_pointer_down( self, on_pointer_down: impl Into<EventHandler<Event<PointerEventData>>>, ) -> Self

Source

fn on_pointer_enter( self, on_pointer_enter: impl Into<EventHandler<Event<PointerEventData>>>, ) -> Self

Source

fn on_pointer_leave( self, on_pointer_leave: impl Into<EventHandler<Event<PointerEventData>>>, ) -> Self

Source

fn on_file_drop( self, on_file_drop: impl Into<EventHandler<Event<FileEventData>>>, ) -> Self

Source

fn on_global_file_hover( self, on_global_file_hover: impl Into<EventHandler<Event<FileEventData>>>, ) -> Self

Source

fn on_global_file_hover_cancelled( self, on_global_file_hover_cancelled: impl Into<EventHandler<Event<FileEventData>>>, ) -> Self

Source

fn on_ime_preedit( self, on_ime_preedit: impl Into<EventHandler<Event<ImePreeditEventData>>>, ) -> Self

Source

fn on_sized( self, on_sized: impl Into<EventHandler<Event<SizedEventData>>>, ) -> Self

Source

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 MouseUp event (Left button) with the in the same element that there had been a MouseDown just before
  • Touched: There is a TouchEnd event in the same element that there had been a TouchStart just before
  • Activated: The element is focused and there is a keydown event pressing the OS activation key (e.g Space, Enter)
Source

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 a MouseDown just before
Source

fn on_all_press( self, on_press: impl Into<EventHandler<Event<PressEventData>>>, ) -> Self

Gets triggered when:

  • Click: There is a MouseUp event (Any button) with the in the same element that there had been a MouseDown just before
  • Touched: There is a TouchEnd event in the same element that there had been a TouchStart just 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.

Implementations on Foreign Types§

Source§

impl EventHandlersExt for Gif

Source§

fn get_event_handlers( &mut self, ) -> &mut HashMap<EventName, EventHandlerType, FxBuildHasher>

Source§

impl EventHandlersExt for Plot

Source§

fn get_event_handlers( &mut self, ) -> &mut HashMap<EventName, EventHandlerType, FxBuildHasher>

Implementors§