mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Add LinearLayout::get_child and get_child_mut
This commit is contained in:
parent
cf0392db64
commit
c3f2e9ad9c
@ -160,6 +160,16 @@ impl LinearLayout {
|
||||
LinearLayout::new(direction::Orientation::Horizontal)
|
||||
}
|
||||
|
||||
/// Returns a reference to a child.
|
||||
pub fn get_child(&self, i: usize) -> Option<&View> {
|
||||
self.children.get(i).map(|child| &*child.view)
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to a child.
|
||||
pub fn get_child_mut(&mut self, i: usize) -> Option<&mut View> {
|
||||
self.children.get_mut(i).map(|child| &mut *child.view)
|
||||
}
|
||||
|
||||
// If the cache can be used, return the cached size.
|
||||
// Otherwise, return None.
|
||||
fn get_cache(&self, req: Vec2) -> Option<Vec2> {
|
||||
|
Loading…
Reference in New Issue
Block a user