Add fetch_size helper to runtime::window
This commit is contained in:
parent
f43a272d7d
commit
f350a2f812
1 changed files with 7 additions and 0 deletions
|
|
@ -39,6 +39,13 @@ pub fn resize<Message>(new_size: Size<u32>) -> Command<Message> {
|
||||||
Command::single(command::Action::Window(Action::Resize(new_size)))
|
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.
|
/// Maximizes the window.
|
||||||
pub fn maximize<Message>(maximized: bool) -> Command<Message> {
|
pub fn maximize<Message>(maximized: bool) -> Command<Message> {
|
||||||
Command::single(command::Action::Window(Action::Maximize(maximized)))
|
Command::single(command::Action::Window(Action::Maximize(maximized)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue