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

source

pub fn new() -> WindowBuilder

Initializes a new WindowBuilder with default values.

source

pub fn with_dimensions(self, size: LogicalSize) -> WindowBuilder

Requests the window to be of specific dimensions.

source

pub fn with_min_dimensions(self, min_size: LogicalSize) -> WindowBuilder

Sets a minimum dimension size for the window

source

pub fn with_max_dimensions(self, max_size: LogicalSize) -> WindowBuilder

Sets a maximum dimension size for the window

source

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.

source

pub fn with_title<T>(self, title: T) -> WindowBuilderwhere T: Into<String>,

Requests a specific title for the window.

source

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

source

pub fn with_maximized(self, maximized: bool) -> WindowBuilder

Requests maximized mode.

source

pub fn with_visibility(self, visible: bool) -> WindowBuilder

Sets whether the window will be initially hidden or visible.

source

pub fn with_transparency(self, transparent: bool) -> WindowBuilder

Sets whether the background of the window should be transparent.

source

pub fn with_decorations(self, decorations: bool) -> WindowBuilder

Sets whether the window should have a border, a title bar, etc.

source

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.

source

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.

source

pub fn with_multitouch(self) -> WindowBuilder

Enables multitouch.

source

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

source§

fn clone(&self) -> WindowBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for WindowBuilder

source§

fn fmt(&self, fmtr: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl WindowBuilderExt for WindowBuilder

source§

fn with_activation_policy( self, activation_policy: ActivationPolicy ) -> WindowBuilder

Sets the activation policy for the window being built.
source§

fn with_movable_by_window_background( self, movable_by_window_background: bool ) -> WindowBuilder

Enables click-and-drag behavior for the entire window, not just the titlebar.
source§

fn with_titlebar_transparent(self, titlebar_transparent: bool) -> WindowBuilder

Makes the titlebar transparent and allows the content to appear behind it.
source§

fn with_titlebar_hidden(self, titlebar_hidden: bool) -> WindowBuilder

Hides the window titlebar.
source§

fn with_titlebar_buttons_hidden( self, titlebar_buttons_hidden: bool ) -> WindowBuilder

Hides the window titlebar buttons.
source§

fn with_title_hidden(self, title_hidden: bool) -> WindowBuilder

Hides the window title.
source§

fn with_fullsize_content_view( self, fullsize_content_view: bool ) -> WindowBuilder

Makes the window content appear behind the titlebar.
source§

fn with_resize_increments(self, increments: LogicalSize) -> WindowBuilder

Build window with resizeIncrements property. Values must not be 0.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> SetParameter for T

§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere T: Parameter<Self>,

Sets value as a parameter of self.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.