Struct WindowId
pub struct WindowId(/* private fields */);
Expand description
Identifier of a window. Unique for each window.
Can be obtained with window.id()
.
Whenever you receive an event specific to a window, this event contains a WindowId
which you
can then compare to the ids of your windows.
Implementations§
§impl WindowId
impl WindowId
pub const unsafe fn dummy() -> WindowId
pub const unsafe fn dummy() -> WindowId
Returns a dummy id, useful for unit testing.
§Safety
The only guarantee made about the return value of this function is that
it will always be equal to itself and to future values returned by this function.
No other guarantees are made. This may be equal to a real WindowId
.
Passing this into a winit function will result in undefined behavior.
Trait Implementations§
§impl Ord for WindowId
impl Ord for WindowId
§impl PartialOrd for WindowId
impl PartialOrd for WindowId
Source§impl WindowIdExt for WindowId
impl WindowIdExt for WindowId
Source§fn bounds_on_screen_including_frame(&self) -> Option<Rect>
fn bounds_on_screen_including_frame(&self) -> Option<Rect>
Get the bounds of the content of this window, including
titlebar and native window borders.
Source§fn bounds_of_content_on_screen(&self) -> Option<Rect>
fn bounds_of_content_on_screen(&self) -> Option<Rect>
Get the bounds of the content of this window, excluding
titlebar and native window borders.
Source§fn position_on_screen_including_frame(&self) -> Option<Point>
fn position_on_screen_including_frame(&self) -> Option<Point>
Get the location of the window including any OS titlebar.
Source§fn position_of_content_on_screen(&self) -> Option<Point>
fn position_of_content_on_screen(&self) -> Option<Point>
Get the location of the window’s content on the monitor where
it currently resides, excluding any OS titlebar.
Source§fn monitor_bounds(&self) -> Option<Rect>
fn monitor_bounds(&self) -> Option<Rect>
Get the logical bounds of the monitor this window is on.
Source§fn is_visible(&self) -> bool
fn is_visible(&self) -> bool
Determine if this window is currently visible. Note that if a
call to set a window visible which is invisible has happened within
the current event loop cycle, the state returned will not reflect that.
Source§fn is_minimized(&self) -> bool
fn is_minimized(&self) -> bool
Determine if this window is currently minimized. Note that if a
call to minimize or unminimize this window, and it is currently in the
opposite state, has happened the current event loop cycle, the state
returned will not reflect that.
Source§fn is_maximized(&self) -> bool
fn is_maximized(&self) -> bool
Determine if this window is currently maximize. Note that if a
call to maximize or unmaximize this window, and it is currently in the
opposite state, has happened the current event loop cycle, the state
returned will not reflect that.
Source§fn is_document_edited(&self) -> bool
fn is_document_edited(&self) -> bool
Determine if the window decorations should indicate an edited, unsaved
document. Platform-dependent: Will only ever return
true
on macOS.Source§fn force_repaint(&self) -> bool
fn force_repaint(&self) -> bool
Force a repaint of this window through the native window’s repaint mechanism,
bypassing floem’s normal repaint mechanism. Read more
Source§fn screen_layout(&self) -> Option<ScreenLayout>
fn screen_layout(&self) -> Option<ScreenLayout>
Get a layout of this window in relation to the monitor on which it currently
resides, if any.
Source§fn scale(&self) -> f64
fn scale(&self) -> f64
Get the dots-per-inch scaling of this window or 1.0 if the platform does not
support it (Android).
Source§fn set_document_edited(&self, edited: bool)
fn set_document_edited(&self, edited: bool)
Instruct the window manager to indicate in the window’s decorations
that the window contains an unsaved, edited document. Only has an
effect on macOS.
Source§fn set_visible(&self, visible: bool)
fn set_visible(&self, visible: bool)
Set this window’s visible state, hiding or showing it if it has been
hidden
Source§fn set_window_inner_bounds(&self, bounds: Rect)
fn set_window_inner_bounds(&self, bounds: Rect)
Update the bounds of this window.
Source§fn set_window_outer_bounds(&self, bounds: Rect)
fn set_window_outer_bounds(&self, bounds: Rect)
Update the bounds of this window.
Source§fn set_outer_location(&self, location: Point)
fn set_outer_location(&self, location: Point)
Change this window’s minimized state.
Source§fn set_content_size(&self, size: Size)
fn set_content_size(&self, size: Size)
Ask the OS’s windowing framework to update the size of the window
based on the passed size for its content (excluding titlebar, frame
or other decorations).
Source§fn request_attention(&self, urgency: Urgency)
fn request_attention(&self, urgency: Urgency)
Cause the desktop to perform some attention-drawing behavior that draws
the user’s attention specifically to this window - e.g. bouncing in
the dock on macOS. On X11, after calling this method with some urgency
other than
None
, it is necessary to clear the attention-seeking state
by calling this method again with Urgency::None
.impl Copy for WindowId
impl Eq for WindowId
impl StructuralPartialEq for WindowId
Auto Trait Implementations§
impl Freeze for WindowId
impl RefUnwindSafe for WindowId
impl Send for WindowId
impl Sync for WindowId
impl Unpin for WindowId
impl UnwindSafe for WindowId
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more