Struct rat_widget::list::RListState
source · pub struct RListState<Selection> {
pub rows: usize,
pub scroll: ScrollState,
pub area: Rect,
pub inner: Rect,
pub item_areas: Vec<Rect>,
pub focus: FocusFlag,
pub selection: Selection,
pub mouse: MouseFlags,
}Fields§
§rows: usizeLength in items.
scroll: ScrollStateOffset
area: RectTotal area
inner: RectArea inside the block.
item_areas: Vec<Rect>Areas for the rendered items.
focus: FocusFlagFocus
selection: SelectionSelection model
mouse: MouseFlagsHelper for mouse events.
Implementations§
source§impl<Selection: ListSelection> RListState<Selection>
impl<Selection: ListSelection> RListState<Selection>
pub fn clear_offset(&mut self)
pub fn max_offset(&self) -> usize
pub fn offset(&self) -> usize
pub fn set_offset(&mut self, offset: usize) -> bool
pub fn page_len(&self) -> usize
pub fn scroll_by(&self) -> usize
sourcepub fn scroll_to_selected(&mut self) -> bool
pub fn scroll_to_selected(&mut self) -> bool
Scroll to selected.
pub fn scroll_to(&mut self, pos: usize) -> bool
pub fn scroll_up(&mut self, n: usize) -> bool
pub fn scroll_down(&mut self, n: usize) -> bool
source§impl<Selection: ListSelection> RListState<Selection>
impl<Selection: ListSelection> RListState<Selection>
source§impl RListState<RowSelection>
impl RListState<RowSelection>
sourcepub fn set_scroll_selection(&mut self, scroll: bool)
pub fn set_scroll_selection(&mut self, scroll: bool)
When scrolling the table, change the selection instead of the offset.
sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear the selection.
sourcepub fn has_selection(&mut self) -> bool
pub fn has_selection(&mut self) -> bool
Anything selected?
pub fn select(&mut self, row: Option<usize>) -> bool
sourcepub fn move_to(&mut self, row: usize) -> bool
pub fn move_to(&mut self, row: usize) -> bool
Move the selection to the given row. Ensures the row is visible afterwards.
source§impl RListState<RowSetSelection>
impl RListState<RowSetSelection>
sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear the selection.
sourcepub fn has_selection(&mut self) -> bool
pub fn has_selection(&mut self) -> bool
Anything selected?
pub fn selected(&self) -> HashSet<usize>
sourcepub fn set_lead(&mut self, row: Option<usize>, extend: bool) -> bool
pub fn set_lead(&mut self, row: Option<usize>, extend: bool) -> bool
Change the lead-selection. Limits the value to the number of rows.
If extend is false the current selection is cleared and both lead and
anchor are set to the given value.
If extend is true, the anchor is kept where it is and lead is changed.
Everything in the range anchor..lead is selected. It doesn’t matter
if anchor < lead.
sourcepub fn set_lead_clamped(&mut self, lead: usize, max: usize, extend: bool)
pub fn set_lead_clamped(&mut self, lead: usize, max: usize, extend: bool)
Set a new lead, at the same time limit the lead to max.
sourcepub fn retire_selection(&mut self)
pub fn retire_selection(&mut self)
Retire the current anchor/lead selection to the set of selected rows. Resets lead and anchor and starts a new selection round.
sourcepub fn add_selected(&mut self, idx: usize)
pub fn add_selected(&mut self, idx: usize)
Add to selection.
sourcepub fn remove_selected(&mut self, idx: usize)
pub fn remove_selected(&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, row: usize, extend: bool) -> bool
pub fn move_to(&mut self, row: usize, extend: bool) -> bool
Move the selection to the given row. Ensures the row is visible afterwards.
Trait Implementations§
source§impl<Selection: Clone> Clone for RListState<Selection>
impl<Selection: Clone> Clone for RListState<Selection>
source§fn clone(&self) -> RListState<Selection>
fn clone(&self) -> RListState<Selection>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<Selection: Debug> Debug for RListState<Selection>
impl<Selection: Debug> Debug for RListState<Selection>
source§impl<Selection: Default> Default for RListState<Selection>
impl<Selection: Default> Default for RListState<Selection>
source§fn default() -> RListState<Selection>
fn default() -> RListState<Selection>
source§impl HandleEvent<Event, FocusKeys, Outcome> for RListState<NoSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for RListState<NoSelection>
source§impl HandleEvent<Event, FocusKeys, Outcome> for RListState<RowSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for RListState<RowSelection>
source§impl HandleEvent<Event, FocusKeys, Outcome> for RListState<RowSetSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for RListState<RowSetSelection>
source§impl HandleEvent<Event, MouseOnly, Outcome> for RListState<NoSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for RListState<NoSelection>
source§impl HandleEvent<Event, MouseOnly, Outcome> for RListState<RowSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for RListState<RowSelection>
source§impl HandleEvent<Event, MouseOnly, Outcome> for RListState<RowSetSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for RListState<RowSetSelection>
source§impl<Selection> HasFocusFlag for RListState<Selection>
impl<Selection> HasFocusFlag for RListState<Selection>
source§fn z_areas(&self) -> &[ZRect]
fn z_areas(&self) -> &[ZRect]
source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
source§fn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
source§fn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
source§impl<Selection: PartialEq> PartialEq for RListState<Selection>
impl<Selection: PartialEq> PartialEq for RListState<Selection>
source§fn eq(&self, other: &RListState<Selection>) -> bool
fn eq(&self, other: &RListState<Selection>) -> bool
self and other values to be equal, and is used
by ==.impl<Selection: Eq> Eq for RListState<Selection>
impl<Selection> StructuralPartialEq for RListState<Selection>
Auto Trait Implementations§
impl<Selection> !Freeze for RListState<Selection>
impl<Selection> !RefUnwindSafe for RListState<Selection>
impl<Selection> Send for RListState<Selection>where
Selection: Send,
impl<Selection> !Sync for RListState<Selection>
impl<Selection> Unpin for RListState<Selection>where
Selection: Unpin,
impl<Selection> UnwindSafe for RListState<Selection>where
Selection: 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> 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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