pub struct Controls { /* private fields */ }Expand description
A collection of Controls.
The value is a shared handle: clones refer to the same collection, and handles compare by identity.
Implementations§
Source§impl Controls
impl Controls
Sourcepub fn from_items(items: impl IntoIterator<Item = Ref<Control>>) -> Self
pub fn from_items(items: impl IntoIterator<Item = Ref<Control>>) -> Self
Creates a collection with the initial items.
Sourcepub fn add(&self, item: impl IntoRef<Control>)
pub fn add(&self, item: impl IntoRef<Control>)
Adds a control (of any class) to the collection.
Sourcepub fn insert(&self, index: usize, item: impl IntoRef<Control>)
pub fn insert(&self, index: usize, item: impl IntoRef<Control>)
Inserts a control (of any class) at the specified index.
Methods from Deref<Target = FerroList<Ref<Control>>>§
Sourcepub fn add_collection_changed(
&self,
handler: Rc<dyn for<'a> Fn(&NotifyCollectionChangedEventArgs<'a, T>)>,
) -> u64
pub fn add_collection_changed( &self, handler: Rc<dyn for<'a> Fn(&NotifyCollectionChangedEventArgs<'a, T>)>, ) -> u64
Subscribes to changes. Returns a token for
remove_collection_changed.
Sourcepub fn remove_collection_changed(&self, token: u64) -> bool
pub fn remove_collection_changed(&self, token: u64) -> bool
Unsubscribes a handler.
Sourcepub fn has_collection_changed_subscribers(&self) -> bool
pub fn has_collection_changed_subscribers(&self) -> bool
Whether anything is subscribed to changes, typed or untyped.
pub fn is_empty(&self) -> bool
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
The number of items the list can hold before its storage grows.
Sourcepub fn set_capacity(&self, capacity: usize)
pub fn set_capacity(&self, capacity: usize)
Sets the number of items the list can hold before its storage grows.
§Panics
Panics if capacity is less than the number of items, as the
managed original throws.
Sourcepub fn reset_behavior(&self) -> ResetBehavior
pub fn reset_behavior(&self) -> ResetBehavior
The reset behavior of the list.
pub fn set_reset_behavior(&self, value: ResetBehavior)
Sourcepub fn validate(&self) -> Option<Rc<dyn Fn(&T)>>where
T: 'static,
pub fn validate(&self) -> Option<Rc<dyn Fn(&T)>>where
T: 'static,
The validation routine that is invoked for every item before it is added to the list.
Sourcepub fn set_validate(&self, value: Option<Rc<dyn Fn(&T)>>)where
T: 'static,
pub fn set_validate(&self, value: Option<Rc<dyn Fn(&T)>>)where
T: 'static,
Sets a validation routine that is invoked for every item before it is added to the list; it rejects an item by panicking.
Sourcepub fn validator(&self) -> Option<Rc<dyn IFerroListItemValidator<T>>>where
T: 'static,
pub fn validator(&self) -> Option<Rc<dyn IFerroListItemValidator<T>>>where
T: 'static,
The validator that is invoked for every item before it is added to the list.
pub fn set_validator(&self, value: Option<Rc<dyn IFerroListItemValidator<T>>>)
Sourcepub fn snapshot(&self) -> Rc<Vec<T>>
pub fn snapshot(&self) -> Rc<Vec<T>>
A snapshot of the items. It stays valid and unchanged if the list is modified.
Sourcepub fn add_range(&self, items: impl IntoIterator<Item = T>)
pub fn add_range(&self, items: impl IntoIterator<Item = T>)
Adds multiple items to the collection.
Sourcepub fn insert_range(&self, index: usize, items: impl IntoIterator<Item = T>)
pub fn insert_range(&self, index: usize, items: impl IntoIterator<Item = T>)
Inserts multiple items at the specified index.
Sourcepub fn move_range(&self, old_index: usize, count: usize, new_index: usize)
pub fn move_range(&self, old_index: usize, count: usize, new_index: usize)
Moves multiple items to a new index.
Sourcepub fn remove_range(&self, index: usize, count: usize)
pub fn remove_range(&self, index: usize, count: usize)
Removes a range of elements from the collection.
Sourcepub fn copy_to(&self, array: &mut [T], array_index: usize)
pub fn copy_to(&self, array: &mut [T], array_index: usize)
Copies the items into array, starting at array_index.
§Panics
Panics if array is too small, as the managed original throws.
Sourcepub fn get_range(&self, index: usize, count: usize) -> Vec<T>
pub fn get_range(&self, index: usize, count: usize) -> Vec<T>
Gets a range of items from the collection.
Sourcepub fn ensure_capacity(&self, capacity: usize)
pub fn ensure_capacity(&self, capacity: usize)
Ensures that the capacity of the list is at least capacity.
Sourcepub fn remove(&self, item: &T) -> bool
pub fn remove(&self, item: &T) -> bool
Removes an item from the collection. Returns true if it was present.
Sourcepub fn remove_all(&self, items: impl IntoIterator<Item = T>)
pub fn remove_all(&self, items: impl IntoIterator<Item = T>)
Removes multiple items from the collection.
Each run of adjacent items that are removed is notified as one removal, from the end of the list to its start.
Trait Implementations§
Source§impl MarkupTyped for Controls
impl MarkupTyped for Controls
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
impl StructuralPartialEq for Controls
Auto Trait Implementations§
impl !RefUnwindSafe for Controls
impl !Send for Controls
impl !Sync for Controls
impl !UnwindSafe for Controls
impl Freeze for Controls
impl Unpin for Controls
impl UnsafeUnpin for Controls
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