pub struct MacCollectionView<'a, T> { /* private fields */ }Expand description
Authentic macOS Collection View (NSCollectionView equivalent).
§Example
use std::collections::BTreeSet;
use egui_macview::{MacAppearance, MacCollectionView, MacTheme};
let theme = MacTheme::new(MacAppearance::Aqua);
let items = ["Tile 1", "Tile 2", "Tile 3", "Tile 4"];
let mut selected = BTreeSet::from([0usize]);
MacCollectionView::new(&items, &mut selected)
.theme(&theme)
.show_with_response(ui, |tile_ui, label| {
tile_ui.centered_and_justified(|ui| {
ui.label(*label);
});
});Implementations§
Source§impl<'a, T> MacCollectionView<'a, T>
impl<'a, T> MacCollectionView<'a, T>
Sourcepub fn new(items: &'a [T], selected_indices: &'a mut BTreeSet<usize>) -> Self
pub fn new(items: &'a [T], selected_indices: &'a mut BTreeSet<usize>) -> Self
Creates a new collection view bound to an item slice and a mutable selection set.
Sourcepub fn layout(self, layout: MacCollectionViewFlowLayout) -> Self
pub fn layout(self, layout: MacCollectionViewFlowLayout) -> Self
Overrides flow layout parameters.
Sourcepub fn show_with_response<F>(
self,
ui: &mut Ui,
render_item: F,
) -> (usize, Response)
pub fn show_with_response<F>( self, ui: &mut Ui, render_item: F, ) -> (usize, Response)
Shows the collection view and returns count of rendered items within the clip rect along with interaction response.
Sourcepub fn show_with_item_tracker<F>(self, ui: &mut Ui, render_item: F) -> usize
pub fn show_with_item_tracker<F>(self, ui: &mut Ui, render_item: F) -> usize
Shows the collection view and returns count of rendered items within the clip rect.
Auto Trait Implementations§
impl<'a, T> !UnwindSafe for MacCollectionView<'a, T>
impl<'a, T> Forget for MacCollectionView<'a, T>
impl<'a, T> Freeze for MacCollectionView<'a, T>
impl<'a, T> RefUnwindSafe for MacCollectionView<'a, T>where
&'a [T]: RefUnwindSafe,
impl<'a, T> Send for MacCollectionView<'a, T>
impl<'a, T> Sync for MacCollectionView<'a, T>
impl<'a, T> Unpin for MacCollectionView<'a, T>
impl<'a, T> UnsafeUnpin for MacCollectionView<'a, T>where
&'a [T]: UnsafeUnpin,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 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> ⓘ
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