summaryrefslogtreecommitdiffstats
path: root/core/src/window
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-05-10 22:28:08 +0200
committerLibravatar GitHub <noreply@github.com>2024-05-10 22:28:08 +0200
commitfa458a3009c3644300bf9475fcf8d46a67d194c6 (patch)
tree87edb02b3a3485faf526734ab1a715df0a9801a2 /core/src/window
parent718fe5b7de6c705b1797c49d382182182acdbe80 (diff)
parentb19e95fa1844ca726aa5761f2d331fd780854bc6 (diff)
downloadiced-fa458a3009c3644300bf9475fcf8d46a67d194c6.tar.gz
iced-fa458a3009c3644300bf9475fcf8d46a67d194c6.tar.bz2
iced-fa458a3009c3644300bf9475fcf8d46a67d194c6.zip
Merge pull request #2435 from iced-rs/window/specific-with-position
Add `SpecificWith` variant to `window::Position`
Diffstat (limited to 'core/src/window')
-rw-r--r--core/src/window/position.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/src/window/position.rs b/core/src/window/position.rs
index 73391e75..1c8e86b6 100644
--- a/core/src/window/position.rs
+++ b/core/src/window/position.rs
@@ -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 {