mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
wip: p.54, e=85
This commit is contained in:
parent
76af9d9bac
commit
54fb5b6ece
9 changed files with 629 additions and 571 deletions
|
|
@ -14,6 +14,7 @@ use std::fmt::Debug;
|
|||
submod! {
|
||||
tui_apis
|
||||
tui_command
|
||||
tui_content
|
||||
tui_control
|
||||
tui_focus
|
||||
tui_handle
|
||||
|
|
@ -26,35 +27,40 @@ submod! {
|
|||
tui_status
|
||||
tui_theme
|
||||
tui_view
|
||||
tui_widget
|
||||
}
|
||||
|
||||
fn content_with_menu_and_status <'a, S: Send + Sync + 'a, C: Command<S>> (
|
||||
content: &'a impl Widget<Engine = Tui>,
|
||||
menu_bar: Option<&'a MenuBar<Tui, S, C>>,
|
||||
status_bar: Option<impl Widget<Engine = Tui>>
|
||||
) -> impl Widget<Engine = Tui> + 'a {
|
||||
fn content_with_menu_and_status <'a, A, S, C> (
|
||||
content: &'a A,
|
||||
menu_bar: &'a Option<MenuBar<Tui, S, C>>,
|
||||
status_bar: &'a Option<impl StatusBar>
|
||||
) -> impl Widget<Engine = Tui> + 'a
|
||||
where
|
||||
A: Widget<Engine = Tui>,
|
||||
S: Send + Sync + 'a,
|
||||
C: Command<S>
|
||||
{
|
||||
let menus = menu_bar.as_ref().map_or_else(
|
||||
||&[] as &[Menu<_, _, _>],
|
||||
|m|m.menus.as_slice()
|
||||
);
|
||||
let content = Either(
|
||||
status_bar.is_none(),
|
||||
widget(&content),
|
||||
Split::up(
|
||||
1,
|
||||
widget(status_bar.as_ref().unwrap()),
|
||||
widget(&content)
|
||||
),
|
||||
);
|
||||
Either(
|
||||
menu_bar.is_none(),
|
||||
widget(&content),
|
||||
Either(
|
||||
status_bar.is_none(),
|
||||
widget(content),
|
||||
Split::up(
|
||||
1,
|
||||
widget(status_bar.as_ref().unwrap()),
|
||||
widget(content)
|
||||
),
|
||||
),
|
||||
Split::down(
|
||||
1,
|
||||
row!(menu in menus.iter() => {
|
||||
row!(" ", menu.title.as_str(), " ")
|
||||
}),
|
||||
widget(&content)
|
||||
widget(content)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue