Trait vizia::modifiers::WindowModifiers

source ·
pub trait WindowModifiers {
Show 14 methods // Required methods fn title<T>(self, title: impl Res<T>) -> Self where T: ToString; fn inner_size<S>(self, size: impl Res<S>) -> Self where S: Into<WindowSize>; fn min_inner_size<S>(self, size: impl Res<Option<S>>) -> Self where S: Into<WindowSize>; fn max_inner_size<S>(self, size: impl Res<Option<S>>) -> Self where S: Into<WindowSize>; fn position<P>(self, position: impl Res<P>) -> Self where P: Into<Position>; fn resizable(self, flag: impl Res<bool>) -> Self; fn minimized(self, flag: impl Res<bool>) -> Self; fn maximized(self, flag: impl Res<bool>) -> Self; fn visible(self, flag: bool) -> Self; fn transparent(self, flag: bool) -> Self; fn decorations(self, flag: bool) -> Self; fn always_on_top(self, flag: bool) -> Self; fn vsync(self, flag: bool) -> Self; fn icon(self, width: u32, height: u32, image: Vec<u8>) -> Self;
}
Expand description

Modifiers for setting the properties of a window.

Required Methods§

source

fn title<T>(self, title: impl Res<T>) -> Self
where T: ToString,

Sets the title of the window to the given value. Accepts a type, or lens to a type, which implements ToString.

§Example
Application::new(|cx|{
    // Content here
})
.title("Vizia Application")
.run();
source

fn inner_size<S>(self, size: impl Res<S>) -> Self
where S: Into<WindowSize>,

Sets the inner size of the window to the given value. Accepts a value, or lens, which can be converted to a [WindowSize].

The inner size is the window area excluding the window borders.

§Example
Application::new(|cx|{
    // Content here
})
.inner_size((300, 300))
.run();
source

fn min_inner_size<S>(self, size: impl Res<Option<S>>) -> Self
where S: Into<WindowSize>,

Sets the minimum inner size of the window to the given value. Accepts an optional value, or lens, which can be converted to a [WindowSize].

Setting the minimum inner size to None removes the minimum inner size constraint from the window.

§Example
Application::new(|cx|{
    // Content here
})
.min_inner_size(Some((300, 300)))
.run();
source

fn max_inner_size<S>(self, size: impl Res<Option<S>>) -> Self
where S: Into<WindowSize>,

Sets the maximum inner size of the window to the given value. Accepts an optional value, or lens, which can be converted to a [WindowSize].

Setting the maximum inner size to None removes the maximum inner size constraint from the window.

§Example
Application::new(|cx|{
    // Content here
})
.max_inner_size(Some((1000, 1000)))
.run();
source

fn position<P>(self, position: impl Res<P>) -> Self
where P: Into<Position>,

Sets the position of the window to the given value. Accepts a value, or lens, which can be converted to a [Position].

§Example
Application::new(|cx|{
    // Content here
})
.position((100, 200))
.run();
source

fn resizable(self, flag: impl Res<bool>) -> Self

Sets whether the window can be resized. Accepts a boolean value, or lens to a boolean value.

§Example
Application::new(|cx|{
    // Content here
})
.resizable(false)
.run();
source

fn minimized(self, flag: impl Res<bool>) -> Self

Sets whether the window is minimized. Accepts a boolean value, or lens to a boolean value.

§Example
Application::new(|cx|{
    // Content here
})
.minimized(true)
.run();
source

fn maximized(self, flag: impl Res<bool>) -> Self

Sets whether the window is maximized. Accepts a boolean value, or lens to a boolean value.

§Example
Application::new(|cx|{
    // Content here
})
.maximized(true)
.run();
source

fn visible(self, flag: bool) -> Self

Sets whether the window is visible. Accepts a boolean value, or lens to a boolean value.

§Example
Application::new(|cx|{
    // Content here
})
.visible(false)
.run();
source

fn transparent(self, flag: bool) -> Self

Sets whether the window is transparent. Accepts a boolean value, or lens to a boolean value.

§Example
Application::new(|cx|{
    // Content here
})
.transparent(true)
.run();
source

fn decorations(self, flag: bool) -> Self

Sets whether the window has decorations. Accepts a boolean value, or lens to a boolean value.

§Example
Application::new(|cx|{
    // Content here
})
.decorations(false)
.run();
source

fn always_on_top(self, flag: bool) -> Self

Sets whether the window should be on top of other windows. Accepts a boolean value, or lens to a boolean value.

§Example
Application::new(|cx|{
    // Content here
})
.always_on_top(true)
.run();
source

fn vsync(self, flag: bool) -> Self

Sets whether the window has vsync enabled.

§Example
Application::new(|cx|{
    // Content here
})
.vsync(true)
.run();
source

fn icon(self, width: u32, height: u32, image: Vec<u8>) -> Self

Sets the icon used for the window.

§Example

let icon = vizia::image::load_from_memory(include_bytes!("../icon.png"))
    .expect("Failed to load icon");

Application::new(|cx|{
    // Content here
})
.icon(icon.width(), icon.height(), icon.into_bytes())
.run();

Object Safety§

This trait is not object safe.

Implementors§