diff options
author | 2024-02-22 09:33:13 +0100 | |
---|---|---|
committer | 2024-02-22 09:33:13 +0100 | |
commit | a27267b8fbd7cfc1033c1ca9aff9a57ae57f0030 (patch) | |
tree | 4ef2366666b5df94a5dde191088c7d7385a1c788 /runtime/src/window.rs | |
parent | ce4eef64cdde5f3e5809c963a1d84c933d27e7ae (diff) | |
parent | 9339728b6863523152fc40dd86fb78d1461c2b40 (diff) | |
download | iced-a27267b8fbd7cfc1033c1ca9aff9a57ae57f0030.tar.gz iced-a27267b8fbd7cfc1033c1ca9aff9a57ae57f0030.tar.bz2 iced-a27267b8fbd7cfc1033c1ca9aff9a57ae57f0030.zip |
Merge pull request #2280 from n1ght-hunter/add-action-fetch-location
add fetch_location action
Diffstat (limited to 'runtime/src/window.rs')
-rw-r--r-- | runtime/src/window.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 04bcfcd8..24171e3e 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -101,6 +101,17 @@ pub fn minimize<Message>(id: Id, minimized: bool) -> Command<Message> { Command::single(command::Action::Window(Action::Minimize(id, minimized))) } +/// Fetches the current window position in logical coordinates. +pub fn fetch_position<Message>( + id: Id, + f: impl FnOnce(Option<Point>) -> Message + 'static, +) -> Command<Message> { + Command::single(command::Action::Window(Action::FetchPosition( + id, + Box::new(f), + ))) +} + /// Moves the window to the given logical coordinates. pub fn move_to<Message>(id: Id, position: Point) -> Command<Message> { Command::single(command::Action::Window(Action::Move(id, position))) |