use std::any::TypeId;
use crate::core::{Property, UpdateCtx};
use crate::layout::Length;
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Gap {
pub gap: Length,
}
impl Property for Gap {
fn static_default() -> &'static Self {
static DEFAULT: Gap = Gap { gap: Length::ZERO };
&DEFAULT
}
}
impl Default for Gap {
fn default() -> Self {
*Self::static_default()
}
}
impl From<Length> for Gap {
fn from(gap: Length) -> Self {
Self { gap }
}
}
impl Gap {
pub const ZERO: Self = Self { gap: Length::ZERO };
pub const fn new(gap: Length) -> Self {
Self { gap }
}
pub fn prop_changed(ctx: &mut UpdateCtx<'_>, property_type: TypeId) {
if property_type != TypeId::of::<Self>() {
return;
}
ctx.request_layout();
}
}