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.
|
2021-01-29 14:08:14 +09:00
|
|
|
#[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.
|
2020-11-23 00:31:50 +01:00
|
|
|
pub border_radius: f32,
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The border width of the checkbox.
|
2020-11-23 00:31:50 +01:00
|
|
|
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.
|
2022-01-20 18:34:15 +07:00
|
|
|
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`].
|
2022-11-09 04:05:31 +01:00
|
|
|
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.
|
2022-11-09 04:05:31 +01:00
|
|
|
fn active(&self, style: &Self::Style, is_checked: bool) -> Appearance;
|
2021-10-31 16:58:02 +07:00
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// Produces the hovered [`Appearance`] of a checkbox.
|
2022-11-09 04:05:31 +01:00
|
|
|
fn hovered(&self, style: &Self::Style, is_checked: bool) -> Appearance;
|
2020-01-07 02:54:54 +01:00
|
|
|
}
|