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 new::*;
27pub use stack::*;
28pub use svg::*;
29pub use uniform_list::*;
30
31use crate::{
32 AfterLayoutContext, AppContext, Event, EventContext, LayoutContext, PaintContext,
33 SizeConstraint,
34};
35
36pub trait ParentElement<'a>: Extend<ElementBox> + Sized {
37 fn add_children(&mut self, children: impl IntoIterator<Item = ElementBox>) {
38 self.extend(children);
39 }
40
41 fn add_child(&mut self, child: ElementBox) {
42 self.add_children(Some(child));
43 }
44
45 fn with_children(mut self, children: impl IntoIterator<Item = ElementBox>) -> Self {
46 self.add_children(children);
47 self
48 }
49
50 fn with_child(self, child: ElementBox) -> Self {
51 self.with_children(Some(child))
52 }
53}
54
55impl<'a, T> ParentElement<'a> for T where T: Extend<ElementBox> {}