Struct glutin::WindowBuilder
source · pub struct WindowBuilder {
pub window: WindowAttributes,
/* private fields */
}
Expand description
Object that allows you to build windows.
Fields§
§window: WindowAttributes
The attributes to use to create the window.
Implementations§
source§impl WindowBuilder
impl WindowBuilder
sourcepub fn new() -> WindowBuilder
pub fn new() -> WindowBuilder
Initializes a new WindowBuilder
with default values.
sourcepub fn with_dimensions(self, size: LogicalSize) -> WindowBuilder
pub fn with_dimensions(self, size: LogicalSize) -> WindowBuilder
Requests the window to be of specific dimensions.
sourcepub fn with_min_dimensions(self, min_size: LogicalSize) -> WindowBuilder
pub fn with_min_dimensions(self, min_size: LogicalSize) -> WindowBuilder
Sets a minimum dimension size for the window
sourcepub fn with_max_dimensions(self, max_size: LogicalSize) -> WindowBuilder
pub fn with_max_dimensions(self, max_size: LogicalSize) -> WindowBuilder
Sets a maximum dimension size for the window
sourcepub fn with_resizable(self, resizable: bool) -> WindowBuilder
pub fn with_resizable(self, resizable: bool) -> WindowBuilder
Sets whether the window is resizable or not
Note that making the window unresizable doesn’t exempt you from handling Resized
, as that event can still be
triggered by DPI scaling, entering fullscreen mode, etc.
Platform-specific
This only has an effect on desktop platforms.
Due to a bug in XFCE, this has no effect on Xfwm.
sourcepub fn with_title<T>(self, title: T) -> WindowBuilderwhere
T: Into<String>,
pub fn with_title<T>(self, title: T) -> WindowBuilderwhere T: Into<String>,
Requests a specific title for the window.
sourcepub fn with_fullscreen(self, monitor: Option<MonitorId>) -> WindowBuilder
pub fn with_fullscreen(self, monitor: Option<MonitorId>) -> WindowBuilder
Sets the window fullscreen state. None means a normal window, Some(MonitorId) means a fullscreen window on that specific monitor
sourcepub fn with_maximized(self, maximized: bool) -> WindowBuilder
pub fn with_maximized(self, maximized: bool) -> WindowBuilder
Requests maximized mode.
sourcepub fn with_visibility(self, visible: bool) -> WindowBuilder
pub fn with_visibility(self, visible: bool) -> WindowBuilder
Sets whether the window will be initially hidden or visible.
sourcepub fn with_transparency(self, transparent: bool) -> WindowBuilder
pub fn with_transparency(self, transparent: bool) -> WindowBuilder
Sets whether the background of the window should be transparent.
sourcepub fn with_decorations(self, decorations: bool) -> WindowBuilder
pub fn with_decorations(self, decorations: bool) -> WindowBuilder
Sets whether the window should have a border, a title bar, etc.
sourcepub fn with_always_on_top(self, always_on_top: bool) -> WindowBuilder
pub fn with_always_on_top(self, always_on_top: bool) -> WindowBuilder
Sets whether or not the window will always be on top of other windows.
sourcepub fn with_window_icon(self, window_icon: Option<Icon>) -> WindowBuilder
pub fn with_window_icon(self, window_icon: Option<Icon>) -> WindowBuilder
Sets the window icon. On Windows and X11, this is typically the small icon in the top-left corner of the titlebar.
Platform-specific
This only has an effect on Windows and X11.
On Windows, this sets ICON_SMALL
. The base size for a window icon is 16x16, but it’s
recommended to account for screen scaling and pick a multiple of that, i.e. 32x32.
X11 has no universal guidelines for icon sizes, so you’re at the whims of the WM. That said, it’s usually in the same ballpark as on Windows.
sourcepub fn with_multitouch(self) -> WindowBuilder
pub fn with_multitouch(self) -> WindowBuilder
Enables multitouch.
sourcepub fn build(self, events_loop: &EventsLoop) -> Result<Window, CreationError>
pub fn build(self, events_loop: &EventsLoop) -> Result<Window, CreationError>
Builds the window.
Error should be very rare and only occur in case of permission denied, incompatible system, out of memory, etc.
Trait Implementations§
source§impl Clone for WindowBuilder
impl Clone for WindowBuilder
source§fn clone(&self) -> WindowBuilder
fn clone(&self) -> WindowBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for WindowBuilder
impl Debug for WindowBuilder
source§impl WindowBuilderExt for WindowBuilder
impl WindowBuilderExt for WindowBuilder
fn with_x11_visual<T>(self, visual_infos: *const T) -> WindowBuilder
fn with_x11_screen(self, screen_id: i32) -> WindowBuilder
source§fn with_class(self, instance: String, class: String) -> WindowBuilder
fn with_class(self, instance: String, class: String) -> WindowBuilder
WM_CLASS
hint; defaults to the name of the binary. Only relevant on X11.source§fn with_override_redirect(self, override_redirect: bool) -> WindowBuilder
fn with_override_redirect(self, override_redirect: bool) -> WindowBuilder
source§fn with_x11_window_type(self, x11_window_type: WindowType) -> WindowBuilder
fn with_x11_window_type(self, x11_window_type: WindowType) -> WindowBuilder
_NET_WM_WINDOW_TYPE
hint; defaults to Normal
. Only relevant on X11.source§fn with_resize_increments(self, increments: LogicalSize) -> WindowBuilder
fn with_resize_increments(self, increments: LogicalSize) -> WindowBuilder
source§fn with_base_size(self, base_size: LogicalSize) -> WindowBuilder
fn with_base_size(self, base_size: LogicalSize) -> WindowBuilder
source§fn with_gtk_theme_variant(self, variant: String) -> WindowBuilder
fn with_gtk_theme_variant(self, variant: String) -> WindowBuilder
_GTK_THEME_VARIANT
hint set to the specified value. Currently only relevant on X11.source§fn with_app_id(self, app_id: String) -> WindowBuilder
fn with_app_id(self, app_id: String) -> WindowBuilder
.desktop
file distributed with
your program. Only relevant on Wayland. Read more