mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 19:26:09 +00:00
Add LinearLayout::remove_child
This commit is contained in:
parent
acf075369c
commit
70327a85e9
@ -175,6 +175,18 @@ impl LinearLayout {
|
|||||||
self.children.get_mut(i).map(|child| &mut *child.view)
|
self.children.get_mut(i).map(|child| &mut *child.view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Removes a child.
|
||||||
|
///
|
||||||
|
/// If `i` is within bounds, the removed child will be returned.
|
||||||
|
pub fn remove_child(&mut self, i: usize) -> Option<Box<View>> {
|
||||||
|
if i < self.children.len() {
|
||||||
|
self.invalidate();
|
||||||
|
Some(self.children.remove(i).view)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the cache can be used, return the cached size.
|
// If the cache can be used, return the cached size.
|
||||||
// Otherwise, return None.
|
// Otherwise, return None.
|
||||||
fn get_cache(&self, req: Vec2) -> Option<Vec2> {
|
fn get_cache(&self, req: Vec2) -> Option<Vec2> {
|
||||||
|
Loading…
Reference in New Issue
Block a user