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