Trait speedy2d::window::WindowHandler[][src]

pub trait WindowHandler<UserEventType = ()> {
    fn on_start(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        info: WindowStartupInfo
    ) { ... }
fn on_user_event(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        user_event: UserEventType
    ) { ... }
fn on_resize(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        size_pixels: Vector2<u32>
    ) { ... }
fn on_scale_factor_changed(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        scale_factor: f64
    ) { ... }
fn on_draw(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        graphics: &mut Graphics2D
    ) { ... }
fn on_mouse_move(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        position: Vector2<f32>
    ) { ... }
fn on_mouse_button_down(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        button: MouseButton
    ) { ... }
fn on_mouse_button_up(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        button: MouseButton
    ) { ... }
fn on_key_down(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        virtual_key_code: Option<VirtualKeyCode>,
        scancode: KeyScancode
    ) { ... }
fn on_key_up(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        virtual_key_code: Option<VirtualKeyCode>,
        scancode: KeyScancode
    ) { ... }
fn on_keyboard_char(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        unicode_codepoint: char
    ) { ... }
fn on_keyboard_modifiers_changed(
        &mut self,
        helper: &mut WindowHelper<UserEventType>,
        state: ModifiersState
    ) { ... } }
Expand description

A set of callbacks for an active window. If a callback is not implemented, it will do nothing by default, so it is only necessary to implement the callbacks you actually need.

Provided methods

Invoked once when the window first starts.

Invoked when a user-defined event is received, allowing you to wake up the event loop to handle events from other threads.

See WindowHelper::create_user_event_sender.

Invoked when the window is resized.

Invoked when the window scale factor changes.

Invoked when the contents of the window needs to be redrawn.

It is possible to request a redraw from any callback using WindowHelper::request_redraw.

Invoked when the mouse changes position.

Invoked when a mouse button is pressed.

Invoked when a mouse button is released.

Invoked when a keyboard key is pressed.

To detect when a character is typed, see the WindowHandler::on_keyboard_char callback.

Invoked when a keyboard key is released.

Invoked when a character is typed on the keyboard.

This is invoked in addition to the WindowHandler::on_key_up and WindowHandler::on_key_down callbacks.

Invoked when the state of the modifier keys has changed.

Implementors