Skip to main content

Window

Struct Window 

Source
pub struct Window<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Window<'a>

Source

pub fn open_parented<P, H, B>( parent: &P, options: WindowOpenOptions, build: B, ) -> WindowHandle
where P: HasRawWindowHandle, H: WindowHandler + 'static, B: FnOnce(&mut Window<'_>) -> H + Send + 'static,

Source

pub fn open_blocking<H, B>(options: WindowOpenOptions, build: B)
where H: WindowHandler + 'static, B: FnOnce(&mut Window<'_>) -> H + Send + 'static,

Source

pub fn close(&mut self)

Close the window

Source

pub fn resize(&mut self, size: Size)

Resize the window to the given size. The size is always in logical pixels. DPI scaling will automatically be accounted for.

Source

pub fn set_scale_factor(&mut self, scale: f64)

Re-interpret the window at a new content-scale factor, holding the logical size constant and growing/shrinking the physical size to match.

This is for embedded plug-in views whose scale becomes known only after the window is attached (the WindowScalePolicy chosen at open is otherwise fixed for the window’s lifetime). Implemented on X11, where a host may report its content scale late via IPlugViewContentScaleSupport; a no-op on Windows and macOS, which drive DPI through the OS. The change is applied on the next event-loop iteration and reported to the handler via a Resized event.

Source

pub fn set_mouse_cursor(&mut self, cursor: MouseCursor)

Source

pub fn has_focus(&mut self) -> bool

Source

pub fn focus(&mut self)

Source

pub fn gl_context(&self) -> Option<&GlContext>

If provided, then an OpenGL context will be created for this window. You’ll be able to access this context through crate::Window::gl_context.

Trait Implementations§

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Window<'a>

§

impl<'a> !Send for Window<'a>

§

impl<'a> !Sync for Window<'a>

§

impl<'a> !UnwindSafe for Window<'a>

§

impl<'a> Freeze for Window<'a>

§

impl<'a> Unpin for Window<'a>

§

impl<'a> UnsafeUnpin for Window<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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.

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.