summaryrefslogtreecommitdiffstats
path: root/runtime/src/window.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-07-06 06:44:09 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-07-06 06:44:09 +0200
commitf350a2f812487af9a43c36e28d9b904e76a66474 (patch)
tree8126906e4bc1f52835448e679a2ca406ba1a3e02 /runtime/src/window.rs
parentf43a272d7d201b39553f954183362ef42b31d11c (diff)
downloadiced-f350a2f812487af9a43c36e28d9b904e76a66474.tar.gz
iced-f350a2f812487af9a43c36e28d9b904e76a66474.tar.bz2
iced-f350a2f812487af9a43c36e28d9b904e76a66474.zip
Add `fetch_size` helper to `runtime::window`
Diffstat (limited to 'runtime/src/window.rs')
-rw-r--r--runtime/src/window.rs7
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)))