pub struct TreeNav { /* private fields */ }Expand description
Tree navigation with collapsible sections
Handles navigation logic for hierarchical tree structures where parent nodes can be collapsed to hide their children.
§Example
ⓘ
let mut nav = TreeNav::new();
nav.add_item(TreeItem::new(0).collapsible()); // Section
nav.add_item(TreeItem::new(1).with_parent(0)); // Child
nav.add_item(TreeItem::new(2).with_parent(0)); // Child
nav.next(); // Move to next visible item
nav.toggle_collapse(); // Collapse/expand current itemImplementations§
Sourcepub fn selected_row(&self) -> usize
pub fn selected_row(&self) -> usize
Get current row within selected item
Sourcepub fn is_collapsed(&self, id: usize) -> bool
pub fn is_collapsed(&self, id: usize) -> bool
Check if an item is collapsed
Sourcepub fn is_visible(&self, id: usize) -> bool
pub fn is_visible(&self, id: usize) -> bool
Check if an item is visible (not hidden by collapsed parent)
Sourcepub fn visible_items(&self) -> Vec<&TreeItem>
pub fn visible_items(&self) -> Vec<&TreeItem>
Get visible items
Sourcepub fn toggle_collapse(&mut self)
pub fn toggle_collapse(&mut self)
Toggle collapse state of current item
Sourcepub fn collapse_all(&mut self)
pub fn collapse_all(&mut self)
Collapse all collapsible items
Sourcepub fn expand_all(&mut self)
pub fn expand_all(&mut self)
Expand all items
Sourcepub fn get_prefix(&self, id: usize) -> (String, bool)
pub fn get_prefix(&self, id: usize) -> (String, bool)
Sourcepub fn is_last_sibling(&self, id: usize) -> bool
pub fn is_last_sibling(&self, id: usize) -> bool
Check if item is the last visible sibling at its level
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more