pub struct YearView { /* private fields */ }Expand description
The twelve months of a year, with a dot on the days that have something and a click on any of them. As many months go on a line as fit. From the keyboard the year is one Tab stop: arrows move by day and week, Home and End to the ends of the week, Page Up and Page Down by month, and Enter or Space picks.
use ravenrs_reactive::State;
use ravenrs_widgets::{Date, DayMark, Ui, YearView};
let year = State::new(2026);
let view = YearView::new(year.binding())
.today(Date::new(2026, 11, 5).unwrap())
.marks(|day| (day.day() == 1).then(DayMark::new))
.on_pick(|day| println!("{day}"));
let mut ui = Ui::new(view, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl YearView
impl YearView
Sourcepub fn new(year: Binding<i32>) -> YearView
pub fn new(year: Binding<i32>) -> YearView
The year in year, which its buttons and the keyboard also change.
Sourcepub fn selected(self, selected: Binding<Option<Date>>) -> YearView
pub fn selected(self, selected: Binding<Option<Date>>) -> YearView
The chosen day, shown filled.
Sourcepub fn marks(
self,
marks: impl Fn(Date) -> Option<DayMark> + 'static,
) -> YearView
pub fn marks( self, marks: impl Fn(Date) -> Option<DayMark> + 'static, ) -> YearView
Says which days have something. It is asked for each day on each build.
Sourcepub fn on_pick(self, handler: impl Fn(Date) + 'static) -> YearView
pub fn on_pick(self, handler: impl Fn(Date) + 'static) -> YearView
Called with a day on a click, or on Enter or Space.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for YearView
impl !Send for YearView
impl !Sync for YearView
impl !UnwindSafe for YearView
impl Freeze for YearView
impl Unpin for YearView
impl UnsafeUnpin for YearView
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.