feather_ui/layout/
root.rs1use super::{Desc, Layout, Renderable, Staged, base};
5use crate::{PxDim, PxRect};
6use std::rc::Rc;
7
8pub trait Prop {
11 fn dim(&self) -> &PxDim;
12}
13
14crate::gen_from_to_dyn!(Prop);
15
16impl Prop for PxDim {
17 fn dim(&self) -> &PxDim {
18 self
19 }
20}
21
22impl Desc for dyn Prop {
23 type Props = dyn Prop;
24 type Child = dyn base::Empty;
25 type Children = Box<dyn Layout<Self::Child>>;
26
27 fn stage<'a>(
28 props: &Self::Props,
29 _: PxRect,
30 _: crate::PxLimits,
31 child: &Self::Children,
32 _: std::sync::Weak<crate::SourceID>,
33 _: Option<Rc<dyn Renderable>>,
34 window: &mut crate::component::window::WindowState,
35 ) -> Box<dyn Staged + 'a> {
36 child.stage(
38 (*props.dim()).cast_unit().into(),
39 Default::default(),
40 window,
41 )
42 }
43}