Struct async_winit::window::Window

source ·
pub struct Window { /* private fields */ }
Expand description

A window.

Implementations§

source§

impl Window

source

pub async fn new() -> Result<Window, OsError>

Create a new window.

source

pub fn window(&self) -> &Window

Get a reference to the underlying window.

source

pub fn id(&self) -> WindowId

Get the ID of the window.

source

pub fn scale_factor(&self) -> f64

Get the scale factor of the window.

source

pub fn request_redraw(&self)

Request a redraw.

source§

impl Window

source

pub async fn inner_position( &self ) -> Result<PhysicalPosition<i32>, NotSupportedError>

Get the inner position of the window.

source

pub async fn outer_position( &self ) -> Result<PhysicalPosition<i32>, NotSupportedError>

Get the outer position of the window.

source

pub async fn set_outer_position(&self, position: impl Into<Position>)

Set the outer position of the window.

source

pub async fn inner_size(&self) -> PhysicalSize<u32>

Get the inner size of the window.

source

pub async fn outer_size(&self) -> PhysicalSize<u32>

Get the outer size of the window.

source

pub async fn set_inner_size(&self, size: impl Into<Size>)

Set the inner size of the window.

source

pub async fn set_min_inner_size(&self, size: impl Into<Option<Size>>)

Set the minimum inner size of the window.

source

pub async fn set_max_inner_size(&self, size: impl Into<Option<Size>>)

Set the maximum inner size of the window.

source

pub async fn resize_increments(&self) -> Option<PhysicalSize<u32>>

Get the resize increments of the window.

source

pub async fn set_resize_increments(&self, size: impl Into<Option<Size>>)

Set the resize increments of the window.

source

pub async fn set_title(&self, title: impl Into<String>)

Set the title of the window.

source

pub async fn set_visible(&self, visible: bool)

Set whether the window is visible.

source

pub async fn is_visible(&self) -> Option<bool>

Get the window’s visibility.

source

pub async fn set_transparent(&self, transparent: bool)

Set the window’s transparency.

source

pub async fn set_resizable(&self, resizable: bool)

Set the window’s resizable property.

source

pub async fn is_resizable(&self) -> bool

Get the window’s resizable property.

source

pub async fn set_minimized(&self, minimized: bool)

Set the window’s minimization.

source

pub async fn is_minimized(&self) -> Option<bool>

Get the window’s minimization.

source

pub async fn set_maximized(&self, maximized: bool)

Set the window’s maximization.

source

pub async fn is_maximized(&self) -> bool

Get the window’s maximization.

source

pub async fn set_fullscreen(&self, fullscreen: Option<Fullscreen>)

Set the window’s fullscreen state.

source

pub async fn fullscreen(&self) -> Option<Fullscreen>

Get the fullscreen state of the window.

source

pub async fn set_decorations(&self, decorations: bool)

Set the window’s decorations.

source

pub async fn is_decorated(&self) -> bool

Get the window’s decorations.

source

pub async fn set_window_level(&self, level: WindowLevel)

Set the window level.

source

pub async fn set_window_icon(&self, icon: Option<Icon>)

Set the window icon.

source

pub async fn set_ime_position(&self, posn: impl Into<Position>)

Set the IME position.

source

pub async fn set_ime_allowed(&self, allowed: bool)

Set whether IME is allowed.

source

pub async fn set_ime_purpose(&self, purpose: ImePurpose)

Set the IME purpose.

source

pub async fn focus_window(&self)

Focus the window.

source

pub async fn is_focused(&self) -> bool

Tell whether the window is focused.

source

pub async fn request_user_attention( &self, request_type: Option<UserAttentionType> )

Request the user’s attention.

source

pub async fn set_theme(&self, theme: Option<Theme>)

Set the window’s theme.

source

pub async fn theme(&self) -> Option<Theme>

Get the window’s theme.

source

pub async fn set_content_protected(&self, protected: bool)

Set the window’s protected content.

source

pub async fn title(&self) -> String

Get the title of the window.

source

pub async fn set_cursor_icon(&self, icon: CursorIcon)

Set the cursor icon.

source

pub async fn set_cursor_position( &self, posn: impl Into<Position> ) -> Result<(), ExternalError>

Set the cursor position.

source

pub async fn set_cursor_grab( &self, mode: CursorGrabMode ) -> Result<(), ExternalError>

Set the cursor’s grab mode.

source

