pub struct TreeViewState {
pub expanded: HashMap<String, bool>,
pub selected: HashMap<String, bool>,
}Expand description
State management for tree view
Fields§
§expanded: HashMap<String, bool>Map of item ID to whether it’s expanded
selected: HashMap<String, bool>Map of item ID to whether it’s selected
Implementations§
Source§impl TreeViewState
impl TreeViewState
Sourcepub fn is_expanded(&self, id: &str) -> bool
pub fn is_expanded(&self, id: &str) -> bool
Check if an item is expanded
Sourcepub fn toggle_expanded(&mut self, id: &str)
pub fn toggle_expanded(&mut self, id: &str)
Toggle the expanded state of an item
Sourcepub fn set_expanded(&mut self, id: &str, expanded: bool)
pub fn set_expanded(&mut self, id: &str, expanded: bool)
Set the expanded state of an item
Sourcepub fn is_selected(&self, id: &str) -> bool
pub fn is_selected(&self, id: &str) -> bool
Check if an item is selected
Sourcepub fn toggle_selected(&mut self, id: &str)
pub fn toggle_selected(&mut self, id: &str)
Toggle the selected state of an item
Sourcepub fn set_selected(&mut self, id: &str, selected: bool)
pub fn set_selected(&mut self, id: &str, selected: bool)
Set the selected state of an item
Sourcepub fn clear_selections(&mut self)
pub fn clear_selections(&mut self)
Clear all selections
Sourcepub fn expand_all(&mut self, items: &[TreeViewItem])
pub fn expand_all(&mut self, items: &[TreeViewItem])
Expand all items
Sourcepub fn collapse_all(&mut self)
pub fn collapse_all(&mut self)
Collapse all items
Trait Implementations§
Source§impl Clone for TreeViewState
impl Clone for TreeViewState
Source§fn clone(&self) -> TreeViewState
fn clone(&self) -> TreeViewState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TreeViewState
impl Debug for TreeViewState
Source§impl Default for TreeViewState
impl Default for TreeViewState
Source§fn default() -> TreeViewState
fn default() -> TreeViewState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TreeViewState
impl RefUnwindSafe for TreeViewState
impl Send for TreeViewState
impl Sync for TreeViewState
impl Unpin for TreeViewState
impl UnsafeUnpin for TreeViewState
impl UnwindSafe for TreeViewState
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