pub struct SelectedDatesCollection(/* private fields */);Expand description
Represents a set of selected dates in a Calendar.
The value is a shared handle: clones refer to the same collection, and handles compare by identity. Every change goes through the collection, which validates it against the selection mode of the calendar that owns it and keeps the selected date of that calendar in step.
Implementations§
Source§impl SelectedDatesCollection
impl SelectedDatesCollection
Sourcepub fn new(owner: &Ref<Calendar>) -> Self
pub fn new(owner: &Ref<Calendar>) -> Self
Initializes a new instance of the SelectedDatesCollection class.
owner is the Calendar associated with this object.
Sourcepub fn add_range(&self, start: DateTime, end: DateTime)
pub fn add_range(&self, start: DateTime, end: DateTime)
Adds all the dates in the specified range, which includes the first and last dates, to the collection.
start is the first date to add to the collection and end the
last one.
Sourcepub fn get(&self, index: usize) -> DateTime
pub fn get(&self, index: usize) -> DateTime
The date at index. Panics when the index is out of range.
Sourcepub fn index_of(&self, item: DateTime) -> Option<usize>
pub fn index_of(&self, item: DateTime) -> Option<usize>
The index of the date in the collection.
Sourcepub fn add(&self, item: DateTime)
pub fn add(&self, item: DateTime)
Adds a date to the end of the collection.
Panics when the selection mode of the calendar does not allow the change or the date cannot be selected.
Sourcepub fn insert(&self, index: usize, item: DateTime)
pub fn insert(&self, index: usize, item: DateTime)
Inserts a date into the collection at the specified index.
Panics when the selection mode of the calendar does not allow the change or the date cannot be selected.
Sourcepub fn remove(&self, item: DateTime) -> bool
pub fn remove(&self, item: DateTime) -> bool
Removes a date from the collection. Returns whether it was present.
Sourcepub fn remove_at(&self, index: usize)
pub fn remove_at(&self, index: usize)
Removes the date at the specified index of the collection.
Sourcepub fn move_item(&self, old_index: usize, new_index: usize)
pub fn move_item(&self, old_index: usize, new_index: usize)
Moves the date at old_index to new_index.
Sourcepub fn add_collection_changed(
&self,
handler: Rc<CollectionChangedHandler<DateTime>>,
) -> u64
pub fn add_collection_changed( &self, handler: Rc<CollectionChangedHandler<DateTime>>, ) -> u64
Subscribes to the changes of the collection; returns the token of the subscription.
Sourcepub fn remove_collection_changed(&self, token: u64) -> bool
pub fn remove_collection_changed(&self, token: u64) -> bool
Ends a subscription to the changes of the collection.
Trait Implementations§
Source§impl Clone for SelectedDatesCollection
impl Clone for SelectedDatesCollection
Auto Trait Implementations§
impl !RefUnwindSafe for SelectedDatesCollection
impl !Send for SelectedDatesCollection
impl !Sync for SelectedDatesCollection
impl !UnwindSafe for SelectedDatesCollection
impl Freeze for SelectedDatesCollection
impl Unpin for SelectedDatesCollection
impl UnsafeUnpin for SelectedDatesCollection
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more