diff --git a/crates/tek_core/src/component/split.rs b/crates/tek_core/src/component/split.rs index 8cf2f667..2f7df30d 100644 --- a/crates/tek_core/src/component/split.rs +++ b/crates/tek_core/src/component/split.rs @@ -13,9 +13,9 @@ impl Direction { } pub struct Split<'a, E: Engine> { - items: Collection<'a, E>, - direction: Direction, - focus: Option + pub items: Collection<'a, E>, + pub direction: Direction, + pub focus: Option } impl<'a, E: Engine> Split<'a, E> { diff --git a/crates/tek_core/src/tui.rs b/crates/tek_core/src/tui.rs index e3b7e57f..f384fbca 100644 --- a/crates/tek_core/src/tui.rs +++ b/crates/tek_core/src/tui.rs @@ -10,6 +10,12 @@ use crossterm::terminal::{ EnterAlternateScreen, LeaveAlternateScreen, enable_raw_mode, disable_raw_mode }; +submod! { + tui_border + tui_buffer + tui_colors + tui_layout +} pub struct Tui { exited: Arc, buffer: usize, @@ -98,7 +104,7 @@ impl Tui { if engine.exited() { break } - engine.render(&*state).expect("render failed"); + state.render(&mut engine).expect("render failed"); engine.flip(); } std::thread::sleep(sleep); @@ -219,449 +225,3 @@ pub fn half_block (lower: bool, upper: bool) -> Option { _ => None } } - -pub struct FillBg(pub Color); - -impl Render for FillBg { - fn render (&self, to: &mut Tui) -> Perhaps { - to.fill_bg(to.area, self.0); - Ok(Some(to.area)) - } -} - -pub trait BorderStyle { - const NW: &'static str = ""; - const N: &'static str = ""; - const NE: &'static str = ""; - const E: &'static str = ""; - const SE: &'static str = ""; - const S: &'static str = ""; - const SW: &'static str = ""; - const W: &'static str = ""; - - #[inline] - fn draw <'a> (&self, to: &mut Tui) -> Perhaps { - self.draw_horizontal(to, None)?; - self.draw_vertical(to, None)?; - self.draw_corners(to, None)?; - Ok(Some(to.area)) - } - - #[inline] - fn draw_horizontal (&self, to: &mut Tui, style: Option