summaryrefslogtreecommitdiff
path: root/src/layout/flex.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-16 10:37:30 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-16 10:37:30 +0100
commit261ef9e33a8548d4b7aa53e69e71866648982ae8 (patch)
tree8c98eeb4a4bb2123b45baf1dd4de706a21d619e9 /src/layout/flex.rs
parent0917d89bb899380ba897382b4945c8426f25c66d (diff)
Generalize tree layouter 🌲
Diffstat (limited to 'src/layout/flex.rs')
-rw-r--r--src/layout/flex.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/layout/flex.rs b/src/layout/flex.rs
index a364b608..c136ad0d 100644
--- a/src/layout/flex.rs
+++ b/src/layout/flex.rs
@@ -75,16 +75,18 @@ impl FlexLayouter {
}
}
- /// This layouter's context.
- pub fn ctx(&self) -> FlexContext {
- self.ctx
- }
-
/// Add a sublayout.
pub fn add(&mut self, layout: Layout) {
self.units.push(FlexUnit::Boxed(layout));
}
+ /// Add multiple sublayouts from a multi-layout.
+ pub fn add_multiple(&mut self, layouts: MultiLayout) {
+ for layout in layouts {
+ self.add(layout);
+ }
+ }
+
/// Add a space box which can be replaced by a run break.
pub fn add_space(&mut self, space: Size) {
self.units.push(FlexUnit::Space(space));
@@ -181,6 +183,11 @@ impl FlexLayouter {
Ok(())
}
+ /// This layouter's context.
+ pub fn ctx(&self) -> FlexContext {
+ self.ctx
+ }
+
/// Whether this layouter contains any items.
pub fn is_empty(&self) -> bool {
self.units.is_empty()