Trait oxid::core::EventHandler
source · [−]pub trait EventHandler {
Show 13 methods
fn update(&mut self, _ctx: &mut Context);
fn draw(&mut self, _ctx: &mut Context);
fn resize_event(&mut self, _ctx: &mut Context, _width: f32, _height: f32) { ... }
fn mouse_motion_event(&mut self, _ctx: &mut Context, _x: f32, _y: f32) { ... }
fn mouse_wheel_event(&mut self, _ctx: &mut Context, _x: f32, _y: f32) { ... }
fn mouse_button_down_event(
&mut self,
_ctx: &mut Context,
_button: MouseButton,
_x: f32,
_y: f32
) { ... }
fn mouse_button_up_event(
&mut self,
_ctx: &mut Context,
_button: MouseButton,
_x: f32,
_y: f32
) { ... }
fn char_event(
&mut self,
_ctx: &mut Context,
_character: char,
_keymods: KeyMods,
_repeat: bool
) { ... }
fn key_down_event(
&mut self,
_ctx: &mut Context,
_keycode: KeyCode,
_keymods: KeyMods,
_repeat: bool
) { ... }
fn key_up_event(
&mut self,
_ctx: &mut Context,
_keycode: KeyCode,
_keymods: KeyMods
) { ... }
fn touch_event(
&mut self,
ctx: &mut Context,
phase: TouchPhase,
_id: u64,
x: f32,
y: f32
) { ... }
fn raw_mouse_motion(&mut self, _ctx: &mut Context, _dx: f32, _dy: f32) { ... }
fn quit_requested_event(&mut self, _ctx: &mut Context) { ... }
}
Expand description
A trait defining event callbacks.
Required Methods
Provided Methods
source
fn resize_event(&mut self, _ctx: &mut Context, _width: f32, _height: f32)
source
fn mouse_motion_event(&mut self, _ctx: &mut Context, _x: f32, _y: f32)
source
fn mouse_wheel_event(&mut self, _ctx: &mut Context, _x: f32, _y: f32)
sourcefn char_event(
fn char_event(
&mut self,
_ctx: &mut Context,
_character: char,
_keymods: KeyMods,
_repeat: bool
)
sourcefn key_down_event(
fn key_down_event(
&mut self,
_ctx: &mut Context,
_keycode: KeyCode,
_keymods: KeyMods,
_repeat: bool
)
sourcefn key_up_event(
fn key_up_event(
&mut self,
_ctx: &mut Context,
_keycode: KeyCode,
_keymods: KeyMods
)
sourcefn touch_event(
&mut self,
ctx: &mut Context,
phase: TouchPhase,
_id: u64,
x: f32,
y: f32
)
fn touch_event(
&mut self,
ctx: &mut Context,
phase: TouchPhase,
_id: u64,
x: f32,
y: f32
)
Default implementation emulates mouse clicks
sourcefn raw_mouse_motion(&mut self, _ctx: &mut Context, _dx: f32, _dy: f32)
fn raw_mouse_motion(&mut self, _ctx: &mut Context, _dx: f32, _dy: f32)
Represents raw hardware mouse motion event Note that these events are delivered regardless of input focus and not in pixels, but in hardware units instead. And those units may be different from pixels depending on the target platform
sourcefn quit_requested_event(&mut self, _ctx: &mut Context)
fn quit_requested_event(&mut self, _ctx: &mut Context)
This event is sent when the userclicks the window’s close button or application code calls the ctx.request_quit() function. The event handler callback code can handle this event by calling ctx.cancel_quit() to cancel the quit. If the event is ignored, the application will quit as usual.