pub struct CardView { /* private fields */ }Expand description
Records as cards, in as many columns as fit, of which only those in sight are built. Arrows move between cards, Enter opens one and Space selects it.
use ravenrs_widgets::{AnyView, CardView, Text, Ui};
let cards = CardView::new(10_000, |i| Box::new(Text::new(format!("Card {i}"))) as AnyView).height(400.0);
let mut ui = Ui::new(cards, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl CardView
impl CardView
Sourcepub fn new(
count: usize,
card: impl Fn(usize) -> Box<dyn View> + 'static,
) -> CardView
pub fn new( count: usize, card: impl Fn(usize) -> Box<dyn View> + 'static, ) -> CardView
count cards, each the view card gives for its index.
Sourcepub fn card_width(self, width: f32) -> CardView
pub fn card_width(self, width: f32) -> CardView
The narrowest a card gets; they share what is left over. 240 by default.
Sourcepub fn card_height(self, height: f32) -> CardView
pub fn card_height(self, height: f32) -> CardView
Height of every card in logical pixels. 160 by default.
Sourcepub fn height(self, height: f32) -> CardView
pub fn height(self, height: f32) -> CardView
Scrolls inside this height. Without it, the view fills what its parent gives.
Sourcepub fn selection_mode(self, mode: SelectionMode) -> CardView
pub fn selection_mode(self, mode: SelectionMode) -> CardView
How cards are selected. One at a time by default.
Sourcepub fn on_open(self, handler: impl Fn(usize) + 'static) -> CardView
pub fn on_open(self, handler: impl Fn(usize) + 'static) -> CardView
Runs with the index on Enter or on a double click.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CardView
impl !Send for CardView
impl !Sync for CardView
impl !UnwindSafe for CardView
impl Freeze for CardView
impl Unpin for CardView
impl UnsafeUnpin for CardView
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
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
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>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.