2022-11-10 01:10:28 +01:00
|
|
|
//! Change the appearance of a checkbox.
|
2024-01-20 13:29:25 +01:00
|
|
|
use iced_core::{Background, Border, Color};
|
2020-01-07 02:54:54 +01:00
|
|
|
|
|
|
|
|
/// 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,
|
2023-02-16 14:13:04 +01:00
|
|
|
/// The icon [`Color`] of the checkbox.
|
|
|
|
|
pub icon_color: Color,
|
2024-01-20 13:29:25 +01:00
|
|
|
/// The [`Border`] of hte checkbox.
|
|
|
|
|
pub border: Border,
|
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
|
|
|
}
|