mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 11:16:03 +00:00
Add BoxView::set_size
This commit is contained in:
parent
b14a2ff5e7
commit
f091cec861
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user