iced-yoda/style/src/checkbox.rs

32 lines
1 KiB
Rust
Raw Normal View History

2022-11-10 01:10:28 +01:00
//! Change the appearance of a checkbox.
2020-01-07 02:54:54 +01:00
use iced_core::{Background, Color};
/// The appearance of a checkbox.
#[derive(Debug, Clone, Copy)]
2022-06-04 03:26:53 +02:00
pub struct Appearance {
2022-11-10 01:10:28 +01:00
/// The [`Background`] of the checkbox.
2020-01-07 02:54:54 +01:00
pub background: Background,
2022-11-10 01:10:28 +01:00
/// The checkmark [`Color`] of the checkbox.
2020-01-07 02:54:54 +01:00
pub checkmark_color: Color,
2022-11-10 01:10:28 +01:00
/// The border radius of the checkbox.
pub border_radius: f32,
2022-11-10 01:10:28 +01:00
/// The border width of the checkbox.
pub border_width: f32,
2022-11-10 01:10:28 +01:00
/// The border [`Color`] of the checkbox.
2020-01-07 02:54:54 +01:00
pub border_color: Color,
2022-11-10 01:10:28 +01:00
/// The text [`Color`] of the checkbox.
pub text_color: Option<Color>,
2020-01-07 02:54:54 +01:00
}
/// A set of rules that dictate the style of a checkbox.
pub trait StyleSheet {
2022-11-10 01:10:28 +01:00
/// The supported style of the [`StyleSheet`].
type Style: Default;
2020-01-07 02:54:54 +01:00
2022-11-10 01:10:28 +01:00
/// Produces the active [`Appearance`] of a checkbox.
fn active(&self, style: &Self::Style, is_checked: bool) -> Appearance;
2022-11-10 01:10:28 +01:00
/// Produces the hovered [`Appearance`] of a checkbox.
fn hovered(&self, style: &Self::Style, is_checked: bool) -> Appearance;
2020-01-07 02:54:54 +01:00
}