use iced::window;
use iced::Task;
use iced_core::window::Mode;
use iced_runtime::{task, Action};
use std::future::Future;
pub fn batch<X: Send + 'static + Into<Y>, Y: Send + 'static>(
commands: impl IntoIterator<Item = Task<X>>,
) -> Task<Y> {
Task::batch(commands).map(Into::into)
}
pub fn future<X: Into<Y>, Y: 'static>(future: impl Future<Output = X> + Send + 'static) -> Task<Y> {
Task::future(async move { future.await.into() })
}
pub fn message<X: Send + 'static + Into<Y>, Y: 'static>(message: X) -> Task<Y> {
future(async move { message.into() })
}
pub fn drag<M>(id: window::Id) -> Task<M> {
iced_runtime::window::drag(id)
}
pub fn maximize<M>(id: window::Id, maximized: bool) -> Task<M> {
iced_runtime::window::maximize(id, maximized)
}
pub fn minimize<M>(id: window::Id) -> Task<M> {
iced_runtime::window::minimize(id, true)
}
#[allow(unused_variables, clippy::needless_pass_by_value)]
pub fn set_title<M>(id: window::Id, title: String) -> Task<M> {
Task::none()
}
pub fn set_windowed<M>(id: window::Id) -> Task<M> {
iced_runtime::window::change_mode(id, Mode::Windowed)
}
pub fn toggle_maximize<M>(id: window::Id) -> Task<M> {
iced_runtime::window::toggle_maximize(id)
}