From cff325b520727ac0eec46a3757831afaa0916cc1 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 22 Oct 2019 21:40:37 +0200 Subject: =?UTF-8?q?Add=20spacing=20functions=20=F0=9F=94=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/mod.rs | 9 +++++++++ src/layout/tree.rs | 2 ++ 2 files changed, 11 insertions(+) (limited to 'src/layout') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 470ac3ba..34c9b35a 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -40,6 +40,15 @@ pub struct Layout { } impl Layout { + /// Create an empty layout with the specified dimensions. + pub fn empty(width: Size, height: Size) -> Layout { + Layout { + dimensions: Size2D::new(width, height), + actions: vec![], + debug_render: true, + } + } + /// Serialize this layout into an output buffer. pub fn serialize(&self, f: &mut W) -> io::Result<()> { writeln!( diff --git a/src/layout/tree.rs b/src/layout/tree.rs index 3a58115f..a0cb1434 100644 --- a/src/layout/tree.rs +++ b/src/layout/tree.rs @@ -124,6 +124,8 @@ impl<'a, 'p> TreeLayouter<'a, 'p> { self.start_new_flex(); } + Command::AddFlex(layout) => self.flex.add(layout), + Command::SetAlignment(alignment) => { self.finish_flex()?; self.alignment = alignment; -- cgit v1.2.3