pub trait WindowBuilder: WindowBuilderBase {
Show 35 methods
// Required methods
fn new() -> Self;
fn with_config(config: &WindowConfig) -> Self;
fn center(self) -> Self;
fn position(self, x: f64, y: f64) -> Self;
fn inner_size(self, width: f64, height: f64) -> Self;
fn min_inner_size(self, min_width: f64, min_height: f64) -> Self;
fn max_inner_size(self, max_width: f64, max_height: f64) -> Self;
fn inner_size_constraints(self, constraints: WindowSizeConstraints) -> Self;
fn prevent_overflow(self) -> Self;
fn prevent_overflow_with_margin(self, margin: Size) -> Self;
fn resizable(self, resizable: bool) -> Self;
fn maximizable(self, maximizable: bool) -> Self;
fn minimizable(self, minimizable: bool) -> Self;
fn closable(self, closable: bool) -> Self;
fn title<S: Into<String>>(self, title: S) -> Self;
fn fullscreen(self, fullscreen: bool) -> Self;
fn focused(self, focused: bool) -> Self;
fn focusable(self, focusable: bool) -> Self;
fn maximized(self, maximized: bool) -> Self;
fn visible(self, visible: bool) -> Self;
fn transparent(self, transparent: bool) -> Self;
fn decorations(self, decorations: bool) -> Self;
fn always_on_bottom(self, always_on_bottom: bool) -> Self;
fn always_on_top(self, always_on_top: bool) -> Self;
fn visible_on_all_workspaces(self, visible_on_all_workspaces: bool) -> Self;
fn content_protected(self, protected: bool) -> Self;
fn icon(self, icon: Icon<'_>) -> Result<Self>;
fn skip_taskbar(self, skip: bool) -> Self;
fn background_color(self, color: Color) -> Self;
fn shadow(self, enable: bool) -> Self;
fn transient_for(self, parent: &impl IsA<Window>) -> Self;
fn theme(self, theme: Option<Theme>) -> Self;
fn has_icon(&self) -> bool;
fn get_theme(&self) -> Option<Theme>;
fn window_classname<S: Into<String>>(self, window_classname: S) -> Self;
}Expand description
A builder for all attributes related to a single window.
This trait is only meant to be implemented by a custom Runtime
and not by applications.
Required Methods§
Sourcefn with_config(config: &WindowConfig) -> Self
fn with_config(config: &WindowConfig) -> Self
Initializes a new window builder from a WindowConfig
Sourcefn position(self, x: f64, y: f64) -> Self
fn position(self, x: f64, y: f64) -> Self
The initial position of the window in logical pixels.
Sourcefn inner_size(self, width: f64, height: f64) -> Self
fn inner_size(self, width: f64, height: f64) -> Self
Window size in logical pixels.
Sourcefn min_inner_size(self, min_width: f64, min_height: f64) -> Self
fn min_inner_size(self, min_width: f64, min_height: f64) -> Self
Window min inner size in logical pixels.
Sourcefn max_inner_size(self, max_width: f64, max_height: f64) -> Self
fn max_inner_size(self, max_width: f64, max_height: f64) -> Self
Window max inner size in logical pixels.
Sourcefn inner_size_constraints(self, constraints: WindowSizeConstraints) -> Self
fn inner_size_constraints(self, constraints: WindowSizeConstraints) -> Self
Window inner size constraints.
Sourcefn prevent_overflow(self) -> Self
fn prevent_overflow(self) -> Self
Prevent the window from overflowing the working area (e.g. monitor size - taskbar size) on creation
§Platform-specific
- iOS / Android: Unsupported.
Sourcefn prevent_overflow_with_margin(self, margin: Size) -> Self
fn prevent_overflow_with_margin(self, margin: Size) -> Self
Prevent the window from overflowing the working area (e.g. monitor size - taskbar size) on creation with a margin
§Platform-specific
- iOS / Android: Unsupported.
Sourcefn resizable(self, resizable: bool) -> Self
fn resizable(self, resizable: bool) -> Self
Whether the window is resizable or not. When resizable is set to false, native window’s maximize button is automatically disabled.
Sourcefn maximizable(self, maximizable: bool) -> Self
fn maximizable(self, maximizable: bool) -> Self
Whether the window’s native maximize button is enabled or not. If resizable is set to false, this setting is ignored.
§Platform-specific
- macOS: Disables the “zoom” button in the window titlebar, which is also used to enter fullscreen mode.
- Linux / iOS / Android: Unsupported.
Sourcefn minimizable(self, minimizable: bool) -> Self
fn minimizable(self, minimizable: bool) -> Self
Whether the window’s native minimize button is enabled or not.
§Platform-specific
- Linux / iOS / Android: Unsupported.
Sourcefn closable(self, closable: bool) -> Self
fn closable(self, closable: bool) -> Self
Whether the window’s native close button is enabled or not.
§Platform-specific
- Linux: “GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible”
- iOS / Android: Unsupported.
Sourcefn fullscreen(self, fullscreen: bool) -> Self
fn fullscreen(self, fullscreen: bool) -> Self
Whether to start the window in fullscreen or not.
Sourcefn maximized(self, maximized: bool) -> Self
fn maximized(self, maximized: bool) -> Self
Whether the window should be maximized upon creation.
Sourcefn visible(self, visible: bool) -> Self
fn visible(self, visible: bool) -> Self
Whether the window should be immediately visible upon creation.
Sourcefn transparent(self, transparent: bool) -> Self
Available on crate feature macos-private-api or non-macOS only.
fn transparent(self, transparent: bool) -> Self
macos-private-api or non-macOS only.Whether the window should be transparent. If this is true, writing colors
with alpha values different than 1.0 will produce a transparent window.
Sourcefn decorations(self, decorations: bool) -> Self
fn decorations(self, decorations: bool) -> Self
Whether the window should have borders and bars.
Sourcefn always_on_bottom(self, always_on_bottom: bool) -> Self
fn always_on_bottom(self, always_on_bottom: bool) -> Self
Whether the window should always be below other windows.
Sourcefn always_on_top(self, always_on_top: bool) -> Self
fn always_on_top(self, always_on_top: bool) -> Self
Whether the window should always be on top of other windows.
Sourcefn visible_on_all_workspaces(self, visible_on_all_workspaces: bool) -> Self
fn visible_on_all_workspaces(self, visible_on_all_workspaces: bool) -> Self
Whether the window should be visible on all workspaces or virtual desktops.
Sourcefn content_protected(self, protected: bool) -> Self
fn content_protected(self, protected: bool) -> Self
Prevents the window contents from being captured by other apps.
Sourcefn skip_taskbar(self, skip: bool) -> Self
fn skip_taskbar(self, skip: bool) -> Self
Sets whether or not the window icon should be added to the taskbar.
Sourcefn background_color(self, color: Color) -> Self
fn background_color(self, color: Color) -> Self
Set the window background color.
Sourcefn shadow(self, enable: bool) -> Self
fn shadow(self, enable: bool) -> Self
Sets whether or not the window has shadow.
§Platform-specific
- Windows:
falsehas no effect on decorated window, shadows are always ON.truewill make undecorated window have a 1px white border, and on Windows 11, it will have a rounded corners.
- Linux: Unsupported.
Sourcefn transient_for(self, parent: &impl IsA<Window>) -> Self
Available on DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD only.
fn transient_for(self, parent: &impl IsA<Window>) -> Self
Sets the window to be created transient for parent.
See https://docs.gtk.org/gtk3/method.Window.set_transient_for.html
Sourcefn theme(self, theme: Option<Theme>) -> Self
fn theme(self, theme: Option<Theme>) -> Self
Forces a theme or uses the system settings if None was provided.
fn get_theme(&self) -> Option<Theme>
Sourcefn window_classname<S: Into<String>>(self, window_classname: S) -> Self
fn window_classname<S: Into<String>>(self, window_classname: S) -> Self
Sets custom name for Windows’ window class. Windows only.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".