Skip to main content

WindowScope

Struct WindowScope 

Source
pub struct WindowScope { /* private fields */ }
Expand description

A Window and its builder.

Implementations§

Source§

impl WindowScope

Source

pub fn title(self, title: impl Into<String>) -> Self

What the window calls itself.

Source

pub fn size(self, width: f32, height: f32) -> Self

The size the window opens at, in dp. A later change resizes it.

Source

pub fn min_size(self, width: f32, height: f32) -> Self

The smallest size the user can make it, in dp.

Source

pub fn resizable(self, resizable: bool) -> Self

Source

pub fn report_size(self, report: bool) -> Self

Asks to be told every time the window’s width or height, rounded to whole dp, changes. Without it the size is reported only when its class or the safe area changes. Turn it on only for a window that lays out by its exact size: each whole-dp change while the user drags an edge costs one call into the Host.

Source

pub fn chrome(self, chrome: Chrome) -> Self

Who draws the caption.

Source

pub fn title_bar(self, title_bar: TitleBar) -> Self

Which of the two title bars the window has.

Source

pub fn icon(self, asset_id: u32) -> Self

The window’s icon, as the id of a registered asset. Without one it wears the application’s.

Source

pub fn position(self, x: f32, y: f32) -> Self

Where the window sits, in screen dp from the top left of the main screen. Changing it moves the window; the position the user chose is not given back. Without it the platform places the window.

Source

pub fn restore_key(self, key: impl Into<String>) -> Self

The application’s stable name for the window, which matches a window the system brings back to the node that describes it.

Source

pub fn zoom_level(self, level: i8) -> Self

The window’s own application zoom level, kept inside its range.

Source

pub fn drag_from_pointer(self, drag: DragFromPointer) -> Self

Opens the window under a pointer that is held down and follows it until it is let go. Read when the window opens and not again.

Source

pub fn theme(self, theme: Theme) -> Self

A theme for this window over the application’s.

Source

pub fn on_focus_changed(self, handler: impl FnMut(bool) + 'static) -> Self

The window became the key window or stopped being it.

Source

pub fn on_moved(self, handler: impl FnMut(WindowFrame) + 'static) -> Self

The window’s outer frame moved or changed size.

Source

pub fn on_drag(self, handler: impl FnMut(WindowDragEvent) + 'static) -> Self

The window is being dragged out of a tab, and how that ended.

Source

pub fn on_unavailable(self, handler: impl FnMut() + 'static) -> Self

The platform could not open this window. Tell the user, or put the tab back.

Source

pub fn on_closed(self, handler: impl FnMut() + 'static) -> Self

The system closed the window without asking. Stop composing it.

Source

pub fn content(self, content: impl FnOnce())

Composes this window with content as its children.

Trait Implementations§

Source§

impl Drop for WindowScope

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.