Struct Window

Source
pub struct Window<TS: ThreadSafety> { /* private fields */ }
Expand description

A window.

Implementations§

Source§

impl<TS: ThreadSafety> Window<TS>

Source

pub async fn new() -> Result<Window<TS>, 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<TS: ThreadSafety> Window<TS>

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<TS: ThreadSafety> Window<TS>

Waiting for events.

Source

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

Get the handler for the RedrawRequested event.

Source

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

Get the handler for the CloseRequested event.

Source

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

Get the handler for the Resized event.

Source

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

Get the handler for the Moved event.

Source

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

Get handler for the Destroyed event.

Source

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

Get the handler for the Focused event.

Source

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

Get the handler for the KeyboardInput event.

Source

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

Get the handler for the ModifiersChanged event.

Source

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

Get the handler for the ReceivedCharacter event.

Source

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

Get the handler for the Ime event.

Source

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

Get the handler for the CursorMoved event.

Source

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

Get the handler for the CursorEntered event.

Source

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

Get the handler for the CursorLeft event.

Source

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

Get the handle for the MouseWheel event.

Source

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

Get the handle for the MouseInput event.

Source

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

Get the handle for the TouchpadMagnify event.

Source

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

Get the handle for the TouchpadPressure event.

Source

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

Get the handle for the Touch event.

Source

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

Get the handle for the ScaleFactorChanged event.

Source

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

Get the handle for the TouchpadRotate event.

Source

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

Get the handle for the SmartMagnify event.

Source

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

Get the handle for the AxisMotion event.

Source

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

Get the handle for the ThemeChanged event.

Source

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

Get the handle for the Occulded event.

Trait Implementations§

Source§

impl<TS: Clone + ThreadSafety> Clone for Window<TS>
where TS::Rc<Window>: Clone, TS::Rc<Registration<TS>>: Clone, TS::Rc<Reactor<TS>>: Clone,

Source§

fn clone(&self) -> Window<TS>

Returns a duplicate 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<TS: ThreadSafety> Drop for Window<TS>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<TS: ThreadSafety> HasRawDisplayHandle for Window<TS>

Source§

impl<TS: ThreadSafety> HasRawWindowHandle for Window<TS>

Source§

impl<TS: ThreadSafety> WindowExtWayland for Window<TS>

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<TS: ThreadSafety> WindowExtX11 for Window<TS>

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<TS> Freeze for Window<TS>
where <TS as __ThreadSafety>::Rc<Window>: Freeze, <TS as __ThreadSafety>::Rc<Registration<TS>>: Freeze, <TS as __ThreadSafety>::Rc<Reactor<TS>>: Freeze,

§

impl<TS> RefUnwindSafe for Window<TS>
where <TS as __ThreadSafety>::Rc<Window>: RefUnwindSafe, <TS as __ThreadSafety>::Rc<Registration<TS>>: RefUnwindSafe, <TS as __ThreadSafety>::Rc<Reactor<TS>>: RefUnwindSafe,

§

impl<TS> Send for Window<TS>
where <TS as __ThreadSafety>::Rc<Window>: Send, <TS as __ThreadSafety>::Rc<Registration<TS>>: Send, <TS as __ThreadSafety>::Rc<Reactor<TS>>: Send,

§

impl<TS> Sync for Window<TS>
where <TS as __ThreadSafety>::Rc<Window>: Sync, <TS as __ThreadSafety>::Rc<Registration<TS>>: Sync, <TS as __ThreadSafety>::Rc<Reactor<TS>>: Sync,

§

impl<TS> Unpin for Window<TS>
where <TS as __ThreadSafety>::Rc<Window>: Unpin, <TS as __ThreadSafety>::Rc<Registration<TS>>: Unpin, <TS as __ThreadSafety>::Rc<Reactor<TS>>: Unpin,

§

impl<TS> UnwindSafe for Window<TS>
where <TS as __ThreadSafety>::Rc<Window>: UnwindSafe, <TS as __ThreadSafety>::Rc<Registration<TS>>: UnwindSafe, <TS as __ThreadSafety>::Rc<Reactor<TS>>: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Event for T
where T: Clone + 'static,

Source§

type Clonable = T

Source§

type Unique<'a> = T

Source§

fn downgrade(unique: &mut <T as Event>::Unique<'_>) -> <T as Event>::Clonable

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> ToOwned for T
where T: Clone,

Source§

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 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.