tui_treelistview/
style.rs1use ratatui::style::Style;
2use ratatui::text::Line;
3use ratatui::widgets::Borders;
4
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum TreeScrollPolicy {
8 KeepInView,
9 CenterOnSelect,
10}
11
12#[derive(Clone)]
14pub struct TreeListViewStyle<'a> {
15 pub title: Option<Line<'a>>,
16 pub block_style: Style,
17 pub border_style: Style,
18 pub highlight_style: Style,
19 pub mark_style: Style,
20 pub line_style: Style,
21 pub highlight_symbol: &'a str,
22 pub borders: Borders,
23 pub virtualize_rows: bool,
24 pub scroll_policy: TreeScrollPolicy,
25}
26
27impl Default for TreeListViewStyle<'_> {
28 fn default() -> Self {
29 Self {
30 title: None,
31 block_style: Style::default(),
32 border_style: Style::default(),
33 highlight_style: Style::default(),
34 mark_style: Style::default(),
35 line_style: Style::default(),
36 highlight_symbol: ">> ",
37 borders: Borders::ALL,
38 virtualize_rows: false,
39 scroll_policy: TreeScrollPolicy::KeepInView,
40 }
41 }
42}