Add BoxView::set_size

This commit is contained in:
Alexandre Bury 2018-01-27 22:12:29 -08:00
parent b14a2ff5e7
commit f091cec861

View File

@ -48,6 +48,26 @@ impl<T: View> BoxView<T> {
}
}
/// 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