Struct rat_widget::list::RListState
source · pub struct RListState<Selection> {
pub len: usize,
pub v_offset: usize,
pub v_max_offset: usize,
pub v_page_len: usize,
pub area: Rect,
pub inner: Rect,
pub item_areas: Vec<Rect>,
pub focus: FocusFlag,
pub selection: Selection,
pub mouse: MouseFlags,
}Fields§
§len: usizeLength in items.
v_offset: usizeOffset
v_max_offset: usizeMax offset for full page.
v_page_len: usizePage length
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 with_offset(self, offset: usize) -> Self
pub fn offset(&self) -> usize
pub fn offset_mut(&mut self) -> &mut usize
pub fn row_at_clicked(&self, pos: Position) -> Option<usize>
sourcepub fn row_at_drag(&self, pos: Position) -> usize
pub fn row_at_drag(&self, pos: Position) -> usize
Row when dragging. Can go outside the area.
sourcepub fn scroll_to_selected(&mut self)
pub fn scroll_to_selected(&mut self)
Scroll to selected.
pub fn selection(&self) -> &Selection
pub fn selection_mut(&mut self) -> &mut Selection
source§impl RListState<RowSetSelection>
impl RListState<RowSetSelection>
pub fn selected(&self) -> HashSet<usize>
pub fn set_lead(&mut self, lead: Option<usize>, extend: bool)
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 clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear the selection.
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.
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>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>
Returns the “default value” for a type. Read more
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§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
This method tests for
self and other values to be equal, and is used
by ==.source§impl<Selection> ScrollingState for RListState<Selection>
impl<Selection> ScrollingState for RListState<Selection>
source§fn vertical_max_offset(&self) -> usize
fn vertical_max_offset(&self) -> usize
Maximum offset that is accessible with scrolling. Read more
source§fn vertical_offset(&self) -> usize
fn vertical_offset(&self) -> usize
Current vertical offset.
source§fn vertical_page(&self) -> usize
fn vertical_page(&self) -> usize
Vertical page-size at the current offset.
source§fn horizontal_max_offset(&self) -> usize
fn horizontal_max_offset(&self) -> usize
Maximum offset that is accessible with scrolling. Read more
source§fn horizontal_offset(&self) -> usize
fn horizontal_offset(&self) -> usize
Current horizontal offset.
source§fn horizontal_page(&self) -> usize
fn horizontal_page(&self) -> usize
Horizontal page-size at the current offset.
source§fn set_vertical_offset(&mut self, offset: usize) -> bool
fn set_vertical_offset(&mut self, offset: usize) -> bool
Change the vertical offset. Read more
source§fn set_horizontal_offset(&mut self, _offset: usize) -> bool
fn set_horizontal_offset(&mut self, _offset: usize) -> bool
Change the horizontal offset. Read more
source§fn vertical_scroll(&self) -> usize
fn vertical_scroll(&self) -> usize
Suggested scroll per scroll-event.
source§fn horizontal_scroll(&self) -> usize
fn horizontal_scroll(&self) -> usize
Suggested scroll per scroll-event.
source§fn scroll_up(&mut self, n: usize) -> bool
fn scroll_up(&mut self, n: usize) -> bool
Scroll up by n items.
The widget returns true if the offset changed at all.
source§fn scroll_down(&mut self, n: usize) -> bool
fn scroll_down(&mut self, n: usize) -> bool
Scroll down by n items.
The widget returns true if the offset changed at all.
source§fn scroll_left(&mut self, n: usize) -> bool
fn scroll_left(&mut self, n: usize) -> bool
Scroll up by n items.
The widget returns true if the offset changed at all.
source§fn scroll_right(&mut self, n: usize) -> bool
fn scroll_right(&mut self, n: usize) -> bool
Scroll down by n items.
The widget returns true if the offset changed at all.
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
Mutably borrows from an owned value. Read more
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>
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