diff options
| author | 2023-07-06 06:44:09 +0200 | |
|---|---|---|
| committer | 2023-07-06 06:44:09 +0200 | |
| commit | f350a2f812487af9a43c36e28d9b904e76a66474 (patch) | |
| tree | 8126906e4bc1f52835448e679a2ca406ba1a3e02 /runtime | |
| parent | f43a272d7d201b39553f954183362ef42b31d11c (diff) | |
| download | iced-f350a2f812487af9a43c36e28d9b904e76a66474.tar.gz iced-f350a2f812487af9a43c36e28d9b904e76a66474.tar.bz2 iced-f350a2f812487af9a43c36e28d9b904e76a66474.zip | |
Add `fetch_size` helper to `runtime::window`
Diffstat (limited to '')
| -rw-r--r-- | runtime/src/window.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 094a713d..9356581a 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -39,6 +39,13 @@ pub fn resize<Message>(new_size: Size<u32>) -> Command<Message> { Command::single(command::Action::Window(Action::Resize(new_size))) } +/// Fetches the current window size in logical dimensions. +pub fn fetch_size<Message>( + f: impl FnOnce(Size<u32>) -> Message + 'static, +) -> Command<Message> { + Command::single(command::Action::Window(Action::FetchSize(Box::new(f)))) +} + /// Maximizes the window. pub fn maximize<Message>(maximized: bool) -> Command<Message> { Command::single(command::Action::Window(Action::Maximize(maximized))) |
