pub struct MonthState<Selection = SingleSelection> {
pub area: Rect,
pub inner: Rect,
pub area_cal: Rect,
pub area_days: [Rect; 31],
pub area_weeknum: Rect,
pub area_weeks: [Rect; 6],
pub selection: Rc<RefCell<Selection>>,
pub container: Option<FocusFlag>,
pub focus: FocusFlag,
pub mouse: MouseFlagsN,
pub non_exhaustive: NonExhaustive,
/* private fields */
}Expand description
State & event-handling.
Fields§
§area: RectTotal area. readonly. renewed for each render.
inner: RectArea inside the border. readonly. renewed for each render.
area_cal: RectArea of the main calendar. readonly. renewed for each render.
area_days: [Rect; 31]Area for the days of the month. readonly. renewed for each render.
area_weeknum: RectArea for all the week numbers. readonly. renewed for each render.
area_weeks: [Rect; 6]Area for the week numbers. readonly. renewed for each render.
selection: Rc<RefCell<Selection>>Selection model. The selection model can be shared with other Month widgets.
container: Option<FocusFlag>Set to the container-focus if part of a container. read+write
focus: FocusFlagFocus read+write
mouse: MouseFlagsNMouse flags read+write
non_exhaustive: NonExhaustiveImplementations§
Source§impl<Selection> MonthState<Selection>
impl<Selection> MonthState<Selection>
pub fn new() -> Selfwhere
Selection: Default,
pub fn named(name: &str) -> Selfwhere
Selection: Default,
Sourcepub fn set_start_date(&mut self, date: NaiveDate) -> bool
pub fn set_start_date(&mut self, date: NaiveDate) -> bool
Sets the start-date of the calendar. You can set every date, it will always be changed to the first of the month.
Setting this will be useless if the date is set with the Month widget.
Sourcepub fn start_date(&self) -> NaiveDate
pub fn start_date(&self) -> NaiveDate
Start date of this month. Will always be the first.
Sourcepub fn count_weeks(day: NaiveDate) -> usize
pub fn count_weeks(day: NaiveDate) -> usize
Nr of weeks for the given month
Sourcepub fn screen_cursor(&self) -> Option<(u16, u16)>
pub fn screen_cursor(&self) -> Option<(u16, u16)>
Returns None.
Source§impl<Selection> MonthState<Selection>where
Selection: CalendarSelection,
impl<Selection> MonthState<Selection>where
Selection: CalendarSelection,
Sourcepub fn lead_selection(&self) -> Option<NaiveDate>
pub fn lead_selection(&self) -> Option<NaiveDate>
Lead selection
Source§impl MonthState<SingleSelection>
impl MonthState<SingleSelection>
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Removes all selection.
Sourcepub fn select_day(&mut self, n: usize) -> CalOutcome
pub fn select_day(&mut self, n: usize) -> CalOutcome
Select a day by index.
Sourcepub fn select_last(&mut self) -> CalOutcome
pub fn select_last(&mut self) -> CalOutcome
Select the last day of the month.
Sourcepub fn select_date(&mut self, d: NaiveDate) -> bool
pub fn select_date(&mut self, d: NaiveDate) -> bool
Select by date. Returns true if the date is valid for this month. If false it doesn’t change the selection.
Sourcepub fn selected_date(&self) -> Option<NaiveDate>
pub fn selected_date(&self) -> Option<NaiveDate>
Lead selected day
Sourcepub fn prev_day(&mut self, n: usize) -> CalOutcome
pub fn prev_day(&mut self, n: usize) -> CalOutcome
Select previous day.
Sourcepub fn next_day(&mut self, n: usize) -> CalOutcome
pub fn next_day(&mut self, n: usize) -> CalOutcome
Select next day.
Source§impl MonthState<RangeSelection>
impl MonthState<RangeSelection>
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Removes all selection.
Sourcepub fn select_week(&mut self, n: usize, extend: bool) -> CalOutcome
pub fn select_week(&mut self, n: usize, extend: bool) -> CalOutcome
Select a week by index.
Sourcepub fn select_day(&mut self, n: usize, extend: bool) -> CalOutcome
pub fn select_day(&mut self, n: usize, extend: bool) -> CalOutcome
Select a day by index.
Sourcepub fn select_last(&mut self, extend: bool) -> CalOutcome
pub fn select_last(&mut self, extend: bool) -> CalOutcome
Select the last day
Sourcepub fn select_week_by_date(&mut self, date: NaiveDate, extend: bool) -> bool
pub fn select_week_by_date(&mut self, date: NaiveDate, extend: bool) -> bool
Select a week by date Returns true if the date is valid for this month. If false it doesn’t change the selection.
Sourcepub fn select_date(&mut self, d: NaiveDate, extend: bool) -> bool
pub fn select_date(&mut self, d: NaiveDate, extend: bool) -> bool
Select by date. Returns true if the date is valid for this month. If false it doesn’t change the selection.
Sourcepub fn selected_date(&self) -> Option<NaiveDate>
pub fn selected_date(&self) -> Option<NaiveDate>
Lead selected day
Sourcepub fn prev_day(&mut self, n: usize, extend: bool) -> CalOutcome
pub fn prev_day(&mut self, n: usize, extend: bool) -> CalOutcome
Select previous day.
Sourcepub fn next_day(&mut self, n: usize, extend: bool) -> CalOutcome
pub fn next_day(&mut self, n: usize, extend: bool) -> CalOutcome
Select previous day.
Sourcepub fn prev_week(&mut self, n: usize, extend: bool) -> CalOutcome
pub fn prev_week(&mut self, n: usize, extend: bool) -> CalOutcome
Select previous week.
Sourcepub fn next_week(&mut self, n: usize, extend: bool) -> CalOutcome
pub fn next_week(&mut self, n: usize, extend: bool) -> CalOutcome
Select previous day.
Trait Implementations§
Source§impl<Selection> Clone for MonthState<Selection>where
Selection: Clone,
impl<Selection> Clone for MonthState<Selection>where
Selection: Clone,
Source§impl<Selection: Debug> Debug for MonthState<Selection>
impl<Selection: Debug> Debug for MonthState<Selection>
Source§impl<Selection> Default for MonthState<Selection>where
Selection: Default,
impl<Selection> Default for MonthState<Selection>where
Selection: Default,
Source§impl HandleEvent<Event, MouseOnly, CalOutcome> for MonthState<SingleSelection>
impl HandleEvent<Event, MouseOnly, CalOutcome> for MonthState<SingleSelection>
Source§impl HandleEvent<Event, MouseOnly, CalOutcome> for MonthState<NoSelection>
impl HandleEvent<Event, MouseOnly, CalOutcome> for MonthState<NoSelection>
Source§impl HandleEvent<Event, MouseOnly, CalOutcome> for MonthState<RangeSelection>
impl HandleEvent<Event, MouseOnly, CalOutcome> for MonthState<RangeSelection>
Source§impl HandleEvent<Event, Regular, CalOutcome> for MonthState<SingleSelection>
impl HandleEvent<Event, Regular, CalOutcome> for MonthState<SingleSelection>
Source§impl HandleEvent<Event, Regular, CalOutcome> for MonthState<NoSelection>
impl HandleEvent<Event, Regular, CalOutcome> for MonthState<NoSelection>
Source§impl HandleEvent<Event, Regular, CalOutcome> for MonthState<RangeSelection>
impl HandleEvent<Event, Regular, CalOutcome> for MonthState<RangeSelection>
Source§impl<Selection> HasFocus for MonthState<Selection>
impl<Selection> HasFocus for MonthState<Selection>
Source§fn build(&self, builder: &mut FocusBuilder)
fn build(&self, builder: &mut FocusBuilder)
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Source§fn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
Source§fn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
Source§impl<Selection> HasScreenCursor for MonthState<Selection>
impl<Selection> HasScreenCursor for MonthState<Selection>
Source§impl<Selection> RelocatableState for MonthState<Selection>
impl<Selection> RelocatableState for MonthState<Selection>
Source§fn relocate(&mut self, shift: (i16, i16), clip: Rect)
fn relocate(&mut self, shift: (i16, i16), clip: Rect)
Source§fn relocate_popup(&mut self, shift: (i16, i16), clip: Rect)
fn relocate_popup(&mut self, shift: (i16, i16), clip: Rect)
Auto Trait Implementations§
impl<Selection = SingleSelection> !Freeze for MonthState<Selection>
impl<Selection = SingleSelection> !RefUnwindSafe for MonthState<Selection>
impl<Selection = SingleSelection> !Send for MonthState<Selection>
impl<Selection = SingleSelection> !Sync for MonthState<Selection>
impl<Selection> Unpin for MonthState<Selection>
impl<Selection = SingleSelection> !UnwindSafe for MonthState<Selection>
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more