Skip to main content

TableNav

Struct TableNav 

Source
pub struct TableNav {
    pub active_row: usize,
    pub active_col: usize,
}
Expand description

Keyboard navigation state — tracks the active (focused) cell.

Row and column indices here are visible indices (after filter / sort), not source indices. The caller is responsible for converting to source indices when fetching cell data.

Fields§

§active_row: usize

The currently focused row in the visible (filtered/sorted) row set.

§active_col: usize

The currently focused column in the visible column order.

Implementations§

Source§

impl TableNav

Source

pub fn new() -> Self

Create a new TableNav positioned at the top-left cell.

Source

pub fn move_up(&mut self, total_rows: usize) -> bool

Move focus one row up. Returns true if the position changed.

Clamps at row 0; no-op when total_rows is zero.

Source

pub fn move_down(&mut self, total_rows: usize) -> bool

Move focus one row down. Returns true if the position changed.

Clamps at total_rows - 1; no-op when total_rows is zero.

Source

pub fn move_left(&mut self, total_cols: usize) -> bool

Move focus one column left. Returns true if the position changed.

Clamps at column 0; no-op when total_cols is zero.

Source

pub fn move_right(&mut self, total_cols: usize) -> bool

Move focus one column right. Returns true if the position changed.

Clamps at total_cols - 1; no-op when total_cols is zero.

Source

pub fn move_home_row(&mut self) -> bool

Move focus to the first visible row. Returns true if the position changed.

Source

pub fn move_end_row(&mut self, total_rows: usize) -> bool

Move focus to the last visible row. Returns true if the position changed.

No-op when total_rows is zero.

Source

pub fn page_up(&mut self, page_size: usize) -> bool

Scroll focus up by page_size rows (Page Up).

Clamps at row 0. Returns true if the position changed.

Source

pub fn page_down(&mut self, total_rows: usize, page_size: usize) -> bool

Scroll focus down by page_size rows (Page Down).

Clamps at total_rows - 1. Returns true if the position changed. No-op when total_rows is zero.

Source

pub fn set_position(&mut self, row: usize, col: usize)

Set the active cell position explicitly (e.g. on mouse click).

Trait Implementations§

Source§

impl Clone for TableNav

Source§

fn clone(&self) -> TableNav

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TableNav

Source§

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

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

impl Default for TableNav

Source§

fn default() -> TableNav

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

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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>,

Source§

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>,

Source§

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.