pub struct Window(/* private fields */);Expand description
Handle to the window.
This handle can be cloned and passed around freely to give objects access to the window.
Obtained from Context.
Implementations§
Source§impl Window
impl Window
Sourcepub fn scale_factor(&self) -> f32
pub fn scale_factor(&self) -> f32
The window scale factor.
Sourcepub fn inv_scale_factor(&self) -> f32
pub fn inv_scale_factor(&self) -> f32
The inverse window scale factor.
Sourcepub fn primary_monitor(&self) -> Option<Monitor>
pub fn primary_monitor(&self) -> Option<Monitor>
The primary monitor.
Sourcepub fn display_mode(&self) -> DisplayMode
pub fn display_mode(&self) -> DisplayMode
The window display mode.
Sourcepub fn set_display_mode(&self, display_mode: DisplayMode)
pub fn set_display_mode(&self, display_mode: DisplayMode)
Set the window display mode.
Sourcepub fn is_fullscreen(&self) -> bool
pub fn is_fullscreen(&self) -> bool
If the window is in a fullscreen mode.
Sourcepub fn set_fullscreen_borderless(&self, monitor: Option<Monitor>)
pub fn set_fullscreen_borderless(&self, monitor: Option<Monitor>)
Set the window to borderless fullscreen mode.
Sourcepub fn set_fullscreen_exclusive(&self, video_mode: VideoMode)
pub fn set_fullscreen_exclusive(&self, video_mode: VideoMode)
Set the window to exclusive fullscreen mode.
Sourcepub fn set_windowed(&self, monitor: Option<Monitor>)
pub fn set_windowed(&self, monitor: Option<Monitor>)
Set the window to windowed mode.
Sourcepub fn outer_pixel_pos(&self) -> Option<Vec2I>
pub fn outer_pixel_pos(&self) -> Option<Vec2I>
The window outer position in pixels.
Sourcepub fn set_outer_pos(&self, pos: impl Into<Vec2I>)
pub fn set_outer_pos(&self, pos: impl Into<Vec2I>)
Set the window outer DPI-independent position.
Sourcepub fn set_outer_pixel_pos(&self, pos: impl Into<Vec2I>)
pub fn set_outer_pixel_pos(&self, pos: impl Into<Vec2I>)
Set the window outer pixel position.
Sourcepub fn pixel_size(&self) -> Vec2U
pub fn pixel_size(&self) -> Vec2U
The window pixel size.
Sourcepub fn request_size(&self, size: impl Into<Vec2U>) -> bool
pub fn request_size(&self, size: impl Into<Vec2U>) -> bool
Request a DPI-independent size for the window.
Sourcepub fn request_pixel_size(&self, size: impl Into<Vec2U>) -> bool
pub fn request_pixel_size(&self, size: impl Into<Vec2U>) -> bool
Request a pixel size for the window.
Sourcepub fn outer_pixel_size(&self) -> Vec2U
pub fn outer_pixel_size(&self) -> Vec2U
Outer pixel size of the window.
Sourcepub fn outer_size(&self) -> Vec2U
pub fn outer_size(&self) -> Vec2U
Outer DPI-independent size of the window.
Sourcepub fn pixel_center(&self) -> Vec2U
pub fn pixel_center(&self) -> Vec2U
Pixel center of the window.
Sourcepub fn set_resizable(&self, resizable: bool)
pub fn set_resizable(&self, resizable: bool)
Set if the window can be resized by the user.
Sourcepub fn set_maximized(&self, maximized: bool)
pub fn set_maximized(&self, maximized: bool)
Set if the window is maximized.
Sourcepub fn set_minimized(&self, minimized: bool)
pub fn set_minimized(&self, minimized: bool)
Set if the window is minimized.
Sourcepub fn set_min_inner_size(&self, size: impl Into<Option<Vec2U>>)
pub fn set_min_inner_size(&self, size: impl Into<Option<Vec2U>>)
Set the window’s minimum inner DPI-independent size.
Sourcepub fn set_min_inner_pixel_size(&self, size: impl Into<Option<Vec2U>>)
pub fn set_min_inner_pixel_size(&self, size: impl Into<Option<Vec2U>>)
Set the window’s minimum inner pixel size.
Sourcepub fn set_max_inner_size(&self, size: impl Into<Option<Vec2U>>)
pub fn set_max_inner_size(&self, size: impl Into<Option<Vec2U>>)
Set the window’s maximum inner DPI-independent size.
Sourcepub fn set_max_inner_pixel_size(&self, size: impl Into<Option<Vec2U>>)
pub fn set_max_inner_pixel_size(&self, size: impl Into<Option<Vec2U>>)
Set the window’s maximum inner pixel size.
Sourcepub fn set_cursor(&self, icon: CursorIcon)
pub fn set_cursor(&self, icon: CursorIcon)
Set the cursor to display when the mouse is over the window.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Window
impl !UnwindSafe for Window
impl Forget for Window
impl Freeze for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnsafeUnpin for Window
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§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.Source§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.Source§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.