summaryrefslogtreecommitdiff
path: root/src/layout/boxed.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-06-22 12:25:01 +0200
committerLaurenz <laurmaedje@gmail.com>2019-06-22 12:25:01 +0200
commitf6fe3b5cdd2805f3975985752f9cb0e04e3daf49 (patch)
treedaddf46ba6add0b7cead1f9015b8f24364672138 /src/layout/boxed.rs
parente39a6efccff7ba2b5dd546ddf86f23d2714161e7 (diff)
Implement function layouting ✒
Diffstat (limited to 'src/layout/boxed.rs')
-rw-r--r--src/layout/boxed.rs28
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 {