mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
28 lines
689 B
Rust
28 lines
689 B
Rust
use crate::*;
|
|
|
|
pub trait StatusBar: Copy + Widget<Engine = Tui> {
|
|
|
|
type State;
|
|
|
|
fn hotkey_fg () -> Color where Self: Sized;
|
|
|
|
fn update (&mut self, state: &Self::State) where Self: Sized;
|
|
|
|
fn command (commands: &[[impl Widget<Engine = Tui>;3]])
|
|
-> impl Widget<Engine = Tui> + '_
|
|
where
|
|
Self: Sized
|
|
{
|
|
let hotkey_fg = Self::hotkey_fg();
|
|
Stack::right(move |add|{
|
|
Ok(for [a, b, c] in commands.iter() {
|
|
add(&row!(
|
|
" ",
|
|
widget(a),
|
|
widget(b).bold(true).fg(hotkey_fg),
|
|
widget(c),
|
|
))?;
|
|
})
|
|
})
|
|
}
|
|
}
|