From d53ccc857da4d4cda769904342aeb5a82a64f146 Mon Sep 17 00:00:00 2001 From: Bingus Date: Wed, 12 Jul 2023 19:21:05 -0700 Subject: refactored window storage; new helper window events (Destroyed, Created); clippy + fmt; --- src/settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index 0dd46584..4ce2d135 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -91,7 +91,7 @@ impl From> for iced_winit::Settings { fn from(settings: Settings) -> iced_winit::Settings { iced_winit::Settings { id: settings.id, - window: settings.window.into(), + window: settings.window, flags: settings.flags, exit_on_close_request: settings.exit_on_close_request, } -- cgit From 83c7870c569a2976923ee6243a19813094d44673 Mon Sep 17 00:00:00 2001 From: Bingus Date: Mon, 24 Jul 2023 14:32:59 -0700 Subject: Moved `exit_on_close_request` to window settings. This now controls whether each INDIVIDUAL window should close on CloseRequested events. --- src/settings.rs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index 4ce2d135..e2a43581 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -41,14 +41,6 @@ pub struct Settings { /// /// [`Canvas`]: crate::widget::Canvas pub antialiasing: bool, - - /// Whether the [`Application`] should exit when the user requests the - /// window to close (e.g. the user presses the close button). - /// - /// By default, it is enabled. - /// - /// [`Application`]: crate::Application - pub exit_on_close_request: bool, } impl Settings { @@ -65,7 +57,6 @@ impl Settings { default_font: default_settings.default_font, default_text_size: default_settings.default_text_size, antialiasing: default_settings.antialiasing, - exit_on_close_request: default_settings.exit_on_close_request, } } } @@ -82,7 +73,6 @@ where default_font: Default::default(), default_text_size: 16.0, antialiasing: false, - exit_on_close_request: true, } } } @@ -93,7 +83,6 @@ impl From> for iced_winit::Settings { id: settings.id, window: settings.window, flags: settings.flags, - exit_on_close_request: settings.exit_on_close_request, } } } -- cgit From e7326f0af6f16cf2ff04fbac93bf296a044923f4 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 18 Sep 2023 19:07:41 +0200 Subject: Flesh out the `editor` example a bit more --- src/settings.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index d9778d7e..6b9ce095 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -2,6 +2,8 @@ use crate::window; use crate::{Font, Pixels}; +use std::borrow::Cow; + /// The settings of an application. #[derive(Debug, Clone)] pub struct Settings { @@ -21,6 +23,9 @@ pub struct Settings { /// [`Application`]: crate::Application pub flags: Flags, + /// The fonts to load on boot. + pub fonts: Vec>, + /// The default [`Font`] to be used. /// /// By default, it uses [`Family::SansSerif`](crate::font::Family::SansSerif). @@ -62,6 +67,7 @@ impl Settings { flags, id: default_settings.id, window: default_settings.window, + fonts: default_settings.fonts, default_font: default_settings.default_font, default_text_size: default_settings.default_text_size, antialiasing: default_settings.antialiasing, @@ -79,6 +85,7 @@ where id: None, window: Default::default(), flags: Default::default(), + fonts: Default::default(), default_font: Default::default(), default_text_size: Pixels(16.0), antialiasing: false, @@ -93,6 +100,7 @@ impl From> for iced_winit::Settings { id: settings.id, window: settings.window.into(), flags: settings.flags, + fonts: settings.fonts, exit_on_close_request: settings.exit_on_close_request, } } -- cgit