diff --git a/src/views/box_view.rs b/src/views/box_view.rs index 6bcb65e..52082a5 100644 --- a/src/views/box_view.rs +++ b/src/views/box_view.rs @@ -48,6 +48,26 @@ impl BoxView { } } + /// Sets the size constraints for this view. + pub fn set_constraints(&mut self, width: SizeConstraint, height: SizeConstraint) { + self.set_width(width); + self.set_height(height); + } + + /// Sets the width constraint for this view. + /// + /// Leaves the height unchanged. + pub fn set_width(&mut self, width: SizeConstraint) { + self.size.x = width; + } + + /// Sets the height constraint for this view. + /// + /// Leaves the width unchanged. + pub fn set_height(&mut self, height: SizeConstraint) { + self.size.y = height; + } + /// Sets `self` to be squishable. /// /// A squishable `BoxView` will take a smaller size than it should when