pub struct TreeListViewState<Id> { /* private fields */ }Expand description
Persistent view state and its derived caches.
Implementations§
Source§impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
Sourcepub fn handle_action<T, F, S, C, Custom>(
&mut self,
model: &T,
query: &TreeQuery<F, S>,
columns: &C,
action: TreeAction<Custom>,
) -> TreeEvent<Id, Custom>
pub fn handle_action<T, F, S, C, Custom>( &mut self, model: &T, query: &TreeQuery<F, S>, columns: &C, action: TreeAction<Custom>, ) -> TreeEvent<Id, Custom>
Handles an action against the current projection.
Sourcepub fn apply_edit<T, F, S>(
&mut self,
model: &mut T,
query: &TreeQuery<F, S>,
command: TreeEditCommand<Id>,
) -> Result<TreeChangeSet<Id>, T::Error>
pub fn apply_edit<T, F, S>( &mut self, model: &mut T, query: &TreeQuery<F, S>, command: TreeEditCommand<Id>, ) -> Result<TreeChangeSet<Id>, T::Error>
Applies a command through the model, reconciles persistent state, and rebuilds the projection.
§Errors
Returns the model-specific error from TreeEditor::apply without changing view state.
Sourcepub fn reconcile_changes(&mut self, changes: &TreeChangeSet<Id>)
pub fn reconcile_changes(&mut self, changes: &TreeChangeSet<Id>)
Reconciles marks, expansion, and selection with an exact model change set.
Source§impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
Sourcepub fn ensure_mark_states<T: TreeModel<Id = Id>>(&mut self, model: &T)
pub fn ensure_mark_states<T: TreeModel<Id = Id>>(&mut self, model: &T)
Rebuilds tri-state marks after the model or manual marks change.
Sourcepub fn mark_state(&self, id: Id) -> TreeMarkState
pub fn mark_state(&self, id: Id) -> TreeMarkState
Returns an aggregated mark from the most recently computed cache.
pub fn is_manually_marked(&self, id: Id) -> bool
Sourcepub fn set_marked(&mut self, id: Id, marked: bool) -> bool
pub fn set_marked(&mut self, id: Id, marked: bool) -> bool
Sets a node’s manual mark.
Sourcepub fn toggle_marked(&mut self, id: Id) -> bool
pub fn toggle_marked(&mut self, id: Id) -> bool
Toggles a node’s manual mark.
Sourcepub fn clear_marks(&mut self) -> bool
pub fn clear_marks(&mut self) -> bool
Removes every manual mark.
pub fn manual_marked_ids(&self) -> impl Iterator<Item = Id> + '_
Source§impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
Sourcepub const fn selected_id(&self) -> Option<Id>
pub const fn selected_id(&self) -> Option<Id>
Возвращает идентификатор выбранной строки.
Sourcepub const fn selected_index(&self) -> Option<usize>
pub const fn selected_index(&self) -> Option<usize>
Возвращает индекс выбранного вхождения в текущей проекции.
Sourcepub fn select_id(&mut self, selected: Option<Id>) -> bool
pub fn select_id(&mut self, selected: Option<Id>) -> bool
Выбирает первое видимое вхождение узла по идентификатору.
Sourcepub fn select_index(&mut self, index: Option<usize>) -> bool
pub fn select_index(&mut self, index: Option<usize>) -> bool
Selects a row in the current projection.
Sourcepub fn select_first(&mut self) -> bool
pub fn select_first(&mut self) -> bool
Selects the first row.
Sourcepub fn select_last(&mut self) -> bool
pub fn select_last(&mut self) -> bool
Selects the last row.
Sourcepub fn select_prev(&mut self) -> bool
pub fn select_prev(&mut self) -> bool
Selects the previous row, starting at the last row when nothing is selected.
Sourcepub fn select_next(&mut self) -> bool
pub fn select_next(&mut self) -> bool
Selects the next row, starting at the first row when nothing is selected.
Sourcepub fn select_parent(&mut self) -> bool
pub fn select_parent(&mut self) -> bool
Selects the visible parent.
Sourcepub fn select_first_child(&mut self) -> bool
pub fn select_first_child(&mut self) -> bool
Selects the first visible direct child.
Sourcepub fn selected_parent_id(&self) -> Option<Id>
pub fn selected_parent_id(&self) -> Option<Id>
Returns the selected node’s parent even when a synthetic parent is hidden.
pub fn selected_level(&self) -> Option<usize>
pub const fn visible_len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub fn visible_ids(&self) -> impl Iterator<Item = Id> + '_
pub fn visible_index_of(&self, id: Id) -> Option<usize>
pub fn visible_contains(&self, id: Id) -> bool
Sourcepub fn set_offset(&mut self, offset: usize) -> bool
pub fn set_offset(&mut self, offset: usize) -> bool
Sets the first viewport row independently of selection.
Sourcepub fn scroll_view_by(&mut self, amount: isize) -> bool
pub fn scroll_view_by(&mut self, amount: isize) -> bool
Scrolls the viewport without changing selection.
pub const fn horizontal_offset(&self) -> u16
pub const fn set_horizontal_offset(&mut self, offset: u16) -> bool
pub const fn scroll_horizontal_by(&mut self, amount: i16) -> bool
pub const fn selected_column(&self) -> Option<usize>
pub fn select_column( &mut self, column: Option<usize>, column_count: usize, ) -> bool
pub fn select_column_left(&mut self, column_count: usize) -> bool
pub fn select_column_right(&mut self, column_count: usize) -> bool
Source§impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
Sourcepub fn ensure_projection<T, F, S>(
&mut self,
model: &T,
query: &TreeQuery<F, S>,
) -> bool
pub fn ensure_projection<T, F, S>( &mut self, model: &T, query: &TreeQuery<F, S>, ) -> bool
Synchronizes the projection with model, query, and expansion revisions.
Returns true when the projection was rebuilt.
Sourcepub fn select_by_id<T, F, S>(
&mut self,
model: &T,
query: &TreeQuery<F, S>,
id: Id,
) -> bool
pub fn select_by_id<T, F, S>( &mut self, model: &T, query: &TreeQuery<F, S>, id: Id, ) -> bool
Expands the path to a node and selects it when it is present in the projection.
Sourcepub fn expand_to<T: TreeModel<Id = Id>>(
&mut self,
model: &T,
target: Id,
) -> bool
pub fn expand_to<T: TreeModel<Id = Id>>( &mut self, model: &T, target: Id, ) -> bool
Expands every loaded ancestor of a node.
Sourcepub fn expand_all<T: TreeModel<Id = Id>>(&mut self, model: &T) -> bool
pub fn expand_all<T: TreeModel<Id = Id>>(&mut self, model: &T) -> bool
Expands every loaded branch in the forest.
Sourcepub fn collapse_all(&mut self) -> bool
pub fn collapse_all(&mut self) -> bool
Collapses every branch.
Sourcepub fn set_expanded(
&mut self,
id: Id,
parent: Option<Id>,
expanded: bool,
) -> bool
pub fn set_expanded( &mut self, id: Id, parent: Option<Id>, expanded: bool, ) -> bool
Sets the expansion state of a specific path.
Sourcepub fn node_is_expanded(&self, id: Id, parent: Option<Id>) -> bool
pub fn node_is_expanded(&self, id: Id, parent: Option<Id>) -> bool
Returns persisted expansion state rather than filter-forced state.
Sourcepub fn effective_expansion(&self, id: Id) -> Option<TreeExpansionState>
pub fn effective_expansion(&self, id: Id) -> Option<TreeExpansionState>
Returns the effective expansion state of a visible node.
Sourcepub fn expanded_paths(&self) -> impl Iterator<Item = (Option<Id>, Id)> + '_
pub fn expanded_paths(&self) -> impl Iterator<Item = (Option<Id>, Id)> + '_
Iterates over persisted expanded paths in unspecified order.
Source§impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
impl<Id: Copy + Eq + Hash> TreeListViewState<Id>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates view state with preallocated projection storage.
Sourcepub fn from_snapshot(snapshot: TreeListViewSnapshot<Id>) -> Self
pub fn from_snapshot(snapshot: TreeListViewSnapshot<Id>) -> Self
Restores state from a snapshot.
Sourcepub const fn projection(&self) -> &TreeProjection<Id>
pub const fn projection(&self) -> &TreeProjection<Id>
Returns the current projection. Before reading it, the application must call
TreeListViewState::ensure_projection or render the widget.
Sourcepub fn snapshot(&self) -> TreeListViewSnapshot<Id>
pub fn snapshot(&self) -> TreeListViewSnapshot<Id>
Captures the persistent part of the state.
Sourcepub fn restore(&mut self, snapshot: TreeListViewSnapshot<Id>)
pub fn restore(&mut self, snapshot: TreeListViewSnapshot<Id>)
Restores persistent state and resets derived caches.
pub const fn draw_lines(&self) -> bool
pub const fn set_draw_lines(&mut self, draw: bool)
Trait Implementations§
Auto Trait Implementations§
impl<Id> Freeze for TreeListViewState<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for TreeListViewState<Id>where
Id: RefUnwindSafe,
impl<Id> Send for TreeListViewState<Id>where
Id: Send,
impl<Id> Sync for TreeListViewState<Id>where
Id: Sync,
impl<Id> Unpin for TreeListViewState<Id>where
Id: Unpin,
impl<Id> UnsafeUnpin for TreeListViewState<Id>where
Id: UnsafeUnpin,
impl<Id> UnwindSafe for TreeListViewState<Id>where
Id: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more