diff options
author | 2023-03-17 20:17:23 +0100 | |
---|---|---|
committer | 2023-03-17 20:17:23 +0100 | |
commit | d1dc62ebcdab6ec57605d276a02d6dae1e97c30d (patch) | |
tree | 66ab2733d426b887731ba32b32c03a0f1ba43451 | |
parent | ea50ec8df1431c9c6aa8077cd1578c4698dc0314 (diff) | |
parent | d7fffaa801423ae989fa7693f5b1cb424194e1ff (diff) | |
download | iced-d1dc62ebcdab6ec57605d276a02d6dae1e97c30d.tar.gz iced-d1dc62ebcdab6ec57605d276a02d6dae1e97c30d.tar.bz2 iced-d1dc62ebcdab6ec57605d276a02d6dae1e97c30d.zip |
Merge branch 'master' into advanced-text
Diffstat (limited to '')
-rw-r--r-- | core/src/mouse/interaction.rs | 9 | ||||
-rw-r--r-- | examples/checkbox/README.md | 2 | ||||
-rw-r--r-- | examples/pick_list/src/main.rs | 9 | ||||
-rw-r--r-- | examples/todos/src/main.rs | 11 | ||||
-rw-r--r-- | graphics/src/geometry/stroke.rs | 18 | ||||
-rw-r--r-- | src/window.rs | 2 | ||||
-rw-r--r-- | src/window/settings.rs | 8 |
7 files changed, 21 insertions, 38 deletions
diff --git a/core/src/mouse/interaction.rs b/core/src/mouse/interaction.rs index 664147a7..57da93fe 100644 --- a/core/src/mouse/interaction.rs +++ b/core/src/mouse/interaction.rs @@ -1,7 +1,8 @@ /// The interaction of a mouse cursor. -#[derive(Debug, Eq, PartialEq, Clone, Copy, PartialOrd, Ord)] +#[derive(Debug, Eq, PartialEq, Clone, Copy, PartialOrd, Ord, Default)] #[allow(missing_docs)] pub enum Interaction { + #[default] Idle, Pointer, Grab, @@ -12,9 +13,3 @@ pub enum Interaction { ResizingHorizontally, ResizingVertically, } - -impl Default for Interaction { - fn default() -> Interaction { - Interaction::Idle - } -} diff --git a/examples/checkbox/README.md b/examples/checkbox/README.md index b7f85684..76e6764c 100644 --- a/examples/checkbox/README.md +++ b/examples/checkbox/README.md @@ -6,7 +6,7 @@ The __[`main`]__ file contains all the code of the example. You can run it with `cargo run`: ``` -cargo run --package pick_list +cargo run --package checkbox ``` [`main`]: src/main.rs diff --git a/examples/pick_list/src/main.rs b/examples/pick_list/src/main.rs index 62a4ef88..21200621 100644 --- a/examples/pick_list/src/main.rs +++ b/examples/pick_list/src/main.rs @@ -61,8 +61,9 @@ impl Sandbox for Example { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub enum Language { + #[default] Rust, Elm, Ruby, @@ -84,12 +85,6 @@ impl Language { ]; } -impl Default for Language { - fn default() -> Language { - Language::Rust - } -} - impl std::fmt::Display for Language { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 1cc18eca..48b4f2f8 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -440,19 +440,16 @@ fn view_controls(tasks: &[Task], current_filter: Filter) -> Element<Message> { .into() } -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[derive( + Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, +)] pub enum Filter { + #[default] All, Active, Completed, } -impl Default for Filter { - fn default() -> Self { - Filter::All - } -} - impl Filter { fn matches(&self, task: &Task) -> bool { match self { diff --git a/graphics/src/geometry/stroke.rs b/graphics/src/geometry/stroke.rs index 2d760a6c..69a76e1c 100644 --- a/graphics/src/geometry/stroke.rs +++ b/graphics/src/geometry/stroke.rs @@ -59,9 +59,10 @@ impl<'a> Default for Stroke<'a> { } /// The shape used at the end of open subpaths when they are stroked. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)] pub enum LineCap { /// The stroke for each sub-path does not extend beyond its two endpoints. + #[default] Butt, /// At the end of each sub-path, the shape representing the stroke will be /// extended by a square. @@ -71,17 +72,12 @@ pub enum LineCap { Round, } -impl Default for LineCap { - fn default() -> LineCap { - LineCap::Butt - } -} - /// The shape used at the corners of paths or basic shapes when they are /// stroked. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)] pub enum LineJoin { /// A sharp corner. + #[default] Miter, /// A round corner. Round, @@ -89,12 +85,6 @@ pub enum LineJoin { Bevel, } -impl Default for LineJoin { - fn default() -> LineJoin { - LineJoin::Miter - } -} - /// The dash pattern used when stroking the line. #[derive(Debug, Clone, Copy, Default)] pub struct LineDash<'a> { diff --git a/src/window.rs b/src/window.rs index 824915b2..e4601575 100644 --- a/src/window.rs +++ b/src/window.rs @@ -6,7 +6,7 @@ pub mod icon; pub use icon::Icon; pub use position::Position; -pub use settings::Settings; +pub use settings::{PlatformSpecific, Settings}; pub use crate::core::window::*; pub use crate::runtime::window::*; diff --git a/src/window/settings.rs b/src/window/settings.rs index 24d0f4f9..3c8da62f 100644 --- a/src/window/settings.rs +++ b/src/window/settings.rs @@ -1,5 +1,7 @@ use crate::window::{Icon, Position}; +pub use iced_winit::settings::PlatformSpecific; + /// The window settings of an application. #[derive(Debug, Clone)] pub struct Settings { @@ -32,6 +34,9 @@ pub struct Settings { /// The icon of the window. pub icon: Option<Icon>, + + /// Platform specific settings. + pub platform_specific: PlatformSpecific, } impl Default for Settings { @@ -47,6 +52,7 @@ impl Default for Settings { transparent: false, always_on_top: false, icon: None, + platform_specific: Default::default(), } } } @@ -64,7 +70,7 @@ impl From<Settings> for iced_winit::settings::Window { transparent: settings.transparent, always_on_top: settings.always_on_top, icon: settings.icon.map(Icon::into), - platform_specific: Default::default(), + platform_specific: settings.platform_specific, } } } |