diff options
author | 2024-01-09 23:29:00 +0100 | |
---|---|---|
committer | 2024-01-09 23:29:00 +0100 | |
commit | 90332acc4b18d7ea539459908b4e59517d8b48cb (patch) | |
tree | 7ce0ebd0f741a74ac11e7a5f45a4aad9e8f0f693 /runtime/src/window.rs | |
parent | f5c6fa7338713a0430dcdfc5bd53f72103144f22 (diff) | |
parent | 082985ade8a108aa3ec1fe573411120b82da0cad (diff) | |
download | iced-90332acc4b18d7ea539459908b4e59517d8b48cb.tar.gz iced-90332acc4b18d7ea539459908b4e59517d8b48cb.tar.bz2 iced-90332acc4b18d7ea539459908b4e59517d8b48cb.zip |
Merge pull request #2189 from Calastrophe/master
Add functions to fetch if a window is maximized or minimized
Diffstat (limited to 'runtime/src/window.rs')
-rw-r--r-- | runtime/src/window.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index f9d943f6..2136d64d 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -65,11 +65,33 @@ pub fn fetch_size<Message>( Command::single(command::Action::Window(Action::FetchSize(id, Box::new(f)))) } +/// Fetches if the window is maximized. +pub fn fetch_maximized<Message>( + id: Id, + f: impl FnOnce(bool) -> Message + 'static, +) -> Command<Message> { + Command::single(command::Action::Window(Action::FetchMaximized( + id, + Box::new(f), + ))) +} + /// Maximizes the window. pub fn maximize<Message>(id: Id, maximized: bool) -> Command<Message> { Command::single(command::Action::Window(Action::Maximize(id, maximized))) } +/// Fetches if the window is minimized. +pub fn fetch_minimized<Message>( + id: Id, + f: impl FnOnce(Option<bool>) -> Message + 'static, +) -> Command<Message> { + Command::single(command::Action::Window(Action::FetchMinimized( + id, + Box::new(f), + ))) +} + /// Minimizes the window. pub fn minimize<Message>(id: Id, minimized: bool) -> Command<Message> { Command::single(command::Action::Window(Action::Minimize(id, minimized))) |