pub struct Window {
pub chrome: Chrome,
pub title_bar: TitleBar,
pub title: &'static str,
pub icon: u32,
pub width: u16,
pub height: u16,
pub min_width: u16,
pub min_height: u16,
pub resizable: bool,
}Expand description
What an application may decide about its own window.
The window belongs to the Renderer, so this is short and stays short. What is here is what an application knows and the Renderer cannot guess: what the window is called and how large it should open. Nothing here names a colour or a corner, because those are the design system’s, and nothing here is read more than once.
Fields§
§chrome: Chrome§title_bar: TitleBarWhich of the two title bars this window has.
title: &'static strWhat the window calls itself.
Empty means the application said nothing, and the renderer uses its own name for it. It is not decoration: a desktop lists windows by this, and a window with no title of its own is listed under whatever the renderer happened to be called.
icon: u32The picture the window wears, as an asset id, or zero for none.
An id rather than a path or a name, because a path is a fact about the machine the application was built on and a name asks the toolkit to find something it may not have. Registering the bytes and referring to them is what every other picture in this protocol does.
width: u16Zero means the Renderer chooses, which is what an application that said nothing gets. A size is in the same density independent pixels gestures are measured in.
height: u16§min_width: u16§min_height: u16§resizable: boolImplementations§
Source§impl Window
impl Window
pub const fn new() -> Self
Sourcepub const fn with_title_bar(self, title_bar: TitleBar) -> Self
pub const fn with_title_bar(self, title_bar: TitleBar) -> Self
Which of the two title bars this window has.
Normal unless it is said otherwise, because that is the window an application on
this platform has now. What the mode is worth in pixels is the design system’s, so
nothing here is a measurement.
Sourcepub const fn with_title(self, title: &'static str) -> Self
pub const fn with_title(self, title: &'static str) -> Self
Names the window. A literal, because this is read once before the window is stood up and never again, so there is nothing for a computed title to change.
Sourcepub const fn with_icon(self, asset_id: u32) -> Self
pub const fn with_icon(self, asset_id: u32) -> Self
Dresses the window in an asset that was registered with AssetKind::Png.