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 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
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.