diff options
Diffstat (limited to 'native/src/window/action.rs')
-rw-r--r-- | native/src/window/action.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/native/src/window/action.rs b/native/src/window/action.rs index 37fcc273..929663ec 100644 --- a/native/src/window/action.rs +++ b/native/src/window/action.rs @@ -1,4 +1,4 @@ -use crate::window::{Mode, UserAttention}; +use crate::window; use iced_futures::MaybeSend; use std::fmt; @@ -13,6 +13,11 @@ pub enum Action<T> { /// There’s no guarantee that this will work unless the left mouse /// button was pressed immediately before this function is called. Drag, + /// Spawns a new window with the provided [`window::Settings`]. + Spawn { + /// The settings of the [`Window`]. + settings: window::Settings, + }, /// Resize the window. Resize { /// The new logical width of the window @@ -34,9 +39,9 @@ pub enum Action<T> { y: i32, }, /// Set the [`Mode`] of the window. - SetMode(Mode), + SetMode(window::Mode), /// Fetch the current [`Mode`] of the window. - FetchMode(Box<dyn FnOnce(Mode) -> T + 'static>), + FetchMode(Box<dyn FnOnce(window::Mode) -> T + 'static>), /// Sets the window to maximized or back ToggleMaximize, /// Toggles whether window has decorations @@ -57,7 +62,7 @@ pub enum Action<T> { /// - **macOS:** `None` has no effect. /// - **X11:** Requests for user attention must be manually cleared. /// - **Wayland:** Requires `xdg_activation_v1` protocol, `None` has no effect. - RequestUserAttention(Option<UserAttention>), + RequestUserAttention(Option<window::UserAttention>), /// Brings the window to the front and sets input focus. Has no effect if the window is /// already in focus, minimized, or not visible. /// @@ -81,6 +86,7 @@ impl<T> Action<T> { T: 'static, { match self { + Self::Spawn { settings } => Action::Spawn { settings }, Self::Close => Action::Close, Self::Drag => Action::Drag, Self::Resize { width, height } => Action::Resize { width, height }, @@ -104,6 +110,9 @@ impl<T> fmt::Debug for Action<T> { match self { Self::Close => write!(f, "Action::Close"), Self::Drag => write!(f, "Action::Drag"), + Self::Spawn { settings } => { + write!(f, "Action::Spawn {{ settings: {:?} }}", settings) + } Self::Resize { width, height } => write!( f, "Action::Resize {{ widget: {}, height: {} }}", |