mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
group devices
This commit is contained in:
parent
60627ac3e5
commit
5afed6f055
8 changed files with 147 additions and 267 deletions
|
|
@ -29,57 +29,27 @@ impl<'a> WidgetRef for ActionBar<'a> {
|
|||
|
||||
pub fn draw_leaf (buffer: &mut Buffer, area: Rect, y: u16, x: u16, text: &str) {
|
||||
use ratatui::style::{Style, Stylize};
|
||||
buffer.set_string(
|
||||
area.x + x, area.y + y,
|
||||
format!("│"),
|
||||
Style::default().black().dim()
|
||||
);
|
||||
buffer.set_string(
|
||||
area.x + x + 1, area.y + y,
|
||||
format!("{text}"),
|
||||
Style::default()
|
||||
);
|
||||
buffer.set_string(
|
||||
area.x + x + text.len() as u16 + 1, area.y + y,
|
||||
format!("│"),
|
||||
Style::default().black().dim()
|
||||
);
|
||||
buffer.set_string(
|
||||
area.x + x, area.y + 1 + y,
|
||||
format!("╰{}╯", "─".repeat(text.len() as usize)),
|
||||
Style::default().black()
|
||||
);
|
||||
let border = Style::default().gray().dim();
|
||||
let label = Style::default();
|
||||
let side = String::from("│");
|
||||
let bottom = format!("╰{}╯", "─".repeat(text.len() as usize));
|
||||
buffer.set_string(area.x + x, area.y + y, &side, border);
|
||||
buffer.set_string(area.x + x + 1, area.y + y, format!("{text}"), label);
|
||||
buffer.set_string(area.x + x + text.len() as u16 + 1, area.y + y, &side, border);
|
||||
buffer.set_string(area.x + x, area.y + 1 + y, bottom, border);
|
||||
}
|
||||
|
||||
pub fn draw_box (buffer: &mut Buffer, area: Rect) {
|
||||
use ratatui::style::{Style, Stylize};
|
||||
buffer.set_string(
|
||||
area.x, area.y,
|
||||
format!("╭{}╮", "─".repeat((area.width - 2).into())),//.repeat(area.width.saturating_sub(2).into())),
|
||||
Style::default().black()
|
||||
);
|
||||
let border = Style::default().gray().dim();
|
||||
let top = format!("╭{}╮", "─".repeat((area.width - 2).into()));
|
||||
let bottom = format!("╰{}╯", "─".repeat((area.width - 2).into()));
|
||||
buffer.set_string(area.x, area.y, top, border);
|
||||
for y in (area.y + 1)..(area.y + area.height - 1) {
|
||||
buffer.set_string(
|
||||
area.x, y,
|
||||
format!("│"),
|
||||
Style::default().black().dim()
|
||||
);
|
||||
buffer.set_string(
|
||||
area.x + area.width - 1, y,
|
||||
format!("│"),
|
||||
Style::default().black().dim()
|
||||
);
|
||||
buffer.set_string(area.x, y, format!("│"), border);
|
||||
buffer.set_string(area.x + area.width - 1, y, format!("│"), border);
|
||||
}
|
||||
buffer.set_string(
|
||||
area.x, area.y + area.height - 1,
|
||||
format!("╰{}╯", "─".repeat((area.width - 2).into())),//.repeat(area.width.saturating_sub(2).into())),
|
||||
Style::default().black()
|
||||
);
|
||||
//buffer.set_string(
|
||||
//area.x, area.y + area.height,
|
||||
//format!("╰{}╯", "─".repeat(area.width.saturating_sub(2).into())),
|
||||
//Style::default().black()
|
||||
//);
|
||||
buffer.set_string(area.x, area.y + area.height - 1, bottom, border);
|
||||
}
|
||||
|
||||
pub fn render_toolbar_vertical (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue