Add SpecificWith variant to window::Position

This commit is contained in:
Héctor Ramón Jiménez 2024-05-10 22:16:35 +02:00
parent 718fe5b7de
commit b19e95fa18
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 36 additions and 1 deletions

View file

@ -1,4 +1,4 @@
use crate::Point;
use crate::{Point, Size};
/// The position of a window in a given screen.
#[derive(Debug, Clone, Copy, PartialEq)]
@ -15,6 +15,12 @@ pub enum Position {
/// at (0, 0) you would have to set the position to
/// `(PADDING_X, PADDING_Y)`.
Specific(Point),
/// Like [`Specific`], but the window is positioned with the specific coordinates returned by the function.
///
/// The function receives the window size and the monitor's resolution as input.
///
/// [`Specific`]: Self::Specific
SpecificWith(fn(Size, Size) -> Point),
}
impl Default for Position {