pub struct TUI {
pub root: Container,
/* private fields */
}Fields§
§root: ContainerThe root container — all top-level children are added here.
Matches pi’s class TUI extends Container — the TUI itself renders
this root container first, then applies overlays.
Implementations§
Source§impl TUI
impl TUI
pub fn new() -> Self
pub fn screen_mut(&mut self) -> &mut Screen
pub fn full_redraw_count(&self) -> usize
pub fn set_clear_on_shrink(&mut self, enabled: bool)
pub fn set_dimensions(&mut self, width: usize, height: usize)
pub fn get_dimensions(&self) -> (usize, usize)
pub fn request_render(&mut self)
pub fn is_dirty(&self) -> bool
Sourcepub fn show_overlay(
&mut self,
component: Box<dyn Component>,
options: OverlayOptions,
) -> u64
pub fn show_overlay( &mut self, component: Box<dyn Component>, options: OverlayOptions, ) -> u64
Show an overlay component with configurable positioning and sizing.
Returns an overlay ID that can be used with hide_overlay.
Sourcepub fn hide_overlay(&mut self, id: u64)
pub fn hide_overlay(&mut self, id: u64)
Hide an overlay by ID
Sourcepub fn pop_overlay(&mut self)
pub fn pop_overlay(&mut self)
Hide the topmost overlay and restore previous focus
Sourcepub fn has_overlays(&self) -> bool
pub fn has_overlays(&self) -> bool
Check if there are any visible overlays
Sourcepub fn set_focus(&mut self, overlay_idx: Option<usize>)
pub fn set_focus(&mut self, overlay_idx: Option<usize>)
Set focus to a specific overlay or None for base content
Sourcepub fn focused_overlay(&self) -> Option<usize>
pub fn focused_overlay(&self) -> Option<usize>
Get current focus target
Sourcepub fn route_input(&mut self, key: &KeyEvent) -> bool
pub fn route_input(&mut self, key: &KeyEvent) -> bool
Route a keyboard event through the overlay input pipeline. Returns true if the input was consumed by an overlay.
Should be called BEFORE the application handles the key itself, so overlays get first crack at input.
Sourcepub fn route_paste(&mut self, text: &str) -> bool
pub fn route_paste(&mut self, text: &str) -> bool
Route a paste event to the focused overlay component or root. Matches pi’s input pipeline where paste is sent to handleInput.
Sourcepub fn render(
&mut self,
width: usize,
height: usize,
writer: &mut dyn Write,
) -> Result<()>
pub fn render( &mut self, width: usize, height: usize, writer: &mut dyn Write, ) -> Result<()>
Render the root component tree, composite overlays, then diff-render to screen.
Matches pi’s TUI.render() which extends Container:
- Render root Container (all permanent children)
- Append chat_buffer (bridge from compose_ui during migration)
- Composite any overlays on top
- Diff-render via Screen