Struct rat_ftable::FTableState

source ·
pub struct FTableState<Selection> {
Show 17 fields pub area: Rect, pub header_area: Rect, pub table_area: Rect, pub row_areas: Vec<Rect>, pub column_areas: Vec<Rect>, pub footer_area: Rect, pub rows: usize, pub columns: usize, pub row_offset: usize, pub col_offset: usize, pub row_page_len: usize, pub col_page_len: usize, pub max_row_offset: usize, pub max_col_offset: usize, pub selection: Selection, pub mouse: MouseFlags, pub non_exhaustive: NonExhaustive,
}
Expand description

FTable state.

Fields§

§area: Rect

Total area.

§header_area: Rect

Total header area.

§table_area: Rect

Total table area.

§row_areas: Vec<Rect>

Area per visible row.

§column_areas: Vec<Rect>

Area per visible column, also contains the following spacer if any.

§footer_area: Rect

Total footer area.

§rows: usize

Row count.

§columns: usize

Column count.

§row_offset: usize

Current row offset. Automatically capped at rows-1.

§col_offset: usize

Current column offset. Automatically capped at columns-1.

§row_page_len: usize

Current page len as items.

§col_page_len: usize

Current page width as columns.

§max_row_offset: usize

Maximum offset for row-scrolling. Can be set higher, but this offset guarantees a full page display.

§max_col_offset: usize

Maximum offset for column-scrolling. Can be set higher, but this offset guarantees a full page display.

§selection: Selection

Selection data.

§mouse: MouseFlags

Helper for mouse interactions.

§non_exhaustive: NonExhaustive

Implementations§

source§

impl<Selection: TableSelection> FTableState<Selection>

source

pub fn cell_at_clicked(&self, pos: Position) -> Option<(usize, usize)>

Cell at given position.

source

pub fn column_at_clicked(&self, pos: Position) -> Option<usize>

Column at given position.

source

pub fn row_at_clicked(&self, pos: Position) -> Option<usize>

Row at given position.

source

pub fn cell_at_drag(&self, pos: Position) -> (usize, usize)

Cell when dragging. Can go outside the area.

source

pub fn row_at_drag(&self, pos: Position) -> usize

Row when dragging. Can go outside the area.

source

pub fn column_at_drag(&self, pos: Position) -> usize

Column when dragging. Can go outside the area.

source

pub fn set_row_offset(&mut self, offset: usize) -> bool

Change the vertical offset. Returns true, if there was some change to the offset, even if clipped.

source

pub fn set_column_offset(&mut self, offset: usize) -> bool

Change the horizontal offset. Returns true, if there was some change to the offset, even if clipped.

source

pub fn scroll_up(&mut self, n: usize) -> bool

Scroll up by n items.

source

pub fn scroll_down(&mut self, n: usize) -> bool

Scroll down by n items.

source

pub fn scroll_left(&mut self, n: usize) -> bool

Scroll up by n items.

source

pub fn scroll_right(&mut self, n: usize) -> bool

Scroll down by n items.

source

pub fn scroll_to_selected(&mut self)

Scroll to selected.

source§

impl FTableState<RowSelection>

source

pub fn selected(&self) -> Option<usize>

source

pub fn select(&mut self, row: Option<usize>)

source

pub fn select_clamped(&mut self, select: usize, maximum: usize)

Select a row, clamp between 0 and maximum.

source§

impl FTableState<RowSetSelection>

source

pub fn selected(&self) -> HashSet<usize>

source

pub fn set_lead(&mut self, lead: Option<usize>, extend: bool)

source

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.

source

pub fn lead(&self) -> Option<usize>

Current lead.

source

pub fn anchor(&self) -> Option<usize>

Current anchor.

source

pub fn clear_selection(&mut self)

Clear the selection.

source

pub fn add_selected(&mut self, idx: usize)

Add to selection.

source

pub fn remove_selected(&mut self, idx: usize)

Remove from selection. Only works for retired selections, not for the active anchor-lead range.

source§

impl FTableState<CellSelection>

source

pub fn selected(&self) -> Option<(usize, usize)>

Selected cell.

source

pub fn select_cell(&mut self, select: Option<(usize, usize)>)

Select a cell.

source

pub fn select_row(&mut self, select: Option<usize>)

Select a row. Column stays the same.

source

pub fn select_column(&mut self, select: Option<usize>)

Select a column, row stays the same.

source

pub fn select_clamped( &mut self, select: (usize, usize), maximum: (usize, usize) )

Select a cell, clamp between 0 and maximum.

Trait Implementations§

source§

impl<Selection: Clone> Clone for FTableState<Selection>

source§

fn clone(&self) -> FTableState<Selection>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Selection: Debug> Debug for FTableState<Selection>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Selection: Default> Default for FTableState<Selection>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl HandleEvent<Event, FocusKeys, Outcome> for FTableState<CellSelection>

source§

fn handle(&mut self, event: &Event, _keymap: FocusKeys) -> Outcome

Handle an event. Read more
source§

impl HandleEvent<Event, FocusKeys, Outcome> for FTableState<NoSelection>

source§

fn handle(&mut self, event: &Event, _keymap: FocusKeys) -> Outcome

Handle an event. Read more
source§

impl HandleEvent<Event, FocusKeys, Outcome> for FTableState<RowSelection>

source§

fn handle(&mut self, event: &Event, _keymap: FocusKeys) -> Outcome

Handle an event. Read more
source§

impl HandleEvent<Event, FocusKeys, Outcome> for FTableState<RowSetSelection>

source§

fn handle(&mut self, event: &Event, _: FocusKeys) -> Outcome

Handle an event. Read more
source§

impl HandleEvent<Event, MouseOnly, Outcome> for FTableState<CellSelection>

source§

fn handle(&mut self, event: &Event, _keymap: MouseOnly) -> Outcome

Handle an event. Read more
source§

impl HandleEvent<Event, MouseOnly, Outcome> for FTableState<NoSelection>

source§

fn handle(&mut self, event: &Event, _keymap: MouseOnly) -> Outcome

Handle an event. Read more
source§

impl HandleEvent<Event, MouseOnly, Outcome> for FTableState<RowSelection>

source§

fn handle(&mut self, event: &Event, _keymap: MouseOnly) -> Outcome

Handle an event. Read more
source§

impl HandleEvent<Event, MouseOnly, Outcome> for FTableState<RowSetSelection>

source§

fn handle(&mut self, event: &Event, _: MouseOnly) -> Outcome

Handle an event. Read more

Auto Trait Implementations§

§

impl<Selection> Freeze for FTableState<Selection>
where Selection: Freeze,

§

impl<Selection> RefUnwindSafe for FTableState<Selection>
where Selection: RefUnwindSafe,

§

impl<Selection> Send for FTableState<Selection>
where Selection: Send,

§

impl<Selection> Sync for FTableState<Selection>
where Selection: Sync,

§

impl<Selection> Unpin for FTableState<Selection>
where Selection: Unpin,

§

impl<Selection> UnwindSafe for FTableState<Selection>
where Selection: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.