Skip to main content

Window

Struct Window 

Source
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: TitleBar

Which of the two title bars this window has.

§title: &'static str

What 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: u32

The 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: u16

Zero 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: bool

Implementations§

Source§

impl Window

Source

pub const fn new() -> Self

Source

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.

Source

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.

Source

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

Dresses the window in an asset that was registered with AssetKind::Png.

Source

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

Source

pub const fn with_size(self, width: u16, height: u16) -> Self

Source

pub const fn with_min_size(self, width: u16, height: u16) -> Self

Source

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

Trait Implementations§

Source§

impl Clone for Window

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Window

Source§

impl Debug for Window

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Window

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Window

Source§

impl PartialEq for Window

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Window

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.