Struct winit::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
sourceimpl 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: Into<String>>(self, title: T) -> WindowBuilder
pub fn with_title<T: Into<String>>(self, title: T) -> WindowBuilder
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
sourceimpl Clone for WindowBuilder
impl Clone for WindowBuilder
sourcefn clone(&self) -> WindowBuilder
fn clone(&self) -> WindowBuilder
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for WindowBuilder
impl Debug for WindowBuilder
sourceimpl 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
sourcefn 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.sourcefn with_override_redirect(self, override_redirect: bool) -> WindowBuilder
fn with_override_redirect(self, override_redirect: bool) -> WindowBuilder
sourcefn with_x11_window_type(self, x11_window_type: XWindowType) -> WindowBuilder
fn with_x11_window_type(self, x11_window_type: XWindowType) -> WindowBuilder
_NET_WM_WINDOW_TYPE
hint; defaults to Normal
. Only relevant on X11.sourcefn with_resize_increments(self, increments: LogicalSize) -> WindowBuilder
fn with_resize_increments(self, increments: LogicalSize) -> WindowBuilder
sourcefn with_base_size(self, base_size: LogicalSize) -> WindowBuilder
fn with_base_size(self, base_size: LogicalSize) -> WindowBuilder
sourcefn 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.Auto Trait Implementations
impl !RefUnwindSafe for WindowBuilder
impl !Send for WindowBuilder
impl !Sync for WindowBuilder
impl Unpin for WindowBuilder
impl !UnwindSafe for WindowBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
value
as a parameter of self
.