use std::any::TypeId;
use crate::core::{Property, UpdateCtx};
use crate::peniko::color::{AlphaColor, Srgb};
#[expect(missing_docs, reason = "field names are self-descriptive")]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CheckmarkColor {
pub color: AlphaColor<Srgb>,
}
impl Property for CheckmarkColor {
fn static_default() -> &'static Self {
static DEFAULT: CheckmarkColor = CheckmarkColor {
color: AlphaColor::BLACK,
};
&DEFAULT
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct DisabledCheckmarkColor(pub CheckmarkColor);
impl Property for DisabledCheckmarkColor {
fn static_default() -> &'static Self {
static DEFAULT: DisabledCheckmarkColor = DisabledCheckmarkColor(CheckmarkColor {
color: AlphaColor::BLACK,
});
&DEFAULT
}
}
#[expect(missing_docs, reason = "field names are self-descriptive")]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CheckmarkStrokeWidth {
pub width: f64,
}
impl Property for CheckmarkStrokeWidth {
fn static_default() -> &'static Self {
static DEFAULT: CheckmarkStrokeWidth = CheckmarkStrokeWidth { width: 1. };
&DEFAULT
}
}
impl Default for CheckmarkColor {
fn default() -> Self {
*Self::static_default()
}
}
impl CheckmarkColor {
pub fn prop_changed(ctx: &mut UpdateCtx<'_>, property_type: TypeId) {
if property_type != TypeId::of::<Self>() {
return;
}
ctx.request_paint_only();
}
}
impl Default for DisabledCheckmarkColor {
fn default() -> Self {
*Self::static_default()
}
}
impl DisabledCheckmarkColor {
pub fn prop_changed(ctx: &mut UpdateCtx<'_>, property_type: TypeId) {
if property_type != TypeId::of::<Self>() {
return;
}
ctx.request_paint_only();
}
}
impl Default for CheckmarkStrokeWidth {
fn default() -> Self {
*Self::static_default()
}
}
impl CheckmarkStrokeWidth {
pub fn prop_changed(ctx: &mut UpdateCtx<'_>, property_type: TypeId) {
if property_type != TypeId::of::<Self>() {
return;
}
ctx.request_paint_only();
}
}