Trait slint::platform::Platform

pub trait Platform {
    // Required method
    fn create_window_adapter(&self) -> Rc<dyn WindowAdapter + 'static>;

    // Provided methods
    fn run_event_loop(&self) { ... }
    fn new_event_loop_proxy(
        &self
    ) -> Option<Box<dyn EventLoopProxy + 'static, Global>> { ... }
    fn duration_since_start(&self) -> Duration { ... }
    fn set_clipboard_text(&self, _text: &str) { ... }
    fn clipboard_text(&self) -> Option<String> { ... }
    fn debug_log(&self, _arguments: Arguments<'_>) { ... }
}
Expand description

This trait defines the interface between Slint and platform APIs typically provided by operating and windowing systems.

Required Methods§

fn create_window_adapter(&self) -> Rc<dyn WindowAdapter + 'static>

Instantiate a window for a component.

Provided Methods§

fn run_event_loop(&self)

Spins an event loop and renders the visible windows.

fn new_event_loop_proxy( &self ) -> Option<Box<dyn EventLoopProxy + 'static, Global>>

Return an EventLoopProxy that can be used to send event to the event loop

If this function returns None (the default implementation), then it will not be possible to send event to the event loop and the function slint::invoke_from_event_loop() and slint::quit_event_loop() will panic

fn duration_since_start(&self) -> Duration

Returns the current time as a monotonic duration since the start of the program

This is used by the animations and timer to compute the elapsed time.

When the std feature is enabled, this function is implemented in terms of std::time::Instant::now(), but on #![no_std] platform, this function must be implemented.

fn set_clipboard_text(&self, _text: &str)

Sends the given text into the system clipboard

fn clipboard_text(&self) -> Option<String>

Returns a copy of text stored in the system clipboard, if any.

fn debug_log(&self, _arguments: Arguments<'_>)

This function is called when debug() is used in .slint files. The implementation should direct the output to some developer visible terminal. The default implementation uses stderr if available, or console.log when targeting wasm.

Implementations on Foreign Types§

§

impl Platform for Backend

§

fn create_window_adapter(&self) -> Rc<dyn WindowAdapter + 'static>

§

fn run_event_loop(&self)

§

fn new_event_loop_proxy( &self ) -> Option<Box<dyn EventLoopProxy + 'static, Global>>

§

fn set_clipboard_text(&self, text: &str)

§

fn clipboard_text(&self) -> Option<String>

§

impl Platform for Backend

§

fn create_window_adapter(&self) -> Rc<dyn WindowAdapter + 'static>

§

fn run_event_loop(&self)

Implementors§