pub trait Platform {
    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 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

Instantiate a window for a component.

Provided Methods

Spins an event loop and renders the visible windows.

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

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.

Sends the given text into the system clipboard

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

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

Implementors