pub async fn set_cursor_visible(&self, visible: bool)

Set the cursor’s visibility.

source

pub async fn drag_window(&self) -> Result<(), ExternalError>

Drag the window.

source

pub async fn drag_resize_window( &self, direction: ResizeDirection ) -> Result<(), ExternalError>

Drag-resize the window.

source

pub async fn set_cursor_hittest( &self, hit_test: bool ) -> Result<(), ExternalError>

Set the cursor hit test.

source

pub async fn current_monitor(&self) -> Option<MonitorHandle>

Get the current monitor of this window.

source§

impl Window

Waiting for events.

source

pub fn redraw_requested(&self) -> &Handler<()>

Get the handler for the RedrawRequested event.

source

pub fn close_requested(&self) -> &Handler<()>

Get the handler for the CloseRequested event.

source

pub fn resized(&self) -> &Handler<PhysicalSize<u32>>

Get the handler for the Resized event.

source

pub fn moved(&self) -> &Handler<PhysicalPosition<i32>>

Get the handler for the Moved event.

source

pub fn destroyed(&self) -> &Handler<()>

Get handler for the Destroyed event.

source

pub fn focused(&self) -> &Handler<bool>

Get the handler for the Focused event.

source

pub fn keyboard_input(&self) -> &Handler<KeyboardInput>

Get the handler for the KeyboardInput event.

source

pub fn modifiers_changed(&self) -> &Handler<ModifiersState>

Get the handler for the ModifiersChanged event.

source

pub fn received_character(&self) -> &Handler<char>

Get the handler for the ReceivedCharacter event.

source

pub fn ime(&self) -> &Handler<Ime>

Get the handler for the Ime event.

source

pub fn cursor_moved(&self) -> &Handler<CursorMoved>

Get the handler for the CursorMoved event.

source

pub fn cursor_entered(&self) -> &Handler<DeviceId>

Get the handler for the CursorEntered event.

source

pub fn cursor_left(&self) -> &Handler<DeviceId>

Get the handler for the CursorLeft event.

source

pub fn mouse_wheel(&self) -> &Handler<MouseWheel>

Get the handle for the MouseWheel event.

source

pub fn mouse_input(&self) -> &Handler<MouseInput>

Get the handle for the MouseInput event.

source

pub fn touchpad_magnify(&self) -> &Handler<TouchpadMagnify>

Get the handle for the TouchpadMagnify event.

source

pub fn touchpad_pressure(&self) -> &Handler<TouchpadPressure>

Get the handle for the TouchpadPressure event.

source

pub fn touch(&self) -> &Handler<Touch>

Get the handle for the Touch event.

source

pub fn scale_factor_changed(&self) -> &Handler<ScaleFactor>

Get the handle for the ScaleFactorChanged event.

source

pub fn touchpad_rotate(&self) -> &Handler<TouchpadRotate>

Get the handle for the TouchpadRotate event.

source

pub fn smart_magnify(&self) -> &Handler<DeviceId>

Get the handle for the SmartMagnify event.

source

pub fn axis_motion(&self) -> &Handler<AxisMotion>

Get the handle for the AxisMotion event.

source

pub fn theme_changed(&self) -> &Handler<Theme>

Get the handle for the ThemeChanged event.

source

pub fn occluded(&self) -> &Handler<bool>

Get the handle for the Occulded event.

Trait Implementations§

source§

impl Clone for Window

source§

fn clone(&self) -> Window

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 Drop for Window

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl HasRawDisplayHandle for Window

source§

impl HasRawWindowHandle for Window

source§

impl WindowExtWayland for Window

source§

fn wayland_surface(&self) -> Option<*mut c_void>

Returns a pointer to the wl_surface object of wayland that is used by this window. Read more
source§

fn wayland_display(&self) -> Option<*mut c_void>

Returns a pointer to the wl_display object of wayland that is used by this window. Read more
source§

impl WindowExtX11 for Window

source§

fn xcb_connection(&self) -> Option<*mut c_void>

This function returns the underlying xcb_connection_t of an xlib Display. Read more
source§

fn xlib_display(&self) -> Option<*mut c_void>

Returns a pointer to the Display object of xlib that is used by this window. Read more
source§

fn xlib_screen_id(&self) -> Option<c_int>

source§

fn xlib_window(&self) -> Option<c_ulong>

Returns the ID of the Window xlib object that is used by this window. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Window

§

impl Send for Window

§

impl Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> 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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.