Trait slint::platform::WindowAdapter
pub trait WindowAdapter {
// Required methods
fn window(&self) -> &Window;
fn size(&self) -> PhysicalSize;
// Provided methods
fn position(&self) -> Option<PhysicalPosition> { ... }
fn set_position(&self, _position: WindowPosition) { ... }
fn set_size(&self, _size: WindowSize) { ... }
fn request_redraw(&self) { ... }
}
Expand description
This trait represents the adaptation layer between the Window
API, and the
internal type from the backend that provides functionality such as device-independent pixels,
window resizing, and other typically windowing system related tasks.
You are not expected to implement this trait
yourself, but you should use the provided window adapter. Use
MinimalSoftwareWindow
when
implementing your own platform
.
Required Methods§
fn size(&self) -> PhysicalSize
fn size(&self) -> PhysicalSize
Return the size of the Window on the screen
Provided Methods§
fn position(&self) -> Option<PhysicalPosition>
fn position(&self) -> Option<PhysicalPosition>
Returns the position of the window on the screen, in physical screen coordinates and including a window frame (if present).
The default implementation returns None
Called from Window::position()
fn set_position(&self, _position: WindowPosition)
fn set_position(&self, _position: WindowPosition)
Sets the position of the window on the screen, in physical screen coordinates and including a window frame (if present).
The default implementation does nothing
Called from Window::set_position()
fn set_size(&self, _size: WindowSize)
fn set_size(&self, _size: WindowSize)
Request a new size for the window to the specified size on the screen, in physical or logical pixels and excluding a window frame (if present).
This is called from Window::set_size()
The default implementation does nothing
This function should sent the size to the Windowing system. If the window size actually changes, you
should dispatch a WindowEvent::Resized
using
Window::dispatch_event()
to propagate the new size to the slint view
fn request_redraw(&self)
fn request_redraw(&self)
Issues a request to the windowing system to re-render the contents of the window.
This request is typically asynchronous. It is called when a property that was used during window rendering is marked as dirty.
An implementation should repaint the window in a subsequent iteration of the event loop, throttled to the screen refresh rate if possible. It is important not to query any Slint properties to avoid introducing a dependency loop in the properties, including the use of the render function, which itself queries properties.
See also Window::request_redraw()