Struct rat_widget::table::RTableState

source ·
pub struct RTableState<Selection> {
    pub widget: FTableState<Selection>,
    pub non_exhaustive: NonExhaustive,
}

Fields§

§widget: FTableState<Selection>§non_exhaustive: NonExhaustive

Implementations§

source§

impl<Selection> RTableState<Selection>

source

pub fn rows(&self) -> usize

Number of rows.

source

pub fn columns(&self) -> usize

Number of columns.

source

pub fn row_cells(&self, row: usize) -> Option<(Rect, Vec<Rect>)>

Returns the column-areas for the given row, if it is visible.

Attention: These areas might be 0-length if the column is scrolled beyond the table-area.

See: rat_ftable::FTableState::scroll_to

source

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

Cell at given position.

source

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

Column at given position.

source

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

Row at given position.

source

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

Cell when dragging. Can go outside the area.

source

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

Row when dragging. Can go outside the area.

source

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

Column when dragging. Can go outside the area.

source

pub fn clear_offset(&mut self)

Sets both offsets to 0.

source§

impl<Selection: TableSelection> RTableState<Selection>

source

pub fn scroll_to_selected(&mut self)

Scroll to selected.

source

pub fn scroll_to(&mut self, pos: (usize, usize))

Scroll to position.

source§

impl RTableState<RowSelection>

source

pub fn set_scroll_selection(&mut self, scroll: bool)

Scroll selection instead of offset.

source

pub fn scroll_selection(&self) -> bool

Scroll selection instead of offset.

source

pub fn clear(&mut self)

Clear offsets and selection.

source

pub fn clear_selection(&mut self)

source

pub fn has_selection(&mut self) -> bool

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 RTableState<RowSetSelection>

source

pub fn clear(&mut self)

Clear offsets and selection.

source

pub fn clear_selection(&mut self)

Clear the selection.

source

pub fn has_selection(&mut self) -> bool

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 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 RTableState<CellSelection>

source

pub fn clear(&mut self)

Clear offsets and selection.

source

pub fn clear_selection(&mut self)

source

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

Selected cell.

source

pub fn has_selection(&mut self) -> bool

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 RTableState<Selection>

source§

fn clone(&self) -> RTableState<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 RTableState<Selection>

source§

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

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

impl<Selection: Default> Default for RTableState<Selection>

source§

fn default() -> Self

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

impl<Selection> HandleEvent<Event, DoubleClick, DoubleClickOutcome> for RTableState<Selection>

source§

fn handle(&mut self, event: &Event, _keymap: DoubleClick) -> DoubleClickOutcome

Handle an event. Read more
source§

impl<Selection> HandleEvent<Event, EditKeys, EditOutcome> for RTableState<Selection>

source§

fn handle(&mut self, event: &Event, _keymap: EditKeys) -> EditOutcome

Handle an event. Read more
source§

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

source§

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

Handle an event. Read more
source§

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

source§

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

Handle an event. Read more
source§

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

source§

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

Handle an event. Read more
source§

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

source§

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

Handle an event. Read more
source§

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

source§

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

Handle an event. Read more
source§

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

source§

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

Handle an event. Read more
source§

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

source§

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

Handle an event. Read more
source§

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

source§

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

Handle an event. Read more
source§

impl<Selection> HasFocusFlag for RTableState<Selection>

source§

fn focus(&self) -> &FocusFlag

Access to the flag for the rest.
source§

fn area(&self) -> Rect

Access the area for mouse focus.
source§

fn is_focused(&self) -> bool

Focused?
source§

fn lost_focus(&self) -> bool

Just lost focus.
source§

fn gained_focus(&self) -> bool

Just gained focus.
source§

impl<Selection: TableSelection> ScrollingState for RTableState<Selection>

source§

fn vertical_max_offset(&self) -> usize

Maximum offset that is accessible with scrolling. Read more
source§

fn vertical_offset(&self) -> usize

Current vertical offset.
source§

fn vertical_page(&self) -> usize

Vertical page-size at the current offset.
source§

fn vertical_scroll(&self) -> usize

Suggested scroll per scroll-event.
source§

fn horizontal_max_offset(&self) -> usize

Maximum offset that is accessible with scrolling. Read more
source§

fn horizontal_offset(&self) -> usize

Current horizontal offset.
source§

fn horizontal_page(&self) -> usize

Horizontal page-size at the current offset.
source§

fn horizontal_scroll(&self) -> usize

Suggested scroll per scroll-event.
source§

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

Change the horizontal offset. Read more
source§

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

Scroll down by n items. The widget returns true if the offset changed at all.
source§

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

Scroll down by n items. The widget returns true if the offset changed at all.
source§

impl<'a, Selection> ScrollingWidget<RTableState<Selection>> for RTable<'a, Selection>

source§

fn need_scroll( &self, area: Rect, _state: &mut RTableState<Selection>, ) -> (bool, bool)

Widget wants a (horizontal, vertical) scrollbar. This gets combined with the ScrollbarPolicy.

Auto Trait Implementations§

§

impl<Selection> !Freeze for RTableState<Selection>

§

impl<Selection> !RefUnwindSafe for RTableState<Selection>

§

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

§

impl<Selection> !Sync for RTableState<Selection>

§

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

§

impl<Selection> UnwindSafe for RTableState<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.