logo
pub struct Window { /* private fields */ }
Expand description

Structure that represent a Window in the runtime

Implementations

Create a new instance of the window, given the platform_window factory fn

Associates this window with the specified component. Further event handling and rendering, etc. will be done with that component.

return the component. Panics if it wasn’t set.

returns the component or None if it isn’t set.

Receive a mouse event and pass it to the items of the component to change their state.

Arguments:

  • pos: The position of the mouse event in window physical coordinates.
  • what: The type of mouse event.
  • component: The Slint compiled component that provides the tree of items.

Receive a key event and pass it to the items of the component to change their state.

Arguments:

  • event: The key event received by the windowing system.
  • component: The Slint compiled component that provides the tree of items.

Installs a binding on the specified property that’s toggled whenever the text cursor is supposed to be visible or not.

Sets the focus to the item pointed to by item_ptr. This will remove the focus from any currently focused item.

Sets the focus on the window to true or false, depending on the have_focus argument. This results in WindowFocusReceived and WindowFocusLost events.

Move keyboard focus to the next item

Move keyboard focus to the previous item.

Marks the window to be the active window. This typically coincides with the keyboard focus. One exception though is when a popup is shown, in which case the window may remain active but temporarily loose focus to the popup.

Returns true of the window is the active window. That typically implies having the keyboard focus, except when a popup is shown and temporarily takes the focus.

If the component’s root item is a Window element, then this function synchronizes its properties, such as the title for example, with the properties known to the windowing system.

Calls the render_components to render the main component and any sub-window components, tracked by a property dependency tracker.

Registers the window with the windowing system, in order to render the component’s items and react to input events once the event loop spins.

De-registers the window with the windowing system.

Registers the specified window and component to be considered the active popup. Returns the size of the popup.

Show a popup at the given position relative to the item

Removes any active popup.

Returns the scale factor set on the window, as provided by the windowing system.

Returns the scale factor set on the window, as provided by the windowing system.

Sets the scale factor for the window. This is set by the backend or for testing.

Returns the font properties that are set on the root item if it’s a Window item.

Sets the size of the window item. This method is typically called in response to receiving a window resize event from the windowing system. Size is in logical pixels.

Sets the close_requested callback. The callback will be run when the user tries to close a window.

Runs the close_requested callback. If the callback returns KeepWindowShown, this function returns false. That should prevent the Window from closing. Otherwise it returns true, which allows the Window to hide.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.