Skip to main content

WindowModifiers

Trait WindowModifiers 

Source
pub trait WindowModifiers {
Show 22 methods // Required methods fn on_close( self, callback: impl Fn(&mut EventContext<'_>) + 'static, ) -> Self; fn on_create( self, callback: impl Fn(&mut EventContext<'_>) + 'static, ) -> Self; fn title<T: ToStringLocalized>( self, title: impl Res<T> + Clone + 'static, ) -> Self; fn inner_size<S: Into<WindowSize>>(self, size: impl Res<S>) -> Self; fn min_inner_size<S: Into<WindowSize>>( self, size: impl Res<Option<S>>, ) -> Self; fn max_inner_size<S: Into<WindowSize>>( self, size: impl Res<Option<S>>, ) -> Self; fn position<P: Into<WindowPosition>>(self, position: impl Res<P>) -> Self; fn offset<P: Into<WindowPosition>>(self, offset: impl Res<P>) -> Self; fn anchor<P: Into<Anchor>>(self, anchor: impl Res<P>) -> Self; fn anchor_target<P: Into<AnchorTarget>>( self, anchor_target: impl Res<P>, ) -> Self; fn parent_anchor<P: Into<Anchor>>(self, anchor: impl Res<P>) -> Self; 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: impl Res<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 skia_resource_cache_limit(self, limit: usize) -> Self; fn icon(self, width: u32, height: u32, image: Vec<u8>) -> Self; fn enabled_window_buttons(self, window_buttons: WindowButtons) -> Self;
}
Expand description

Modifiers for setting the properties of a window.

Required Methods§

Source

fn on_close(self, callback: impl Fn(&mut EventContext<'_>) + 'static) -> Self

Source

fn on_create(self, callback: impl Fn(&mut EventContext<'_>) + 'static) -> Self

Source

fn title<T: ToStringLocalized>( self, title: impl Res<T> + Clone + 'static, ) -> Self

Sets the title of the window to the given value. Accepts a value or signal of any type that implements ToString. Accepts a [Localized] value to set a localizable title that updates when the locale changes.

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

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

Sets the inner size of the window to the given value. Accepts a value or signal that 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: Into<WindowSize>>(self, size: impl Res<Option<S>>) -> Self

Sets the minimum inner size of the window to the given value. Accepts an optional value or signal that 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: Into<WindowSize>>(self, size: impl Res<Option<S>>) -> Self

Sets the maximum inner size of the window to the given value. Accepts an optional value or signal that 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: Into<WindowPosition>>(self, position: impl Res<P>) -> Self

Sets the position of the window to the given value. Accepts a value or signal that can be converted to a [Position].

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

fn offset<P: Into<WindowPosition>>(self, offset: impl Res<P>) -> Self

Source

fn anchor<P: Into<Anchor>>(self, anchor: impl Res<P>) -> Self

Source

fn anchor_target<P: Into<AnchorTarget>>( self, anchor_target: impl Res<P>, ) -> Self

Source

fn parent_anchor<P: Into<Anchor>>(self, anchor: impl Res<P>) -> Self

Source

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

Sets whether the window can be resized. Accepts a boolean value or Res<bool> source.

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

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

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

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

Sets whether the window is visible. Accepts a boolean value or Res<bool> source.

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

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

Sets whether the window is transparent.

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

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

Sets whether the window has decorations.

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

§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 skia_resource_cache_limit(self, limit: usize) -> Self

Sets the maximum number of bytes Skia may use for cached GPU resources.

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();
Source

fn enabled_window_buttons(self, window_buttons: WindowButtons) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl WindowModifiers for Handle<'_, Window>

Source§

fn on_close(self, callback: impl Fn(&mut EventContext<'_>) + 'static) -> Self

Source§

fn on_create(self, callback: impl Fn(&mut EventContext<'_>) + 'static) -> Self

Source§

fn title<T: ToStringLocalized>( self, title: impl Res<T> + Clone + 'static, ) -> Self

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn offset<P: Into<WindowPosition>>(self, offset: impl Res<P>) -> Self

Source§

fn anchor<P: Into<Anchor>>(self, anchor: impl Res<P>) -> Self

Source§

fn anchor_target<P: Into<AnchorTarget>>( self, anchor_target: impl Res<P>, ) -> Self

Source§

fn parent_anchor<P: Into<Anchor>>(self, parent_anchor: impl Res<P>) -> Self

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn skia_resource_cache_limit(self, limit: usize) -> Self

Source§

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

Source§

fn enabled_window_buttons(self, window_buttons: WindowButtons) -> Self

Implementors§