iced-yoda/style/src/checkbox.rs

31 lines
1 KiB
Rust
Raw Normal View History

2022-11-10 01:10:28 +01:00
//! Change the appearance of a checkbox.
use iced_core::{Background, Border, Color};
2020-01-07 02:54:54 +01:00
/// 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,
/// The icon [`Color`] of the checkbox.
pub icon_color: Color,
/// The [`Border`] of hte checkbox.
pub border: Border,
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;
/// Produces the disabled [`Appearance`] of a checkbox.
fn disabled(&self, style: &Self::Style, is_checked: bool) -> Appearance;
2020-01-07 02:54:54 +01:00
}