pub struct ScrollEdgeArrow<C> { /* private fields */ }Expand description
A strip that scrolls, with an arrow over a fade at each end that has more to show. The arrow scrolls most of the strip at a time, and leaves when that end is reached.
The strip is horizontal unless ScrollEdgeArrow::vertical. Children keep their size
when they have one, so give them a width: without it they share the room first, as in any
row, down to what their content needs. Every scroll builds the strip again to know
whether an arrow still applies, so what goes in should be cheap to build.
use ravenrs_widgets::{Button, ScrollEdgeArrow, Ui};
let photos: Vec<Button> = (1..=30).map(|n| Button::new(format!("Photo {n}"))).collect();
let strip = ScrollEdgeArrow::new(photos).spacing(8.0);
let mut ui = Ui::new(strip, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl<C> ScrollEdgeArrow<C>where
C: ViewSeq,
impl<C> ScrollEdgeArrow<C>where
C: ViewSeq,
Sourcepub fn new(children: C) -> ScrollEdgeArrow<C>
pub fn new(children: C) -> ScrollEdgeArrow<C>
A horizontal strip of children (a tuple of up to 12 views or a Vec).
Sourcepub fn vertical(self) -> ScrollEdgeArrow<C>
pub fn vertical(self) -> ScrollEdgeArrow<C>
Scrolls up and down, taking the height its parent gives it.
Sourcepub fn spacing(self, spacing: f32) -> ScrollEdgeArrow<C>
pub fn spacing(self, spacing: f32) -> ScrollEdgeArrow<C>
Gap between children, in logical pixels (default 8).
Sourcepub fn padding(self, padding: impl Into<Insets>) -> ScrollEdgeArrow<C>
pub fn padding(self, padding: impl Into<Insets>) -> ScrollEdgeArrow<C>
Inner padding in logical pixels.
Sourcepub fn height(self, height: f32) -> ScrollEdgeArrow<C>
pub fn height(self, height: f32) -> ScrollEdgeArrow<C>
A fixed height. A horizontal strip takes the height of its children by default.
Sourcepub fn fade(self, fade: Semantic) -> ScrollEdgeArrow<C>
pub fn fade(self, fade: Semantic) -> ScrollEdgeArrow<C>
The color the arrows fade from, which should be what is behind the strip
(Semantic::Canvas by default).
Trait Implementations§
Source§impl<C> Debug for ScrollEdgeArrow<C>
impl<C> Debug for ScrollEdgeArrow<C>
Auto Trait Implementations§
impl<C> Freeze for ScrollEdgeArrow<C>where
C: Freeze,
impl<C> RefUnwindSafe for ScrollEdgeArrow<C>where
C: RefUnwindSafe,
impl<C> Send for ScrollEdgeArrow<C>where
C: Send,
impl<C> Sync for ScrollEdgeArrow<C>where
C: Sync,
impl<C> Unpin for ScrollEdgeArrow<C>where
C: Unpin,
impl<C> UnsafeUnpin for ScrollEdgeArrow<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for ScrollEdgeArrow<C>where
C: UnwindSafe,
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.