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ยง
fn create_window_adapter(&self) -> Rc<dyn WindowAdapter + 'static>
fn create_window_adapter(&self) -> Rc<dyn WindowAdapter + 'static>
Instantiate a window for a component.
Provided Methodsยง
fn run_event_loop(&self)
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>>
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
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)
fn set_clipboard_text(&self, _text: &str)
Sends the given text into the system clipboard
fn clipboard_text(&self) -> Option<String>
fn clipboard_text(&self) -> Option<String>
Returns a copy of text stored in the system clipboard, if any.