1mod align;
2mod canvas;
3mod constrained_box;
4mod container;
5mod empty;
6mod event_handler;
7mod flex;
8mod label;
9mod line_box;
10mod new;
11mod stack;
12mod svg;
13mod uniform_list;
14
15pub use crate::presenter::ChildView;
16pub use align::*;
17pub use canvas::*;
18pub use constrained_box::*;
19pub use container::*;
20pub use empty::*;
21pub use event_handler::*;
22pub use flex::*;
23pub use label::*;
24pub use line_box::*;
25pub use new::*;
26pub use stack::*;
27pub use svg::*;
28pub use uniform_list::*;
29
30use crate::{
31 AfterLayoutContext, AppContext, Event, EventContext, LayoutContext, PaintContext,
32 SizeConstraint,
33};
34
35pub trait ParentElement<'a>: Extend<ElementBox> + Sized {
36 fn add_children(&mut self, children: impl IntoIterator<Item = ElementBox>) {
37 self.extend(children);
38 }
39
40 fn add_child(&mut self, child: ElementBox) {
41 self.add_children(Some(child));
42 }
43
44 fn with_children(mut self, children: impl IntoIterator<Item = ElementBox>) -> Self {
45 self.add_children(children);
46 self
47 }
48
49 fn with_child(self, child: ElementBox) -> Self {
50 self.with_children(Some(child))
51 }
52}
53
54impl<'a, T> ParentElement<'a> for T where T: Extend<ElementBox> {}