pub struct SelectionModel { /* private fields */ }Expand description
Tracks the set of selected row indices and an anchor for range selection.
Implementations§
Source§impl SelectionModel
impl SelectionModel
Sourcepub fn new(mode: SelectionMode) -> Self
pub fn new(mode: SelectionMode) -> Self
Create an empty selection model with the given mode.
Sourcepub fn mode(&self) -> SelectionMode
pub fn mode(&self) -> SelectionMode
The selection mode.
Sourcepub fn is_selected(&self, index: usize) -> bool
pub fn is_selected(&self, index: usize) -> bool
Returns true if row index is selected.
Sourcepub fn selected_sorted(&self) -> Vec<usize>
pub fn selected_sorted(&self) -> Vec<usize>
Selected indices in ascending order.
Sourcepub fn click(&mut self, index: usize)
pub fn click(&mut self, index: usize)
Handle a plain click on index: selects only that row (and sets the
range anchor). No-op in SelectionMode::None.
Sourcepub fn ctrl_click(&mut self, index: usize)
pub fn ctrl_click(&mut self, index: usize)
Handle a ctrl/cmd-click on index: toggles that row’s membership without
affecting others. In SelectionMode::Single it behaves like a plain
click; in SelectionMode::None it is a no-op.
Sourcepub fn shift_click(&mut self, index: usize)
pub fn shift_click(&mut self, index: usize)
Handle a shift-click on index: selects the contiguous range from the
current anchor to index (inclusive). Falls back to a plain click if
there is no anchor or the mode is not multi.
Sourcepub fn select_all(&mut self, row_count: usize)
pub fn select_all(&mut self, row_count: usize)
Select every row in 0..row_count (multi mode only).
Trait Implementations§
Source§impl Clone for SelectionModel
impl Clone for SelectionModel
Source§fn clone(&self) -> SelectionModel
fn clone(&self) -> SelectionModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SelectionModel
impl RefUnwindSafe for SelectionModel
impl Send for SelectionModel
impl Sync for SelectionModel
impl Unpin for SelectionModel
impl UnsafeUnpin for SelectionModel
impl UnwindSafe for SelectionModel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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