Trait xplm::window::WindowDelegate

source ·
pub trait WindowDelegate: 'static {
    // Required method
    fn draw(&mut self, window: &Window);

    // Provided methods
    fn keyboard_event(&mut self, _window: &Window, _event: KeyEvent) { ... }
    fn mouse_event(&mut self, _window: &Window, _event: MouseEvent) -> bool { ... }
    fn scroll_event(&mut self, _window: &Window, _event: ScrollEvent) -> bool { ... }
    fn cursor(&mut self, _window: &Window, _position: Point<i32>) -> Cursor { ... }
}
Expand description

Trait for things that can define the behavior of a window

Required Methods§

source

fn draw(&mut self, window: &Window)

Draws this window

Provided Methods§

source

fn keyboard_event(&mut self, _window: &Window, _event: KeyEvent)

Handles a keyboard event

The default implementation does nothing

source

fn mouse_event(&mut self, _window: &Window, _event: MouseEvent) -> bool

Handles a mouse event

Return false to consume the event or true to propagate it.

The default implementation does nothing and allows the event to propagate.

source

fn scroll_event(&mut self, _window: &Window, _event: ScrollEvent) -> bool

Handles a scroll event

Return false to consume the event or true to propagate it.

The default implementation does nothing and allows the event to propagate.

source

fn cursor(&mut self, _window: &Window, _position: Point<i32>) -> Cursor

Tells X-Plane what cursor to draw over a section of the window

The default implementation allows X-Plane to draw the default cursor.

Implementors§