iced_core/window/position.rs
1use crate::{Point, Size};
2
3/// The position of a window in a given screen.
4#[derive(Debug, Clone, Copy, PartialEq)]
5pub enum Position {
6 /// The platform-specific default position for a new window.
7 Default,
8 /// The window is completely centered on the screen.
9 Centered,
10 /// The window is positioned with specific coordinates: `(X, Y)`.
11 ///
12 /// When the decorations of the window are enabled, Windows 10 will add some
13 /// invisible padding to the window. This padding gets included in the
14 /// position. So if you have decorations enabled and want the window to be
15 /// at (0, 0) you would have to set the position to
16 /// `(PADDING_X, PADDING_Y)`.
17 Specific(Point),
18 /// Like [`Specific`], but the window is positioned with the specific coordinates returned by the function.
19 ///
20 /// The function receives the window size and the monitor's resolution as input.
21 ///
22 /// [`Specific`]: Self::Specific
23 SpecificWith(fn(Size, Size) -> Point),
24}
25
26impl Default for Position {
27 fn default() -> Self {
28 Self::Default
29 }
30}