summaryrefslogtreecommitdiffstats
path: root/style/src/container.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-20 13:29:25 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-20 13:29:25 +0100
commit25f182f933ea6b7c112c8f9a450a98dc9b9eebdd (patch)
treefdc498d705f033d3c432e6a06b8cd223dfd82633 /style/src/container.rs
parent4d502012b3e3ed9d9ef80f21078d53d182cdaa1b (diff)
downloadiced-25f182f933ea6b7c112c8f9a450a98dc9b9eebdd.tar.gz
iced-25f182f933ea6b7c112c8f9a450a98dc9b9eebdd.tar.bz2
iced-25f182f933ea6b7c112c8f9a450a98dc9b9eebdd.zip
Introduce `Border` struct analogous to `Shadow`
Diffstat (limited to 'style/src/container.rs')
-rw-r--r--style/src/container.rs31
1 files changed, 9 insertions, 22 deletions
diff --git a/style/src/container.rs b/style/src/container.rs
index 490a9dab..a490c187 100644
--- a/style/src/container.rs
+++ b/style/src/container.rs
@@ -1,19 +1,15 @@
//! Change the appearance of a container.
-use crate::core::{Background, BorderRadius, Color, Pixels};
+use crate::core::{Background, Border, Color, Pixels};
/// The appearance of a container.
-#[derive(Debug, Clone, Copy)]
+#[derive(Debug, Clone, Copy, Default)]
pub struct Appearance {
/// The text [`Color`] of the container.
pub text_color: Option<Color>,
/// The [`Background`] of the container.
pub background: Option<Background>,
- /// The border radius of the container.
- pub border_radius: BorderRadius,
- /// The border width of the container.
- pub border_width: f32,
- /// The border [`Color`] of the container.
- pub border_color: Color,
+ /// The [`Border`] of the container.
+ pub border: Border,
}
impl Appearance {
@@ -25,8 +21,11 @@ impl Appearance {
width: impl Into<Pixels>,
) -> Self {
Self {
- border_color: color.into(),
- border_width: width.into().0,
+ border: Border {
+ color: color.into(),
+ width: width.into().0,
+ ..Border::default()
+ },
..self
}
}
@@ -40,18 +39,6 @@ impl Appearance {
}
}
-impl std::default::Default for Appearance {
- fn default() -> Self {
- Self {
- text_color: None,
- background: None,
- border_radius: 0.0.into(),
- border_width: 0.0,
- border_color: Color::TRANSPARENT,
- }
- }
-}
-
/// A set of rules that dictate the [`Appearance`] of a container.
pub trait StyleSheet {
/// The supported style of the [`StyleSheet`].