From 5a056ce0510343621305474af74ade1db028c01a Mon Sep 17 00:00:00 2001 From: Night_Hunter Date: Wed, 12 Apr 2023 18:47:53 +1200 Subject: add action set icon while running (#1590) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * set windows icon live action * change get icon to insto raw * remove mobile docs * format * fix format * add file methods to Icon * Rename action to `ChangeIcon` and tidy up `Icon` modules * Fix documentation of `icon::Error` * Remove unnecessary `\` in `icon` documentation * Remove `etc.` from `Icon` documentation --------- Co-authored-by: Héctor Ramón Jiménez --- winit/src/window.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'winit/src/window.rs') diff --git a/winit/src/window.rs b/winit/src/window.rs index 961562bd..ba0180c8 100644 --- a/winit/src/window.rs +++ b/winit/src/window.rs @@ -2,7 +2,9 @@ use crate::command::{self, Command}; use iced_native::window; -pub use window::{frames, Event, Mode, RedrawRequest, UserAttention}; +pub use window::{ + frames, icon, Event, Icon, Mode, RedrawRequest, UserAttention, +}; /// Closes the current window and exits the application. pub fn close() -> Command { @@ -104,3 +106,8 @@ pub fn fetch_id( f, )))) } + +/// Changes the [`Icon`] of the window. +pub fn change_icon(icon: Icon) -> Command { + Command::single(command::Action::Window(window::Action::ChangeIcon(icon))) +} -- cgit