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/action.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/action.rs')
-rw-r--r-- | runtime/src/window/action.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/runtime/src/window/action.rs b/runtime/src/window/action.rs index 2d98b607..8b532569 100644 --- a/runtime/src/window/action.rs +++ b/runtime/src/window/action.rs @@ -21,8 +21,19 @@ pub enum Action<T> { Resize(Id, Size), /// Fetch the current logical dimensions of the window. FetchSize(Id, Box<dyn FnOnce(Size) -> T + 'static>), + /// Fetch if the current window is maximized or not. + /// + /// ## Platform-specific + /// - **iOS / Android / Web:** Unsupported. + FetchMaximized(Id, Box<dyn FnOnce(bool) -> T + 'static>), /// Set the window to maximized or back Maximize(Id, bool), + /// Fetch if the current window is minimized or not. + /// + /// ## Platform-specific + /// - **Wayland:** Always `None`. + /// - **iOS / Android / Web:** Unsupported. + FetchMinimized(Id, Box<dyn FnOnce(Option<bool>) -> T + 'static>), /// Set the window to minimized or back Minimize(Id, bool), /// Move the window to the given logical coordinates. @@ -106,7 +117,13 @@ impl<T> Action<T> { Self::FetchSize(id, o) => { Action::FetchSize(id, Box::new(move |s| f(o(s)))) } + Self::FetchMaximized(id, o) => { + Action::FetchMaximized(id, Box::new(move |s| f(o(s)))) + } Self::Maximize(id, maximized) => Action::Maximize(id, maximized), + Self::FetchMinimized(id, o) => { + Action::FetchMinimized(id, Box::new(move |s| f(o(s)))) + } Self::Minimize(id, minimized) => Action::Minimize(id, minimized), Self::Move(id, position) => Action::Move(id, position), Self::ChangeMode(id, mode) => Action::ChangeMode(id, mode), @@ -144,9 +161,15 @@ impl<T> fmt::Debug for Action<T> { write!(f, "Action::Resize({id:?}, {size:?})") } Self::FetchSize(id, _) => write!(f, "Action::FetchSize({id:?})"), + Self::FetchMaximized(id, _) => { + write!(f, "Action::FetchMaximized({id:?})") + } Self::Maximize(id, maximized) => { write!(f, "Action::Maximize({id:?}, {maximized})") } + Self::FetchMinimized(id, _) => { + write!(f, "Action::FetchMinimized({id:?})") + } Self::Minimize(id, minimized) => { write!(f, "Action::Minimize({id:?}, {minimized}") } |