pub struct TimeFieldState { /* private fields */ }Expand description
Retained editing behavior for a segmented time field.
The field is one Tab stop. Inside it, one segment is selected at a time:
Up/Down step the selected segment and wrap within it (no carry into the
next unit), Left/Right and Tab/Shift-Tab move between segments, digits are
typed with a two-digit buffer that advances to the next segment once no
further digit could fit, a/p set the AM/PM segment, and
Backspace/Delete reset the segment.
The owner supplies the value with TimeFieldState::set_time, which does
not emit; user edits emit TimeFieldEvent::Change.
Implementations§
Source§impl TimeFieldState
impl TimeFieldState
pub fn new(_: &mut Window, cx: &mut Context<'_, Self>) -> Self
Sourcepub fn precision(self, precision: TimePrecision) -> Self
pub fn precision(self, precision: TimePrecision) -> Self
Set the precision, default: TimePrecision::Minute.
pub fn set_precision( &mut self, precision: TimePrecision, _: &mut Window, cx: &mut Context<'_, Self>, )
Sourcepub fn hour_cycle(self, hour_cycle: HourCycle) -> Self
pub fn hour_cycle(self, hour_cycle: HourCycle) -> Self
Set the hour cycle, default: HourCycle::H23.
pub fn set_hour_cycle( &mut self, hour_cycle: HourCycle, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn time(&self) -> NaiveTime
Sourcepub fn set_time(
&mut self,
time: NaiveTime,
_: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_time( &mut self, time: NaiveTime, _: &mut Window, cx: &mut Context<'_, Self>, )
Replace the time without emitting TimeFieldEvent::Change.
Sourcepub fn selected_segment(&self) -> TimeSegment
pub fn selected_segment(&self) -> TimeSegment
The segment that keyboard editing applies to.
pub fn focus(&self, window: &mut Window, cx: &mut App)
Trait Implementations§
impl EventEmitter<TimeFieldEvent> for TimeFieldState
Source§impl Focusable for TimeFieldState
impl Focusable for TimeFieldState
Source§fn focus_handle(&self, _: &App) -> FocusHandle
fn focus_handle(&self, _: &App) -> FocusHandle
Source§impl Render for TimeFieldState
impl Render for TimeFieldState
Auto Trait Implementations§
impl !RefUnwindSafe for TimeFieldState
impl !UnwindSafe for TimeFieldState
impl Freeze for TimeFieldState
impl Send for TimeFieldState
impl Sync for TimeFieldState
impl Unpin for TimeFieldState
impl UnsafeUnpin for TimeFieldState
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