CustomApplicationHandler

Trait CustomApplicationHandler 

pub trait CustomApplicationHandler {
    // Provided methods
    fn resumed(&mut self, _event_loop: &ActiveEventLoop) -> EventResult { ... }
    fn window_event(
        &mut self,
        event_loop: &ActiveEventLoop,
        window_id: WindowId,
        winit_window: Option<&Window>,
        slint_window: Option<&Window>,
        event: &WindowEvent,
    ) -> EventResult { ... }
    fn new_events(
        &mut self,
        event_loop: &ActiveEventLoop,
        cause: StartCause,
    ) -> EventResult { ... }
    fn device_event(
        &mut self,
        event_loop: &ActiveEventLoop,
        device_id: DeviceId,
        event: DeviceEvent,
    ) -> EventResult { ... }
    fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) -> EventResult { ... }
    fn suspended(&mut self, event_loop: &ActiveEventLoop) -> EventResult { ... }
    fn exiting(&mut self, event_loop: &ActiveEventLoop) -> EventResult { ... }
    fn memory_warning(&mut self, event_loop: &ActiveEventLoop) -> EventResult { ... }
}
Available on crate feature unstable-winit-030 only.
Expand description

Use this trait to intercept events from winit.

It imitates winit::application::ApplicationHandler with two changes:

  • All functions are invoked before Slint sees them. Use the EventResult return value to optionally prevent Slint from seeing the event.
  • The Self::window_event() function has additional parameters to provide access to the Slint Window and Winit window, if applicable.

Provided Methods§

fn resumed(&mut self, _event_loop: &ActiveEventLoop) -> EventResult

Re-implement to intercept the ApplicationHandler::resumed() event.

fn window_event( &mut self, event_loop: &ActiveEventLoop, window_id: WindowId, winit_window: Option<&Window>, slint_window: Option<&Window>, event: &WindowEvent, ) -> EventResult

Re-implement to intercept the ApplicationHandler::window_event() event.

fn new_events( &mut self, event_loop: &ActiveEventLoop, cause: StartCause, ) -> EventResult

Re-implement to intercept the ApplicationHandler::new_events() event.

fn device_event( &mut self, event_loop: &ActiveEventLoop, device_id: DeviceId, event: DeviceEvent, ) -> EventResult

Re-implement to intercept the ApplicationHandler::device_event() event.

fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) -> EventResult

Re-implement to intercept the ApplicationHandler::about_to_wait() event.

fn suspended(&mut self, event_loop: &ActiveEventLoop) -> EventResult

Re-implement to intercept the ApplicationHandler::suspended() event.

fn exiting(&mut self, event_loop: &ActiveEventLoop) -> EventResult

Re-implement to intercept the ApplicationHandler::exiting() event.

fn memory_warning(&mut self, event_loop: &ActiveEventLoop) -> EventResult

Re-implement to intercept the ApplicationHandler::memory_warning() event.

Implementors§