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>) -> Self
pub fn new(year: Binding<i32>) -> Self
The year in year, which its buttons and the keyboard also change.
Sourcepub fn marks(self, marks: impl Fn(Date) -> Option<DayMark> + 'static) -> Self
pub fn marks(self, marks: impl Fn(Date) -> Option<DayMark> + 'static) -> Self
Says which days have something. It is asked for each day on each build.
Sourcepub fn on_pick(self, handler: impl Fn(Date) + 'static) -> Self
pub fn on_pick(self, handler: impl Fn(Date) + 'static) -> Self
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§
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<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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.