diff options
author | 2024-10-11 12:10:30 +0200 | |
---|---|---|
committer | 2025-01-06 23:20:51 +0100 | |
commit | 8ebbfa9767bcb8f8efd43cc1c7d40e9c61f6c461 (patch) | |
tree | 178afbae13d5fd458542b3e2a9457f0268189a84 /runtime | |
parent | ca8aaf9b8daa3d8b925165fb912af425438d4e79 (diff) | |
download | iced-8ebbfa9767bcb8f8efd43cc1c7d40e9c61f6c461.tar.gz iced-8ebbfa9767bcb8f8efd43cc1c7d40e9c61f6c461.tar.bz2 iced-8ebbfa9767bcb8f8efd43cc1c7d40e9c61f6c461.zip |
window tasks for setting min and max size
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/src/window.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index b5c6ee50..598ee491 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -158,6 +158,12 @@ pub enum Action { /// This enables mouse events for the window and stops mouse events /// from being passed to whatever is underneath. DisableMousePassthrough(Id), + + /// Set the minimum inner window size. + SetMinSize(Id, Option<Size>), + + /// Set the maximum inner window size. + SetMaxSize(Id, Option<Size>), } /// Subscribes to the frames of the window of the running application. @@ -376,6 +382,16 @@ pub fn change_title<T>(id: Id, title: String) -> Task<T> { task::effect(crate::Action::Window(Action::ChangeTitle(id, title))) } +/// Set the inner maximum size of the window. +pub fn set_max_size<T>(id: Id, size: Option<Size>) -> Task<T> { + task::effect(crate::Action::Window(Action::SetMaxSize(id, size))) +} + +/// Set the inner minimum size of the window. +pub fn set_min_size<T>(id: Id, size: Option<Size>) -> Task<T> { + task::effect(crate::Action::Window(Action::SetMinSize(id, size))) +} + /// Show the [system menu] at cursor position. /// /// [system menu]: https://en.wikipedia.org/wiki/Common_menus_in_Microsoft_Windows#System_menu |