pub struct Filmstrip { /* private fields */ }Expand description
A horizontal strip of thumbnails that builds only what shows, so thousands cost the same as a few. Each cell comes from whoever uses it, with its own image, stars or badges; the strip draws the frame around it. A click selects alone, Ctrl or Cmd adds, and Shift takes a range; the arrows, Home and End move and keep the selected cell in view, Space adds, Enter activates. Arrows appear on the ends that have more to show.
use std::collections::BTreeSet;
use ravenrs_reactive::State;
use ravenrs_widgets::{Filmstrip, FilmstripCell, SelectionMode, Text, Ui};
let selected = State::new(BTreeSet::from([0_usize]));
let strip = Filmstrip::new(5_000, |cell: FilmstripCell| Text::new(format!("{}", cell.index + 1)))
.selection(selected.binding())
.mode(SelectionMode::Multiple);
let mut ui = Ui::new(strip, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl Filmstrip
impl Filmstrip
Sourcepub fn new<V>(
count: usize,
cell: impl Fn(FilmstripCell) -> V + 'static,
) -> Filmstripwhere
V: View + 'static,
pub fn new<V>(
count: usize,
cell: impl Fn(FilmstripCell) -> V + 'static,
) -> Filmstripwhere
V: View + 'static,
A strip of count cells, with cell making the view of each one when it shows.
Sourcepub fn key(self, key: impl Fn(usize) -> u64 + 'static) -> Filmstrip
pub fn key(self, key: impl Fn(usize) -> u64 + 'static) -> Filmstrip
What identifies a cell, which is its position by default.
Sourcepub fn selection(self, selection: Binding<BTreeSet<usize>>) -> Filmstrip
pub fn selection(self, selection: Binding<BTreeSet<usize>>) -> Filmstrip
The selected cells, to read and to change from outside. A single one that changes from outside is brought into view.
Sourcepub fn mode(self, mode: SelectionMode) -> Filmstrip
pub fn mode(self, mode: SelectionMode) -> Filmstrip
How cells can be selected (SelectionMode::Single by default).
Sourcepub fn on_activate(self, handler: impl Fn(usize) + 'static) -> Filmstrip
pub fn on_activate(self, handler: impl Fn(usize) + 'static) -> Filmstrip
Called with a cell on a double click or on Enter.
Sourcepub fn cell_name(self, name: impl Fn(usize) -> String + 'static) -> Filmstrip
pub fn cell_name(self, name: impl Fn(usize) -> String + 'static) -> Filmstrip
What screen readers call each cell.
Sourcepub fn cell_width(self, width: f32) -> Filmstrip
pub fn cell_width(self, width: f32) -> Filmstrip
The width of each cell (96 by default).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Filmstrip
impl !Send for Filmstrip
impl !Sync for Filmstrip
impl !UnwindSafe for Filmstrip
impl Freeze for Filmstrip
impl Unpin for Filmstrip
impl UnsafeUnpin for Filmstrip
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> 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> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.