diff options
author | 2024-02-22 17:13:12 +1300 | |
---|---|---|
committer | 2024-02-22 09:16:05 +0100 | |
commit | 59885e9a363dd73b3a3e8dd125decf0e34130c59 (patch) | |
tree | 01eb049c55c514d5455cd8569a0fb4360adb6146 /runtime/src/window.rs | |
parent | 6c00e615b9fb7618c710a3f5d920d00e6b8a258c (diff) | |
download | iced-59885e9a363dd73b3a3e8dd125decf0e34130c59.tar.gz iced-59885e9a363dd73b3a3e8dd125decf0e34130c59.tar.bz2 iced-59885e9a363dd73b3a3e8dd125decf0e34130c59.zip |
Add `fetch_location` command to `window` module
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..c5acfddc 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -106,6 +106,17 @@ pub fn move_to<Message>(id: Id, position: Point) -> Command<Message> { Command::single(command::Action::Window(Action::Move(id, position))) } +/// Fetches the window's location in logical coordinates. +pub fn fetch_location<Message>( + id: Id, + f: impl FnOnce(Option<Point>) -> Message + 'static, +) -> Command<Message> { + Command::single(command::Action::Window(Action::FetchLocation( + id, + Box::new(f), + ))) +} + /// Changes the [`Mode`] of the window. pub fn change_mode<Message>(id: Id, mode: Mode) -> Command<Message> { Command::single(command::Action::Window(Action::ChangeMode(id, mode))) |