cosmic/widget/segmented_button/
style.rs
1use iced_core::{Background, Color, border::Radius};
5
6#[derive(Default, Clone, Copy)]
8pub struct Appearance {
9 pub background: Option<Background>,
10 pub border_radius: Radius,
11 pub border_bottom: Option<(f32, Color)>,
12 pub border_end: Option<(f32, Color)>,
13 pub border_start: Option<(f32, Color)>,
14 pub border_top: Option<(f32, Color)>,
15 pub active: ItemStatusAppearance,
16 pub inactive: ItemStatusAppearance,
17 pub hover: ItemStatusAppearance,
18 pub focus: ItemStatusAppearance,
19}
20
21#[derive(Default, Clone, Copy)]
23pub struct ItemAppearance {
24 pub border_radius: Radius,
25 pub border_bottom: Option<(f32, Color)>,
26 pub border_end: Option<(f32, Color)>,
27 pub border_start: Option<(f32, Color)>,
28 pub border_top: Option<(f32, Color)>,
29}
30
31#[derive(Default, Clone, Copy)]
33pub struct ItemStatusAppearance {
34 pub background: Option<Background>,
35 pub first: ItemAppearance,
36 pub middle: ItemAppearance,
37 pub last: ItemAppearance,
38 pub text_color: Color,
39}
40
41pub trait StyleSheet {
43 type Style: Default;
45
46 fn horizontal(&self, style: &Self::Style) -> Appearance;
48
49 fn vertical(&self, style: &Self::Style) -> Appearance;
51}