Trait i_slint_core::window::PlatformWindow
source · [−]pub trait PlatformWindow {
Show 19 methods
fn show(self: Rc<Self>);
fn hide(self: Rc<Self>);
fn request_redraw(&self);
fn register_component(&self);
fn unregister_component<'a>(
&self,
component: ComponentRef<'_>,
items: &mut dyn Iterator<Item = Pin<ItemRef<'a>>>
);
fn show_popup(&self, popup: &ComponentRc, position: Point);
fn request_window_properties_update(&self);
fn apply_window_properties(&self, window_item: Pin<&WindowItem>);
fn apply_geometry_constraint(
&self,
constraints_horizontal: LayoutInfo,
constraints_vertical: LayoutInfo
);
fn set_mouse_cursor(&self, cursor: MouseCursor);
fn text_size(
&self,
font_request: FontRequest,
text: &str,
max_width: Option<Coord>
) -> Size;
fn text_input_byte_offset_for_position(
&self,
text_input: Pin<&TextInput>,
pos: Point
) -> usize;
fn text_input_cursor_rect_for_byte_offset(
&self,
text_input: Pin<&TextInput>,
byte_offset: usize
) -> Rect;
fn as_any(&self) -> &dyn Any;
fn set_rendering_notifier(
&self,
_callback: Box<dyn RenderingNotifier>
) -> Result<(), SetRenderingNotifierError> { ... }
fn close_popup(&self, _popup: &PopupWindow) { ... }
fn show_virtual_keyboard(&self, _: InputType) { ... }
fn hide_virtual_keyboard(&self) { ... }
fn handle_focus_change(&self, _old: Option<ItemRc>, _new: Option<ItemRc>) { ... }
}
Expand description
This trait represents the interface that the generated code and the run-time require in order to implement functionality such as device-independent pixels, window resizing and other typically windowing system related tasks.
Required Methods
fn request_redraw(&self)
fn request_redraw(&self)
Issue a request to the windowing system to re-render the contents of the window. This is typically an asynchronous request.
fn register_component(&self)
fn register_component(&self)
This function is called by the generated code when a component and therefore its tree of items are created.
fn unregister_component<'a>(
&self,
component: ComponentRef<'_>,
items: &mut dyn Iterator<Item = Pin<ItemRef<'a>>>
)
fn unregister_component<'a>(
&self,
component: ComponentRef<'_>,
items: &mut dyn Iterator<Item = Pin<ItemRef<'a>>>
)
This function is called by the generated code when a component and therefore its tree of items are destroyed. The
implementation typically uses this to free the underlying graphics resources cached via crate::graphics::RenderingCache
.
fn show_popup(&self, popup: &ComponentRc, position: Point)
fn show_popup(&self, popup: &ComponentRc, position: Point)
Show a popup at the given position
fn request_window_properties_update(&self)
fn request_window_properties_update(&self)
Request for the event loop to wake up and call Window::update_window_properties()
.
fn apply_window_properties(&self, window_item: Pin<&WindowItem>)
fn apply_window_properties(&self, window_item: Pin<&WindowItem>)
Request for the given title string to be set to the windowing system for use as window title.
fn apply_geometry_constraint(
&self,
constraints_horizontal: LayoutInfo,
constraints_vertical: LayoutInfo
)
fn apply_geometry_constraint(
&self,
constraints_horizontal: LayoutInfo,
constraints_vertical: LayoutInfo
)
Apply the given horizontal and vertical constraints to the window. This typically involves communication minimum/maximum sizes to the windowing system, for example.
fn set_mouse_cursor(&self, cursor: MouseCursor)
fn set_mouse_cursor(&self, cursor: MouseCursor)
Set the mouse cursor
Returns the size of the given text in logical pixels.
When set, max_width
means that one need to wrap the text so it does not go further than that
Returns the (UTF-8) byte offset in the text property that refers to the character that contributed to the glyph cluster that’s visually nearest to the given coordinate. This is used for hit-testing, for example when receiving a mouse click into a text field. Then this function returns the “cursor” position.
That’s the opposite of Self::text_input_byte_offset_for_position
It takes a (UTF-8) byte offset in the text property, and returns a Rectangle
left to the char. It is one logical pixel wide and ends at the baseline.
Provided Methods
fn set_rendering_notifier(
&self,
_callback: Box<dyn RenderingNotifier>
) -> Result<(), SetRenderingNotifierError>
fn set_rendering_notifier(
&self,
_callback: Box<dyn RenderingNotifier>
) -> Result<(), SetRenderingNotifierError>
This function is called through the public API to register a callback that the backend needs to invoke during different phases of rendering.
fn close_popup(&self, _popup: &PopupWindow)
fn close_popup(&self, _popup: &PopupWindow)
Notify the platform window about the closure of a previously opened popup.
fn show_virtual_keyboard(&self, _: InputType)
fn show_virtual_keyboard(&self, _: InputType)
This is called when the virtual keyboard should be shown because a widget that uses input has the focus.
fn hide_virtual_keyboard(&self)
fn hide_virtual_keyboard(&self)
This is called when the widget that needed the keyboard loses focus