pub struct InlineCollection(/* private fields */);Expand description
A collection of Inlines.
The value is a shared handle: clones refer to the same collection, and handles compare by identity.
Implementations§
Source§impl InlineCollection
impl InlineCollection
Sourcepub fn text(&self) -> Option<String>
pub fn text(&self) -> Option<String>
Gets the text contained in this collection: the text of every inline,
or None when the collection is empty.
Sourcepub fn add(&self, inline: impl IntoRef<Inline>)
pub fn add(&self, inline: impl IntoRef<Inline>)
Adds an inline (of any class) to the collection.
The text of a hosting text block becomes the first run of the collection.
Sourcepub fn add_control(&self, control: impl IntoRef<Control>)
pub fn add_control(&self, control: impl IntoRef<Control>)
Adds a control wrapped inside an InlineUIContainer to this
collection.
Sourcepub fn invalidated(&self, handler: impl Fn() + 'static) -> Rc<dyn IDisposable>
pub fn invalidated(&self, handler: impl Fn() + 'static) -> Rc<dyn IDisposable>
Raised when an inline in the collection changes.
Methods from Deref<Target = FerroList<Ref<Inline>>>§
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 Clone for InlineCollection
impl Clone for InlineCollection
Source§impl Debug for InlineCollection
impl Debug for InlineCollection
Source§impl Deref for InlineCollection
impl Deref for InlineCollection
Source§impl MarkupTyped for InlineCollection
impl MarkupTyped for InlineCollection
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Auto Trait Implementations§
impl !RefUnwindSafe for InlineCollection
impl !Send for InlineCollection
impl !Sync for InlineCollection
impl !UnwindSafe for InlineCollection
impl Freeze for InlineCollection
impl Unpin for InlineCollection
impl UnsafeUnpin for InlineCollection
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