Struct i_slint_backend_winit::Backend
source · pub struct Backend {
pub window_attributes_hook: Option<Box<dyn Fn(WindowAttributes) -> WindowAttributes>>,
/* private fields */
}
Expand description
This struct implements the Slint Platform trait. Use this in conjunction with slint::platform::set_platform
to initialize.
Slint to use winit for all windowing system interaction.
use i_slint_backend_winit::Backend;
slint::platform::set_platform(Box::new(Backend::new().unwrap()));
Fields§
§window_attributes_hook: Option<Box<dyn Fn(WindowAttributes) -> WindowAttributes>>
This hook is called before a Window is created.
It can be used to adjust settings of window that will be created
See also BackendBuilder::with_window_attributes_hook
.
§Example
let mut backend = i_slint_backend_winit::Backend::new().unwrap();
backend.window_attributes_hook = Some(Box::new(|attributes| attributes.with_content_protected(true)));
slint::platform::set_platform(Box::new(backend));
Implementations§
source§impl Backend
impl Backend
sourcepub fn new() -> Result<Self, PlatformError>
pub fn new() -> Result<Self, PlatformError>
Creates a new winit backend with the default renderer that’s compiled in. See the backend documentation for details on how to select the default renderer.
sourcepub fn new_with_renderer_by_name(
renderer_name: Option<&str>,
) -> Result<Self, PlatformError>
pub fn new_with_renderer_by_name( renderer_name: Option<&str>, ) -> Result<Self, PlatformError>
Creates a new winit backend with the renderer specified by name. See the backend documentation for
details on how to select the default renderer.
If the renderer name is None
or the name is not recognized, the default renderer is selected.
sourcepub fn builder() -> BackendBuilder
pub fn builder() -> BackendBuilder
Creates a new BackendBuilder for configuring aspects of the Winit backend before setting it as the platform backend.
Trait Implementations§
source§impl Platform for Backend
impl Platform for Backend
source§fn create_window_adapter(&self) -> Result<Rc<dyn WindowAdapter>, PlatformError>
fn create_window_adapter(&self) -> Result<Rc<dyn WindowAdapter>, PlatformError>
source§fn run_event_loop(&self) -> Result<(), PlatformError>
fn run_event_loop(&self) -> Result<(), PlatformError>
source§fn new_event_loop_proxy(&self) -> Option<Box<dyn EventLoopProxy>>
fn new_event_loop_proxy(&self) -> Option<Box<dyn EventLoopProxy>>
EventLoopProxy
that can be used to send event to the event loop Read more