Struct rat_widget::table::selection::RowSetSelection
source · 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.source§fn scroll_selected(&self) -> bool
fn scroll_selected(&self) -> bool
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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