Trait sixtyfps_corelib::window::PlatformWindow[][src]

pub trait PlatformWindow {
    fn show(self: Rc<Self>);
fn hide(self: Rc<Self>);
fn request_redraw(&self);
fn free_graphics_resources<'a>(&self, items: &Slice<'a, 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 text_size(
        &self,
        font_request: FontRequest,
        text: &str,
        max_width: Option<f32>
    ) -> Size;
fn text_input_byte_offset_for_position(
        &self,
        text_input: Pin<&TextInput>,
        pos: Point
    ) -> usize;
fn text_input_position_for_byte_offset(
        &self,
        text_input: Pin<&TextInput>,
        byte_offset: usize
    ) -> Point;
fn as_any(&self) -> &dyn Any; }
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

Registers the window with the windowing system.

De-registers the window from the windowing system.

Issue a request to the windowing system to re-render the contents of the window. This is typically an asynchronous request.

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.

Show a popup at the given position

Request for the event loop to wake up and call Window::update_window_properties().

Request for the given title string to be set to the windowing system for use as window title.

Apply the given horizontal and vertical constraints to the window. This typically involves communication minimum/maximum sizes to the windowing system, for example.

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 its position

Return self as any so the backend can upcast

Implementors