i_slint_backend_winit

Trait WinitWindowAccessor

Source
pub trait WinitWindowAccessor: WinitWindowAccessorSealed {
    // Required methods
    fn has_winit_window(&self) -> bool;
    fn with_winit_window<T>(
        &self,
        callback: impl FnOnce(&Window) -> T,
    ) -> Option<T>;
    fn on_winit_window_event(
        &self,
        callback: impl FnMut(&Window, &WindowEvent) -> WinitWindowEventResult + 'static,
    );
}
Expand description

This helper trait can be used to obtain access to the winit::window::Window for a given slint::Window.“)]

Required Methods§

Source

fn has_winit_window(&self) -> bool

Returns true if a winit::window::Window exists for this window. This is the case if the window is backed by this winit backend.

Source

fn with_winit_window<T>(&self, callback: impl FnOnce(&Window) -> T) -> Option<T>

Invokes the specified callback with a reference to the winit::window::Window that exists for this Slint window and returns Some(T); otherwise None.

Source

fn on_winit_window_event( &self, callback: impl FnMut(&Window, &WindowEvent) -> WinitWindowEventResult + 'static, )

Registers a window event filter callback for this Slint window.

The callback is invoked in the winit event loop whenever a window event is received with a reference to the slint::Window and the winit::event::WindowEvent. The return value of the callback specifies whether Slint should handle this event.

If this window is not backed by winit, this function is a no-op.

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 WinitWindowAccessor for Window

Source§

fn has_winit_window(&self) -> bool

Source§

fn with_winit_window<T>(&self, callback: impl FnOnce(&Window) -> T) -> Option<T>

Source§

fn on_winit_window_event( &self, callback: impl FnMut(&Window, &WindowEvent) -> WinitWindowEventResult + 'static, )

Implementors§