pub struct WindowOptions {
    pub preserve_aspect_ratio: bool,
    pub background_color: Color,
    pub start_hidden: bool,
    pub size: Option<[u32; 2]>,
    pub resizable: bool,
    pub borderless: bool,
    pub fullscreen: bool,
    pub overlays_visible: bool,
    pub default_controls: bool,
}
Expand description

Options for creating a new window.

Fields§

§preserve_aspect_ratio: bool

Preserve the aspect ratio of the image when scaling.

§background_color: Color

The background color for the window.

This is used to color areas without image data if preserve_aspect_ratio is true.

§start_hidden: bool

Create the window hidden.

The window can manually be made visible at a later time.

§size: Option<[u32; 2]>

The initial size of the window in pixel.

This may be ignored by some window managers.

§resizable: bool

If true allow the window to be resized.

This may be ignored by some window managers.

§borderless: bool

Make the window borderless.

This may be ignored by some window managers.

§fullscreen: bool

Make the window fullscreen.

This may be ignored by some window managers.

§overlays_visible: bool

If true, draw overlays on the image.

Defaults to true.

§default_controls: bool

If true, enable default mouse based controls for panning and zooming the image.

Defaults to true.

Implementations§

source§

impl WindowOptions

source

pub fn new() -> Self

Create new window options with default values.

source

pub fn set_preserve_aspect_ratio(self, preserve_aspect_ratio: bool) -> Self

Preserve the aspect ratio of displayed images, or not.

This function consumes and returns self to allow daisy chaining.

source

pub fn set_background_color(self, background_color: Color) -> Self

Set the background color of the window.

This function consumes and returns self to allow daisy chaining.

source

pub fn set_start_hidden(self, start_hidden: bool) -> Self

Start the window hidden.

This function consumes and returns self to allow daisy chaining.

source

pub fn set_size(self, size: impl Into<Option<[u32; 2]>>) -> Self

Set the initial size of the window.

Pass None to clear a previously set value, which will let the window manager choose the initial size.

This property may be ignored by some window managers.

This function consumes and returns self to allow daisy chaining.

source

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

Make the window resizable or not.

This property may be ignored by some window managers.

This function consumes and returns self to allow daisy chaining.

source

pub fn set_borderless(self, borderless: bool) -> Self

Make the window borderless or not.

This function consumes and returns self to allow daisy chaining.

source

pub fn set_fullscreen(self, fullscreen: bool) -> Self

Make the window fullscreen or not.

This function consumes and returns self to allow daisy chaining.

source

pub fn set_show_overlays(self, overlays_visible: bool) -> Self

Set whether or not overlays should be drawn on the window.

source

pub fn set_default_controls(self, default_controls: bool) -> Self

Set whether or not default mouse controls for panning and zooming the image should be added.

Trait Implementations§

source§

impl Clone for WindowOptions

source§

fn clone(&self) -> WindowOptions

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for WindowOptions

source§

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

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

impl Default for WindowOptions

source§

fn default() -> Self

Returns the “default value” for a type. 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> Downcast<T> for T

source§

fn downcast(&self) -> &T

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSync for T
where T: Sync,