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,
impl<R> FileTable<R>where
R: FileRow,
pub fn new(id: &'static str, accessible_name: impl Into<String>) -> FileTable<R>
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>
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.
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>)
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)>
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)>,
)
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 reset_scroll(&mut self)
pub fn reset_scroll(&mut self)
Scroll back to the top (a folder was opened).
pub fn set_scroll_y(&mut self, y: f32)
pub fn set_scroll_y(&mut self, y: f32)
Scroll to y (clamped by the table).
pub fn max_scroll_y(&self) -> f32
pub fn max_scroll_y(&self) -> f32
The farthest the list can scroll.
pub fn reveal_row(&mut self, index: usize)
pub fn reveal_row(&mut self, index: usize)
Scroll so the row at display index is in view.
pub fn build_layout(
&mut self,
taffy: &mut TaffyTree,
theme: &Theme,
) -> Option<NodeId>
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
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
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
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
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)>)
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
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)
pub fn select(&mut self, selection: &SelectionModel)
Show selection in the table.
pub fn selection(&self) -> Option<&SelectionModel>
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<'_>)
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)
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
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)>
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>
pub fn accessibility(&self) -> Option<AccessNode>
The table’s accessibility node.
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> 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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 Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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