mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-09 10:50:40 +00:00
Add missing method to FixedLayout
This commit is contained in:
parent
f5687f5eab
commit
421c08c922
@ -1,8 +1,10 @@
|
|||||||
use crate::direction::{Absolute, Direction, Relative};
|
use crate::{
|
||||||
use crate::event::{Event, EventResult, Key};
|
direction::{Absolute, Direction, Relative},
|
||||||
use crate::rect::Rect;
|
event::{AnyCb, Event, EventResult, Key},
|
||||||
use crate::view::IntoBoxedView;
|
rect::Rect,
|
||||||
use crate::{Printer, Vec2, View, With};
|
view::{IntoBoxedView, Selector},
|
||||||
|
{Printer, Vec2, View, With},
|
||||||
|
};
|
||||||
|
|
||||||
/// Arranges its children in a fixed layout.
|
/// Arranges its children in a fixed layout.
|
||||||
///
|
///
|
||||||
@ -318,4 +320,25 @@ impl View for FixedLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn call_on_any<'a>(
|
||||||
|
&mut self,
|
||||||
|
selector: &Selector<'_>,
|
||||||
|
callback: AnyCb<'a>,
|
||||||
|
) {
|
||||||
|
for child in &mut self.children {
|
||||||
|
child.view.call_on_any(selector, callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn focus_view(&mut self, selector: &Selector<'_>) -> Result<(), ()> {
|
||||||
|
for (i, child) in self.children.iter_mut().enumerate() {
|
||||||
|
if child.view.focus_view(selector).is_ok() {
|
||||||
|
self.focus = i;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user