mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-10 03:10:41 +00:00
Add Cursive::active_screen
This commit is contained in:
parent
4879d8cc71
commit
2d62d2c91f
@ -55,9 +55,9 @@ impl Cursive {
|
||||
|
||||
let (tx, rx) = mpsc::channel();
|
||||
|
||||
let mut res = Cursive {
|
||||
Cursive {
|
||||
theme: theme,
|
||||
screens: Vec::new(),
|
||||
screens: vec![views::StackView::new()],
|
||||
last_sizes: Vec::new(),
|
||||
global_callbacks: HashMap::new(),
|
||||
menubar: views::Menubar::new(),
|
||||
@ -66,11 +66,7 @@ impl Cursive {
|
||||
cb_source: rx,
|
||||
cb_sink: tx,
|
||||
backend: backend,
|
||||
};
|
||||
|
||||
res.screens.push(views::StackView::new());
|
||||
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a sink for asynchronous callbacks.
|
||||
@ -218,6 +214,11 @@ impl Cursive {
|
||||
&mut self.screens[id]
|
||||
}
|
||||
|
||||
/// Returns the id of the currently active screen.
|
||||
pub fn active_screen(&self) -> ScreenId {
|
||||
self.active_screen
|
||||
}
|
||||
|
||||
/// Adds a new screen, and returns its ID.
|
||||
pub fn add_screen(&mut self) -> ScreenId {
|
||||
let res = self.screens.len();
|
||||
|
Loading…
Reference in New Issue
Block a user