Skip to main content

TreeNodeCollection

Struct TreeNodeCollection 

Source
pub struct TreeNodeCollection { /* private fields */ }
Expand description

The children of a TreeNode: a read-only list of nodes that is filled the first time it is used (its count, an item, an enumeration or a subscription to its changes), and then follows the tree it shows.

The kinds of the original (the collections of the logical and visual trees, of a group of top levels, of an application, and the empty one) derive from it; here they implement TreeNodeCollectionImpl, which the collection holds.

Implementations§

Source§

impl TreeNodeCollection

Source

pub fn new( owner: Weak<TreeNode>, kind: Box<dyn TreeNodeCollectionImpl>, ) -> Rc<Self>

TreeNodeCollection(TreeNode owner): a collection of the children of owner, of the kind kind.

Source

pub fn empty() -> Rc<TreeNodeCollection>

static readonly internal TreeNodeCollection Empty: the collection of the nodes without children (one per thread).

Source

pub fn get(&self, index: usize) -> Rc<TreeNode>

this[int index]: the node at index.

§Panics

Panics when index is out of range.

Source

pub fn count(&self) -> usize

Count: the number of nodes.

Source

pub fn owner(&self) -> Option<Rc<TreeNode>>

Owner: the node whose children the collection holds; None for the empty collection, and once the node is gone.

Source

pub fn dispose(&self)

Dispose(): the override of the kind of the collection.

Source

pub fn base_dispose(&self)

The base implementation of Dispose(): disposes the nodes, if the collection was ever filled.

Source

pub fn is_initialized(&self) -> bool

Whether the collection was filled: whether its nodes exist. A collection is filled the first time it is used (its count, an item, an enumeration or a subscription to its changes); the tree pages ask for the children of a node when its row is shown or expanded.

Source

pub fn to_vec(&self) -> Vec<Rc<TreeNode>>

GetEnumerator(): the nodes, as they are now.

Source

pub fn contains(&self, node: &Rc<TreeNode>) -> bool

IList.Contains(object).

Source

pub fn index_of(&self, node: &Rc<TreeNode>) -> i32

IList.IndexOf(object): the index of node, or -1.

Trait Implementations§

Source§

impl IFerroReadOnlyList<Rc<TreeNode>> for TreeNodeCollection

Source§

fn count(&self) -> usize

The number of items in the list.
Source§

fn get(&self, index: usize) -> Rc<TreeNode>

The item at index. Panics if out of range.
Source§

fn snapshot(&self) -> Rc<Vec<Rc<TreeNode>>>

The items, as a snapshot that stays unchanged if the list is modified (enumeration).
Source§

fn add_collection_changed( &self, handler: Rc<CollectionChangedHandler<Rc<TreeNode>>>, ) -> u64

Subscribes to changes. Returns a token for remove_collection_changed.
Source§

fn remove_collection_changed(&self, token: u64) -> bool

Unsubscribes a handler.
Source§

impl IItemsList for TreeNodeCollection

The collection as the items of an items control (the untyped IList of the original, which the tree view reads).

Source§

fn count(&self) -> usize

The number of items.
Source§

fn get_at(&self, index: usize) -> Option<BoxedValue>

The item at index. Panics if out of range.
Source§

fn index_of(&self, item: &Option<BoxedValue>) -> i32

The index of the first item equal to item, or -1.
Source§

fn is_notifying(&self) -> bool

Whether the list notifies of changes.
Source§

fn add_collection_changed( &self, handler: Rc<ItemsChangedHandler>, ) -> Option<u64>

Subscribes to changes. Returns the token for remove_collection_changed, or None if the list does not notify.
Source§

fn remove_collection_changed(&self, token: u64)

Unsubscribes a handler.
Source§

fn as_any(&self) -> &dyn Any

The collection as Any, to get back to the typed collection.
Source§

fn key_index_mapping(&self) -> Option<&dyn IKeyIndexMapping>

The unique keys of the items, if the list provides them (IKeyIndexMapping); None by default. An index is never a key: a list without keys has none.
Source§

fn identity(&self) -> Option<usize>

The identity of the collection, for a list that is a handle to a collection (a FerroList): two handles to one collection are the same collection. None for a list that is the collection itself, whose identity is its address.
Source§

impl INotifyCollectionChanged for TreeNodeCollection

Source§

fn collection_changed(&self) -> &Event<CollectionChange>

CollectionChanged: subscribing fills the collection.

Source§

impl INotifyPropertyChanged for TreeNodeCollection

Source§

fn property_changed(&self) -> &Event<str>

PropertyChanged: subscribing fills the collection.

Source§

fn as_notify_property_changing(&self) -> Option<&dyn INotifyPropertyChanging>

The object as INotifyPropertyChanging, when it also raises the event of a property that is about to change; None by default. Read more
Source§

impl MarkupTyped for TreeNodeCollection

Source§

const MARKUP: &'static MarkupType

The markup metadata of the type.
Source§

impl ModelCollection<TreeNode> for TreeNodeCollection

Source§

fn count(&self) -> usize

The number of models.
Source§

fn get(&self, index: usize) -> Rc<TreeNode>

The model at index.
Source§

fn index_of(&self, model: &Rc<TreeNode>) -> Option<usize>

The index of model, compared by identity (the reference’s IList.IndexOf of a reference type that does not override Equals).
Source§

fn add_collection_changed( &self, handler: Rc<ModelsChangedHandler<TreeNode>>, ) -> Option<u64>

Subscribes to the changes of the collection; None when it does not raise any (a collection that is not INotifyCollectionChanged).
Source§

fn remove_collection_changed(&self, token: u64)

Removes a subscription of add_collection_changed.
Source§

fn is_notifying(&self) -> bool

Whether the collection raises change notifications.
Source§

fn to_vec(&self) -> Vec<Rc<TreeNode>>

The models, in order.
Source§

fn as_mutable(&self) -> Option<&dyn MutableModelCollection<M>>

The mutable list behind the collection (IList that is not read only), for the moves of drag and drop.
Source§

impl PartialEq for TreeNodeCollection

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> TreeModel for T
where T: PartialEq + 'static,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.