diff options
Diffstat (limited to 'src/layout/boxed.rs')
| -rw-r--r-- | src/layout/boxed.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/layout/boxed.rs b/src/layout/boxed.rs index 89c641bc..e712f650 100644 --- a/src/layout/boxed.rs +++ b/src/layout/boxed.rs @@ -86,6 +86,15 @@ impl BoxLayouter { Ok(()) } + /// Add a sublayout at an absolute position. + pub fn add_box_absolute(&mut self, position: Size2D, layout: BoxLayout) { + // Move all actions into this layout and translate absolute positions. + self.actions.reset_origin(); + self.actions.add(TextAction::MoveAbsolute(position)); + self.actions.set_origin(position); + self.actions.extend(layout.actions); + } + /// Add some space in between two boxes. pub fn add_space(&mut self, space: Size) -> LayoutResult<()> { // Check whether this space fits. @@ -100,20 +109,6 @@ impl BoxLayouter { Ok(()) } - /// Add a sublayout at an absolute position. - pub fn add_box_absolute(&mut self, position: Size2D, layout: BoxLayout) { - // Move all actions into this layout and translate absolute positions. - self.actions.reset_origin(); - self.actions.add(TextAction::MoveAbsolute(position)); - self.actions.set_origin(position); - self.actions.extend(layout.actions); - } - - /// Whether this layouter contains any items. - pub fn is_empty(&self) -> bool { - self.actions.is_empty() - } - /// The remaining space for new boxes. pub fn remaining(&self) -> Size2D { Size2D { @@ -122,6 +117,11 @@ impl BoxLayouter { } } + /// Whether this layouter contains any items. + pub fn is_empty(&self) -> bool { + self.actions.is_empty() + } + /// Finish the layouting and create a box layout from this. pub fn finish(self) -> BoxLayout { BoxLayout { |
