use crate::command::{self, Command};
use iced_native::window;
pub use window::{frames, Event, Mode, RedrawRequest, UserAttention};
pub fn close<Message>() -> Command<Message> {
Command::single(command::Action::Window(window::Action::Close))
}
pub fn drag<Message>() -> Command<Message> {
Command::single(command::Action::Window(window::Action::Drag))
}
pub fn resize<Message>(width: u32, height: u32) -> Command<Message> {
Command::single(command::Action::Window(window::Action::Resize {
width,
height,
}))
}
pub fn maximize<Message>(value: bool) -> Command<Message> {
Command::single(command::Action::Window(window::Action::Maximize(value)))
}
pub fn minimize<Message>(value: bool) -> Command<Message> {
Command::single(command::Action::Window(window::Action::Minimize(value)))
}
pub fn move_to<Message>(x: i32, y: i32) -> Command<Message> {
Command::single(command::Action::Window(window::Action::Move { x, y }))
}
pub fn set_mode<Message>(mode: Mode) -> Command<Message> {
Command::single(command::Action::Window(window::Action::SetMode(mode)))
}
pub fn toggle_maximize<Message>() -> Command<Message> {
Command::single(command::Action::Window(window::Action::ToggleMaximize))
}
pub fn fetch_mode<Message>(
f: impl FnOnce(Mode) -> Message + 'static,
) -> Command<Message> {
Command::single(command::Action::Window(window::Action::FetchMode(
Box::new(f),
)))
}