pub struct DatePickerState { /* private fields */ }Expand description
Use to store the state of the date picker.
Implementations§
Source§impl DatePickerState
impl DatePickerState
Sourcepub fn range(window: &mut Window, cx: &mut Context<'_, Self>) -> Self
pub fn range(window: &mut Window, cx: &mut Context<'_, Self>) -> Self
Create a date state with range mode.
Sourcepub fn date_format(self, format: impl Into<SharedString>) -> Self
pub fn date_format(self, format: impl Into<SharedString>) -> Self
Set the format of the value displayed in the picker.
Default: %Y/%m/%d, followed by the time in the configured precision
and hour cycle when the picker edits times, e.g. %H:%M or %I:%M %p.
Sourcepub fn time_precision(self, precision: TimePrecision) -> Self
pub fn time_precision(self, precision: TimePrecision) -> Self
Edit the time of day as well as the date, down to precision.
Selecting a date then keeps the popup open, and every change to the date or time is reported as it happens. Clicking the selected date again closes the popup.
A range picker edits dates only; for a range with times, place two single pickers side by side.
Sourcepub fn hour_cycle(self, hour_cycle: HourCycle) -> Self
pub fn hour_cycle(self, hour_cycle: HourCycle) -> Self
Set how the time field counts hours, default: HourCycle::H23.
Sourcepub fn default_time(self, time: NaiveTime) -> Self
pub fn default_time(self, time: NaiveTime) -> Self
Set the time given to a date before the user edits it, default: 00:00.
Sourcepub fn number_of_months(self, number_of_months: usize) -> Self
pub fn number_of_months(self, number_of_months: usize) -> Self
Set the number of months calendar view to display, default is 1.
Sourcepub fn first_day_of_week(self, day: Weekday) -> Self
pub fn first_day_of_week(self, day: Weekday) -> Self
Set the first day of the week.
Sourcepub fn set_date(
&mut self,
date: impl Into<Date>,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_date( &mut self, date: impl Into<Date>, window: &mut Window, cx: &mut Context<'_, Self>, )
Set the date, keeping the current time of day.
Sourcepub fn set_date_time(
&mut self,
value: impl Into<DateTime>,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_date_time( &mut self, value: impl Into<DateTime>, window: &mut Window, cx: &mut Context<'_, Self>, )
Set the date and the time of day.
Sourcepub fn disabled_matcher(self, disabled: impl Into<Matcher>) -> Self
pub fn disabled_matcher(self, disabled: impl Into<Matcher>) -> Self
Set the disabled match for the calendar.
Sourcepub fn set_year_range(&mut self, range: (i32, i32), cx: &mut Context<'_, Self>)
pub fn set_year_range(&mut self, range: (i32, i32), cx: &mut Context<'_, Self>)
Set the year range for the internal calendar.
Default is 50 years before and after the current year.
range uses a half-open interval (start, end) where end is exclusive.
Trait Implementations§
impl EventEmitter<DatePickerEvent> for DatePickerState
Source§impl Focusable for DatePickerState
impl Focusable for DatePickerState
Source§fn focus_handle(&self, _: &App) -> FocusHandle
fn focus_handle(&self, _: &App) -> FocusHandle
Source§impl Render for DatePickerState
impl Render for DatePickerState
Auto Trait Implementations§
impl !RefUnwindSafe for DatePickerState
impl !Send for DatePickerState
impl !Sync for DatePickerState
impl !UnwindSafe for DatePickerState
impl Freeze for DatePickerState
impl Unpin for DatePickerState
impl UnsafeUnpin for DatePickerState
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