pub struct WindowScope { /* private fields */ }Expand description
A Window and its builder.
Implementations§
Source§impl WindowScope
impl WindowScope
Sourcepub fn size(self, width: f32, height: f32) -> Self
pub fn size(self, width: f32, height: f32) -> Self
The size the window opens at, in dp. A later change resizes it.
Sourcepub fn min_size(self, width: f32, height: f32) -> Self
pub fn min_size(self, width: f32, height: f32) -> Self
The smallest size the user can make it, in dp.
pub fn resizable(self, resizable: bool) -> Self
Sourcepub fn report_size(self, report: bool) -> Self
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.
Sourcepub fn title_bar(self, title_bar: TitleBar) -> Self
pub fn title_bar(self, title_bar: TitleBar) -> Self
Which of the two title bars the window has.
Sourcepub fn icon(self, asset_id: u32) -> Self
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.
Sourcepub fn position(self, x: f32, y: f32) -> Self
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.
Sourcepub fn restore_key(self, key: impl Into<String>) -> Self
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.
Sourcepub fn zoom_level(self, level: i8) -> Self
pub fn zoom_level(self, level: i8) -> Self
The window’s own application zoom level, kept inside its range.
Sourcepub fn drag_from_pointer(self, drag: DragFromPointer) -> Self
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.
Sourcepub fn on_focus_changed(self, handler: impl FnMut(bool) + 'static) -> Self
pub fn on_focus_changed(self, handler: impl FnMut(bool) + 'static) -> Self
The window became the key window or stopped being it.
Sourcepub fn on_moved(self, handler: impl FnMut(WindowFrame) + 'static) -> Self
pub fn on_moved(self, handler: impl FnMut(WindowFrame) + 'static) -> Self
The window’s outer frame moved or changed size.
Sourcepub fn on_drag(self, handler: impl FnMut(WindowDragEvent) + 'static) -> Self
pub fn on_drag(self, handler: impl FnMut(WindowDragEvent) + 'static) -> Self
The window is being dragged out of a tab, and how that ended.
The platform could not open this window. Tell the user, or put the tab back.