add widget dynamic helper and Split::up

This commit is contained in:
🪞👃🪞 2024-10-18 23:51:58 +03:00
parent 038451e2f4
commit 97af45b576
4 changed files with 47 additions and 17 deletions

View file

@ -3,19 +3,29 @@ use crate::*;
impl Content for Arranger<Tui> {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
Stack::down(move|add|{
add(&self.transport)?;
let arrangement = &self.arrangement as &dyn Widget<Engine = Tui>;
if let Some(direction) = self.show_sequencer {
add(&arrangement.split(direction, self.arrangement_split,
self.phrases.clone().split(direction.ccw(), self.phrases_split,
&self.editor as &dyn Widget<Engine = Tui>
).min_y(self.arrangement_split)
).fill_y())
} else {
add(&self.arrangement)
}
})
Split::down(
2,
widget(&self.transport),
Split::up(
1,
widget(&self.status),
Split::down(
self.arrangement_split,
widget(&self.arrangement),
Split::right(
self.phrases_split,
self.phrases.clone(),
widget(&self.editor),
)
)
)
).fill_xy()
}
}
impl Content for ArrangerStatusBar {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
"status bar"
}
}
impl Content for Arrangement<Tui> {