window resizable task
This commit is contained in:
parent
8ebbfa9767
commit
f5f075e5cd
2 changed files with 13 additions and 0 deletions
|
|
@ -164,6 +164,9 @@ pub enum Action {
|
|||
|
||||
/// Set the maximum inner window size.
|
||||
SetMaxSize(Id, Option<Size>),
|
||||
|
||||
/// Set the window to be resizable or not.
|
||||
SetResizable(Id, bool),
|
||||
}
|
||||
|
||||
/// Subscribes to the frames of the window of the running application.
|
||||
|
|
@ -274,6 +277,11 @@ pub fn resize<T>(id: Id, new_size: Size) -> Task<T> {
|
|||
task::effect(crate::Action::Window(Action::Resize(id, new_size)))
|
||||
}
|
||||
|
||||
/// Set the window to be resizable or not.
|
||||
pub fn resizable<T>(id: Id, resizable: bool) -> Task<T> {
|
||||
task::effect(crate::Action::Window(Action::SetResizable(id, resizable)))
|
||||
}
|
||||
|
||||
/// Get the window's size in logical dimensions.
|
||||
pub fn get_size(id: Id) -> Task<Size> {
|
||||
task::oneshot(move |channel| {
|
||||
|
|
|
|||
|
|
@ -1316,6 +1316,11 @@ fn run_action<P, C>(
|
|||
window.raw.set_title(&title);
|
||||
}
|
||||
}
|
||||
window::Action::SetResizable(id, resizable) => {
|
||||
if let Some(window) = window_manager.get_mut(id) {
|
||||
window.raw.set_resizable(resizable);
|
||||
}
|
||||
}
|
||||
window::Action::GetSize(id, channel) => {
|
||||
if let Some(window) = window_manager.get_mut(id) {
|
||||
let size = window
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue