From f74ab463d44dd0bb025b0cea466d2861576253dd Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 29 Dec 2019 12:29:47 +0100 Subject: Add `background_color` to `Settings` --- src/settings.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index 62a1a614..8da8948c 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,7 +1,8 @@ //! Configure your application. +use crate::Color; /// The settings of an application. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +#[derive(Debug, Clone, Copy, PartialEq)] pub struct Settings { /// The [`Window`] settings. /// @@ -9,6 +10,20 @@ pub struct Settings { /// /// [`Window`]: struct.Window.html pub window: Window, + + /// The default background [`Color`] of the application + /// + /// [`Color`]: ../struct.Color.html + pub background_color: Color, +} + +impl Default for Settings { + fn default() -> Settings { + Settings { + window: Window::default(), + background_color: Color::WHITE, + } + } } /// The window settings of an application. @@ -44,6 +59,7 @@ impl From for iced_winit::Settings { decorations: settings.window.decorations, platform_specific: Default::default(), }, + background_color: settings.background_color, } } } -- cgit From 89a6b8a9a173e767753ec777fd83c912c1be5ea3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 29 Dec 2019 12:31:47 +0100 Subject: Rename `Settings::background_color` to `background` --- src/settings.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index 8da8948c..4ae18a14 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -14,14 +14,14 @@ pub struct Settings { /// The default background [`Color`] of the application /// /// [`Color`]: ../struct.Color.html - pub background_color: Color, + pub background: Color, } impl Default for Settings { fn default() -> Settings { Settings { window: Window::default(), - background_color: Color::WHITE, + background: Color::WHITE, } } } @@ -59,7 +59,7 @@ impl From for iced_winit::Settings { decorations: settings.window.decorations, platform_specific: Default::default(), }, - background_color: settings.background_color, + background: settings.background, } } } -- cgit From d96ced8e2da703117a43399110ef2b8fa21a7546 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 Jan 2020 17:49:48 +0100 Subject: Allow configuration of default font --- src/settings.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index 4ae18a14..b01e6fc8 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -15,6 +15,9 @@ pub struct Settings { /// /// [`Color`]: ../struct.Color.html pub background: Color, + + // TODO: Add `name` for web compatibility + pub default_font: Option<&'static [u8]>, } impl Default for Settings { @@ -22,6 +25,7 @@ impl Default for Settings { Settings { window: Window::default(), background: Color::WHITE, + default_font: None, } } } -- cgit From 8d6f86b317303c06a0daf1ca3ce91c29670dd674 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 5 Jan 2020 18:11:54 +0100 Subject: Remove `background` from `Settings` --- src/settings.rs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index b01e6fc8..b725ef9f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,5 +1,4 @@ //! Configure your application. -use crate::Color; /// The settings of an application. #[derive(Debug, Clone, Copy, PartialEq)] @@ -11,11 +10,6 @@ pub struct Settings { /// [`Window`]: struct.Window.html pub window: Window, - /// The default background [`Color`] of the application - /// - /// [`Color`]: ../struct.Color.html - pub background: Color, - // TODO: Add `name` for web compatibility pub default_font: Option<&'static [u8]>, } @@ -24,7 +18,6 @@ impl Default for Settings { fn default() -> Settings { Settings { window: Window::default(), - background: Color::WHITE, default_font: None, } } @@ -63,7 +56,6 @@ impl From for iced_winit::Settings { decorations: settings.window.decorations, platform_specific: Default::default(), }, - background: settings.background, } } } -- cgit From 7b278755fc7929633b5771824beac4d39b16e82e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 9 Jan 2020 18:31:07 +0100 Subject: Write missing docs and reenable deny statements --- src/settings.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index b725ef9f..e20edc97 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,7 +1,7 @@ //! Configure your application. /// The settings of an application. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct Settings { /// The [`Window`] settings. /// @@ -10,19 +10,13 @@ pub struct Settings { /// [`Window`]: struct.Window.html pub window: Window, + /// The bytes of the font that will be used by default. + /// + /// If `None` is provided, a default system font will be chosen. // TODO: Add `name` for web compatibility pub default_font: Option<&'static [u8]>, } -impl Default for Settings { - fn default() -> Settings { - Settings { - window: Window::default(), - default_font: None, - } - } -} - /// The window settings of an application. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Window { -- cgit