pub struct Calendar { /* private fields */ }Expand description
A month of days.
Implementations§
Source§impl Calendar
impl Calendar
pub fn new( ident: impl Into<Ident>, adapter: SharedDateAdapter, _window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
Sourcepub fn selected(self, days: impl IntoIterator<Item = Day>) -> Self
pub fn selected(self, days: impl IntoIterator<Item = Day>) -> Self
Seeds the days the caller says are chosen.
Sourcepub fn multi(self, multi: bool) -> Self
pub fn multi(self, multi: bool) -> Self
Whether more than one day may be chosen. The calendar reports either way; this only decides what it draws and publishes.
Sourcepub fn month(self, month: MonthKey) -> Self
pub fn month(self, month: MonthKey) -> Self
The month to open on, for a calendar whose host knows where it wants to start but has nothing selected and no today.
Sourcepub fn overlay(self, overlay: impl Fn(Day) -> Option<DayMark> + 'static) -> Self
pub fn overlay(self, overlay: impl Fn(Day) -> Option<DayMark> + 'static) -> Self
Marks days with a dot the host supplies.
Sourcepub fn range(self, range: DayRange) -> Self
pub fn range(self, range: DayRange) -> Self
Draws a range across the grid, with its endpoints picked out.
pub fn set_selection(&mut self, days: Vec<Day>, cx: &mut Context<'_, Self>)
pub fn set_overlay( &mut self, overlay: impl Fn(Day) -> Option<DayMark> + 'static, cx: &mut Context<'_, Self>, )
Sourcepub fn set_range(&mut self, range: Option<DayRange>, cx: &mut Context<'_, Self>)
pub fn set_range(&mut self, range: Option<DayRange>, cx: &mut Context<'_, Self>)
A RangePicker pushes its caller’s range down on every frame, so this
has to be quiet when nothing moved or the two of them redraw each other
forever.
pub fn set_disabled(&mut self, disabled: bool, cx: &mut Context<'_, Self>)
Sourcepub fn set_hovered_day(&mut self, day: Option<Day>, cx: &mut Context<'_, Self>)
pub fn set_hovered_day(&mut self, day: Option<Day>, cx: &mut Context<'_, Self>)
Pins what the pointer is over, so a range preview can be staged for review without a pointer in the window.
pub fn adapter(&self) -> &SharedDateAdapter
pub fn selection(&self) -> &[Day]
pub fn cursor(&self) -> Option<Day>
pub fn hovered_day(&self) -> Option<Day>
Sourcepub fn shown_month(&self) -> Option<MonthKey>
pub fn shown_month(&self) -> Option<MonthKey>
The month on screen, or None when nothing has established one.
Navigation, then the caller’s month, then the first selected day, then today. A calendar with none of those does not invent one.
Sourcepub fn shift(&mut self, delta: i32, cx: &mut Context<'_, Self>)
pub fn shift(&mut self, delta: i32, cx: &mut Context<'_, Self>)
Moves the month through the adapter. Nothing here adds or subtracts.
pub fn show_month(&mut self, month: MonthKey, cx: &mut Context<'_, Self>)
Trait Implementations§
impl EventEmitter<CalendarEvent> for Calendar
Source§impl Focusable for Calendar
impl Focusable for Calendar
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Auto Trait Implementations§
impl !RefUnwindSafe for Calendar
impl !Send for Calendar
impl !Sync for Calendar
impl !UnwindSafe for Calendar
impl Freeze for Calendar
impl Unpin for Calendar
impl UnsafeUnpin for Calendar
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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