pub enum WindowPosition {
Center,
CenterOnDisplay(DisplayId),
TrayCenter(Bounds<Pixels>),
TrayAnchored(TrayAnchor),
TopRight {
margin: Pixels,
},
BottomRight {
margin: Pixels,
},
TopLeft {
margin: Pixels,
},
BottomLeft {
margin: Pixels,
},
}Expand description
A semantic window position for positioning windows relative to the screen.
Variants§
Center
Center the window on the primary display.
CenterOnDisplay(DisplayId)
Center the window on the given display.
TrayCenter(Bounds<Pixels>)
Use WindowPosition::TrayAnchored(TrayAnchor) instead; the new variant carries display_id and fixes multi-monitor placement. This variant will be removed in a future release.
Center the window above the tray icon area.
Deprecated: this variant only carries the tray icon bounds and does
not know which display the tray is on, which causes window placement
to be off on multi-monitor setups. Prefer WindowPosition::TrayAnchored,
which carries a full TrayAnchor (including display_id).
TrayAnchored(TrayAnchor)
Center the window above the tray icon area, using a full TrayAnchor.
The TrayAnchor carries both the tray icon bounds (display-local,
top-left origin) and the display_id it resides on. Callers should
also propagate display_id to WindowOptions.display_id so the
window is opened on the correct screen in multi-monitor setups.
TopRight
Position the window in the top-right corner.
BottomRight
Position the window in the bottom-right corner.
TopLeft
Position the window in the top-left corner.
BottomLeft
Position the window in the bottom-left corner.
Trait Implementations§
Source§impl Clone for WindowPosition
impl Clone for WindowPosition
Source§impl Debug for WindowPosition
impl Debug for WindowPosition
Source§impl PartialEq for WindowPosition
impl PartialEq for WindowPosition
impl StructuralPartialEq for WindowPosition
Auto Trait Implementations§
impl Freeze for WindowPosition
impl RefUnwindSafe for WindowPosition
impl Send for WindowPosition
impl Sync for WindowPosition
impl Unpin for WindowPosition
impl UnsafeUnpin for WindowPosition
impl UnwindSafe for WindowPosition
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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