Skip to main content

FileTable

Struct FileTable 

pub struct FileTable<R>
where R: FileRow,
{ /* private fields */ }
Expand description

The file list a host keeps across its rebuilds.

Implementations§

§

impl<R> FileTable<R>
where R: FileRow,

pub fn new(id: &'static str, accessible_name: impl Into<String>) -> FileTable<R>

A list with the accessibility id and accessible_name it is known by. It shows selection; the host decides what a press selects.

pub fn handles_clicks(self) -> FileTable<R>

The list reports a press on a row (FileTableOutcome::click) instead of selecting it itself, so the host’s selection stays the only one.

pub fn handles_row_menu(self) -> FileTable<R>

The list reports a row’s own menu (FileTableOutcome::menu) instead of opening it: a right-press, and the assistance technology’s “show context menu” on the same row, both reach the host, which draws the one menu it has.

pub fn sync(&mut self, inputs: FileTableInputs<'_, R>)

Put this build’s rows, selection and sort into the table, making it first if there is none or the columns changed.

pub fn column_widths(&self) -> Vec<(String, f32)>

The column widths the person set by dragging an edge, by column key: what a host keeps so a resized column is where they left it next time.

pub fn set_column_widths( &mut self, widths: impl IntoIterator<Item = (String, f32)>, )

Lay the columns out at the widths the person set last time. Widths for columns this table does not show are ignored.

pub fn rows(&self) -> Vec<&R>

The rows as the table holds them, in display order.

pub fn reset_scroll(&mut self)

Scroll back to the top (a folder was opened).

pub fn scroll_y(&self) -> f32

The table’s scroll offset.

pub fn set_scroll_y(&mut self, y: f32)

Scroll to y (clamped by the table).

pub fn max_scroll_y(&self) -> f32

The farthest the list can scroll.

pub fn reveal_row(&mut self, index: usize)

Scroll so the row at display index is in view.

pub fn rect(&self) -> Rect

The table’s laid-out rectangle.

pub fn build_layout( &mut self, taffy: &mut TaffyTree, theme: &Theme, ) -> Option<NodeId>

Add the table’s node to taffy, sized to fill its parent.

pub fn apply_layout( &mut self, taffy: &TaffyTree, node: NodeId, origin: Point, ) -> bool

Lay the table out in node, and give it the body height and row height it scrolls by. Returns whether the columns should change with the new width, so the host syncs again.

pub fn place(&mut self, rect: Rect, theme: &Theme) -> bool

Lay the table out in rect on a layout of its own, for a host that places its parts itself. Returns what Self::apply_layout does.

pub fn draw( &mut self, scene: &mut Scene, transform: Affine, text_renderer: &mut TextRenderer, theme: &Theme, presence: &PresenceCtx, )

pub fn handle_event( &mut self, event: &WindowEvent, ctx: &mut EventCtx<'_>, ) -> FileTableOutcome

Forward event to the table and report what its callbacks recorded.

pub fn take_outcome(&mut self) -> FileTableOutcome

What the table’s callbacks recorded since the last read.

pub fn take_row_requests(&mut self) -> (Option<usize>, Option<(usize, Point)>)

What an assistive technology asked of a row since the last read: the row it asked to open, and the row and point it asked a menu for. No pointer event delivers these — they come through the accessibility tree — so a host reads them once a frame, before it lays the next one out, rather than waiting for the next event.

pub fn in_scrollbar(&self, at: Point) -> bool

Whether at is over the table’s scrollbar, which the table keeps for itself.

pub fn select(&mut self, selection: &SelectionModel)

Show selection in the table.

pub fn selection(&self) -> Option<&SelectionModel>

The selection as the table holds it (keyboard movement changes it).

pub fn point_at(&mut self, at: Point, ctx: &mut EventCtx<'_>)

Tell the table where the pointer is, so a press that arrives with no move since the host was rebuilt still lands on the right row.

pub fn update( &mut self, state: &(dyn Any + 'static), path: &(dyn Any + 'static), ) -> bool

pub fn needs_animation_frame(&self) -> bool

pub fn is_layout_dirty(&self) -> bool

pub fn wants_pointer_capture(&self) -> bool

pub fn discard_structure_dirty(&mut self)

The table swaps its retained cell controls on a scroll; a file list has no such cells, so this never asks for a rebuild.

pub fn set_focus(&mut self, focused: bool)

pub fn header_height(&self) -> f64

The header band’s height as the table lays it out.

pub fn row_rects(&self) -> Vec<(usize, Rect)>

Each visible row’s rectangle by display index, read from the table’s accessibility export (the table publishes no row geometry) and clipped to the body below the header band, so a row scrolled half under the header or the bottom edge is only as large as what shows.

pub fn accessibility(&self) -> Option<AccessNode>

The table’s accessibility node.

pub fn perform_action( &mut self, action: &Action, key_path: &[u64], state: &mut Edits<'_>, path: &(dyn Any + 'static), ) -> bool

Run an assistive technology’s action on the table’s row at key_path (empty: the table itself).

pub fn perform_semantic_action( &mut self, target: &str, action: &Action, state: &mut Edits<'_>, path: &(dyn Any + 'static), ) -> bool

Run an assistive technology’s action on the synthetic row the semantic target target names: the row an access node forwarded from this table addresses.

Auto Trait Implementations§

§

impl<R> !Freeze for FileTable<R>

§

impl<R> !RefUnwindSafe for FileTable<R>

§

impl<R> !Send for FileTable<R>

§

impl<R> !Sync for FileTable<R>

§

impl<R> Unpin for FileTable<R>

§

impl<R> UnsafeUnpin for FileTable<R>

§

impl<R> !UnwindSafe for FileTable<R>

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
§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,