diff options
author | 2023-01-05 15:26:28 -0800 | |
---|---|---|
committer | 2023-01-09 11:28:07 -0800 | |
commit | ec41918ec40bddaba81235372f1566da59fd09f2 (patch) | |
tree | fb530943ccf14dfec3820bf65f71a9572fd3d8be /winit/src/window.rs | |
parent | 1944e98f82b7efd5b268e04ba5ced065e55a218e (diff) | |
download | iced-ec41918ec40bddaba81235372f1566da59fd09f2.tar.gz iced-ec41918ec40bddaba81235372f1566da59fd09f2.tar.bz2 iced-ec41918ec40bddaba81235372f1566da59fd09f2.zip |
Implemented window title update functionality for multiwindow.
Diffstat (limited to '')
-rw-r--r-- | winit/src/window.rs | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/winit/src/window.rs b/winit/src/window.rs index fba863ef..5a8ff6df 100644 --- a/winit/src/window.rs +++ b/winit/src/window.rs @@ -2,19 +2,19 @@ use crate::command::{self, Command}; use iced_native::window; -pub use window::{Id, Event, Mode, UserAttention}; +pub use window::{Event, Id, Mode, UserAttention}; -/// Closes the current window and exits the application. -pub fn close<Message>() -> Command<Message> { - Command::single(command::Action::Window(window::Action::Close)) +/// Closes the window. +pub fn close<Message>(id: window::Id) -> Command<Message> { + Command::single(command::Action::Window(id, window::Action::Close)) } /// Begins dragging the window while the left mouse button is held. -pub fn drag<Message>() -> Command<Message> { - Command::single(command::Action::Window(window::Action::Drag)) +pub fn drag<Message>(id: window::Id) -> Command<Message> { + Command::single(command::Action::Window(id, window::Action::Drag)) } -/// TODO(derezzedex) +/// Spawns a new window. pub fn spawn<Message>( id: window::Id, settings: window::Settings, @@ -25,11 +25,6 @@ pub fn spawn<Message>( )) } -/// TODO(derezzedex) -pub fn close<Message>(id: window::Id) -> Command<Message> { - Command::single(command::Action::Window(id, window::Action::Close)) -} - /// Resizes the window to the given logical dimensions. pub fn resize<Message>( id: window::Id, @@ -43,13 +38,19 @@ pub fn resize<Message>( } /// Sets the window to maximized or back. -pub fn maximize<Message>(value: bool) -> Command<Message> { - Command::single(command::Action::Window(window::Action::Maximize(value))) +pub fn maximize<Message>(id: window::Id, value: bool) -> Command<Message> { + Command::single(command::Action::Window( + id, + window::Action::Maximize(value), + )) } /// Set the window to minimized or back. -pub fn minimize<Message>(value: bool) -> Command<Message> { - Command::single(command::Action::Window(window::Action::Minimize(value))) +pub fn minimize<Message>(id: window::Id, value: bool) -> Command<Message> { + Command::single(command::Action::Window( + id, + window::Action::Minimize(value), + )) } /// Moves a window to the given logical coordinates. @@ -63,8 +64,8 @@ pub fn set_mode<Message>(id: window::Id, mode: Mode) -> Command<Message> { } /// Sets the window to maximized or back. -pub fn toggle_maximize<Message>() -> Command<Message> { - Command::single(command::Action::Window(window::Action::ToggleMaximize)) +pub fn toggle_maximize<Message>(id: window::Id) -> Command<Message> { + Command::single(command::Action::Window(id, window::Action::ToggleMaximize)) } /// Fetches the current [`Mode`] of the window. |