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