mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: ratatui
This commit is contained in:
parent
edc363c55b
commit
fc7f6f5407
16 changed files with 485 additions and 243 deletions
|
|
@ -1,5 +1,32 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
//let render_with_actions = |actions| |state, frame: &mut Frame| {
|
||||
//let layout = Layout::default()
|
||||
//.direction(Direction::Horizontal)
|
||||
//.constraints(vec![
|
||||
//Constraint::Percentage(30),
|
||||
//Constraint::Percentage(70),
|
||||
//])
|
||||
//.split(frame.size());
|
||||
//frame.render_widget_ref(ActionBar(actions), layout[0]);
|
||||
//frame.render_widget_ref(state, layout[1]);
|
||||
//Ok(())
|
||||
//};
|
||||
|
||||
pub struct ActionBar<'a>(pub &'a [(&'static str, &'static str)]);
|
||||
|
||||
impl<'a> WidgetRef for ActionBar<'a> {
|
||||
fn render_ref (&self, area: Rect, buf: &mut Buffer) {
|
||||
let layout = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints(self.0.iter().map(|_|Constraint::Length(3)).collect::<Vec<_>>())
|
||||
.split(area);
|
||||
for (index, action) in self.0.iter().enumerate() {
|
||||
Line::raw(action.0).render(layout[index], buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_toolbar_vertical (
|
||||
stdout: &mut std::io::Stdout,
|
||||
offset: (u16, u16),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue