Skip to main content

tui_treelistview/
context.rs

1use ratatui::style::Style;
2
3/// Node-specific flags used while rendering a row.
4#[derive(Clone, Copy)]
5pub struct TreeRowNodeState {
6    /// Whether the node is currently expanded.
7    pub is_expanded: bool,
8    /// Whether the node has children.
9    pub has_children: bool,
10    /// Whether the node is marked (directly or via its subtree).
11    pub is_marked: bool,
12}
13
14/// Rendering flags that affect visual presentation.
15#[derive(Clone, Copy)]
16pub struct TreeRowRenderState {
17    /// Whether guide lines should be rendered.
18    pub draw_lines: bool,
19}
20
21/// Rendering context for a single tree row.
22#[derive(Clone, Copy)]
23pub struct TreeRowContext<'a> {
24    /// Depth level of the node in the tree (root = 0).
25    pub level: u16,
26    /// Stack indicating whether each level on the path is the last child.
27    pub is_tail_stack: &'a [bool],
28    /// Node flags.
29    pub node: TreeRowNodeState,
30    /// Render flags.
31    pub render: TreeRowRenderState,
32    /// Style applied to guide line segments.
33    pub line_style: Style,
34}