pub struct RowSetSelection {
pub anchor_row: Option<usize>,
pub lead_row: Option<usize>,
pub selected: HashSet<usize>,
}Expand description
Allows selection an active range of rows.
The current range can be retired to a set of selected rows, and a new range be started. This allows multiple interval selection and deselection of certain rows.
This one only supports row-selection.
Fields§
§anchor_row: Option<usize>Start of the active selection.
lead_row: Option<usize>Current end of the active selection.
selected: HashSet<usize>Retired rows. This doesn’t contain the rows between anchor and lead.
You can call RowSetSelection::retire_selection to add the anchor-lead range. This resets anchor and lead though. Or iterate the complete range and call RowSetSelection::is_selected_row.
Implementations§
Source§impl RowSetSelection
impl RowSetSelection
Sourcepub fn new() -> RowSetSelection
pub fn new() -> RowSetSelection
New selection.
Sourcepub fn selected(&self) -> HashSet<usize>
pub fn selected(&self) -> HashSet<usize>
Set of all selected rows. Clones the retired set and adds the current anchor..lead range.
Sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Has some selection.
Sourcepub fn set_lead(&mut self, lead: Option<usize>, extend: bool) -> bool
pub fn set_lead(&mut self, lead: Option<usize>, extend: bool) -> bool
Set a new lead. Maybe extend the range.
Sourcepub fn retire_selection(&mut self)
pub fn retire_selection(&mut self)
Transfers the range anchor to lead to the selection set and reset both.
Sourcepub fn add(&mut self, idx: usize)
pub fn add(&mut self, idx: usize)
Add to selection. Only works for retired selections, not for the active anchor-lead range.
Sourcepub fn remove(&mut self, idx: usize)
pub fn remove(&mut self, idx: usize)
Remove from selection. Only works for retired selections, not for the active anchor-lead range.
Sourcepub fn move_to(&mut self, lead: usize, max: usize, extend: bool) -> bool
pub fn move_to(&mut self, lead: usize, max: usize, extend: bool) -> bool
Set a new lead, at the same time limit the lead to max.
Trait Implementations§
Source§impl Clone for RowSetSelection
impl Clone for RowSetSelection
Source§fn clone(&self) -> RowSetSelection
fn clone(&self) -> RowSetSelection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RowSetSelection
impl Debug for RowSetSelection
Source§impl Default for RowSetSelection
impl Default for RowSetSelection
Source§fn default() -> RowSetSelection
fn default() -> RowSetSelection
Source§impl TableSelection for RowSetSelection
impl TableSelection for RowSetSelection
Source§fn is_selected_row(&self, row: usize) -> bool
fn is_selected_row(&self, row: usize) -> bool
is_selected_cell.Source§fn is_selected_column(&self, _column: usize) -> bool
fn is_selected_column(&self, _column: usize) -> bool
is_selected_cell.Auto Trait Implementations§
impl Freeze for RowSetSelection
impl RefUnwindSafe for RowSetSelection
impl Send for RowSetSelection
impl Sync for RowSetSelection
impl Unpin for RowSetSelection
impl UnwindSafe for RowSetSelection
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> 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>
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