pub struct ThumbnailGrid { /* private fields */ }Expand description
thumbnail_grid with its options: where it keeps its scrolling, how
high it gets, and a cell to bring into view, drawn or not.
use egui_pop_core::thumbnail::{Thumbnail, ThumbnailGrid};
fn ui(ui: &mut egui::Ui, cursor: usize) {
let columns = ThumbnailGrid::new(10_000, egui::vec2(96.0, 72.0))
.id_salt("photos")
.max_height(300.0)
.reveal(Some(cursor))
.show(ui, |ui, i| {
ui.add(Thumbnail::new(format!("Image {i}")).selected(i == cursor));
});
// Up and Down move the cursor by `columns`.
let _ = columns;
}Need (image): a grid of thumbnails.
Implementations§
Source§impl ThumbnailGrid
impl ThumbnailGrid
Sourcepub fn new(count: usize, cell: Vec2) -> ThumbnailGrid
pub fn new(count: usize, cell: Vec2) -> ThumbnailGrid
A grid of count cells of size cell.
Sourcepub fn rubber_band(self, on: bool) -> ThumbnailGrid
pub fn rubber_band(self, on: bool) -> ThumbnailGrid
A drag from the room around the cells draws a rubber band
(Finder’s, Explorer’s), which ThumbnailGrid::show_with_band
tells: the cells it touches, scrolled away or not.
Sourcepub fn id_salt(self, salt: impl AsIdSalt) -> ThumbnailGrid
pub fn id_salt(self, salt: impl AsIdSalt) -> ThumbnailGrid
What tells its scrolling from another grid’s in the same Ui.
Sourcepub fn max_height(self, height: f32) -> ThumbnailGrid
pub fn max_height(self, height: f32) -> ThumbnailGrid
The most it takes in height.
Sourcepub fn reveal(self, cell: Option<usize>) -> ThumbnailGrid
pub fn reveal(self, cell: Option<usize>) -> ThumbnailGrid
Scrolls by the least that shows this cell, which may not be drawn yet: for a keyboard moving through a long grid.
Sourcepub fn room(ui: &Ui) -> (f32, f32)
pub fn room(ui: &Ui) -> (f32, f32)
The room a grid drawn in ui lays its cells out in: its width
(the scroll bar aside) and the gap between cells. n cells of
(width + gap) / n - gap points fill a row.
Sourcepub fn show(self, ui: &mut Ui, item: impl FnMut(&mut Ui, usize)) -> usize
pub fn show(self, ui: &mut Ui, item: impl FnMut(&mut Ui, usize)) -> usize
Draws the rows in view, item drawing cell i. Gives the number of
cells in a row, what a move up or down skips.
Sourcepub fn show_with_band(
self,
ui: &mut Ui,
item: impl FnMut(&mut Ui, usize),
) -> GridOutput
pub fn show_with_band( self, ui: &mut Ui, item: impl FnMut(&mut Ui, usize), ) -> GridOutput
ThumbnailGrid::show, telling the rubber band too.
Trait Implementations§
Source§impl Clone for ThumbnailGrid
impl Clone for ThumbnailGrid
Source§fn clone(&self) -> ThumbnailGrid
fn clone(&self) -> ThumbnailGrid
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ThumbnailGrid
impl RefUnwindSafe for ThumbnailGrid
impl Send for ThumbnailGrid
impl Sync for ThumbnailGrid
impl Unpin for ThumbnailGrid
impl UnsafeUnpin for ThumbnailGrid
impl UnwindSafe for ThumbnailGrid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> DowncastSync for T
impl<T> DowncastSync for T
§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§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.