[]Struct gtk::TreeModelFilter

pub struct TreeModelFilter(_, _);

A TreeModelFilter is a tree model which wraps another tree model, and can do the following things:

The basic API is similar to TreeModelSort. For an example on its usage, see the section on TreeModelSort.

When using TreeModelFilter, it is important to realize that TreeModelFilter maintains an internal cache of all nodes which are visible in its clients. The cache is likely to be a subtree of the tree exposed by the child model. TreeModelFilter will not cache the entire child model when unnecessary to not compromise the caching mechanism that is exposed by the reference counting scheme. If the child model implements reference counting, unnecessary signals may not be emitted because of reference counting rule 3, see the TreeModel documentation. (Note that e.g. TreeStore does not implement reference counting and will always emit all signals, even when the receiving node is not visible).

Because of this, limitations for possible visible functions do apply. In general, visible functions should only use data or properties from the node for which the visibility state must be determined, its siblings or its parents. Usually, having a dependency on the state of any child node is not possible, unless references are taken on these explicitly. When no such reference exists, no signals may be received for these child nodes (see reference couting rule number 3 in the TreeModel section).

Determining the visibility state of a given node based on the state of its child nodes is a frequently occurring use case. Therefore, TreeModelFilter explicitly supports this. For example, when a node does not have any children, you might not want the node to be visible. As soon as the first row is added to the node’s child level (or the last row removed), the node’s visibility should be updated.

This introduces a dependency from the node on its child nodes. In order to accommodate this, TreeModelFilter must make sure the necessary signals are received from the child model. This is achieved by building, for all nodes which are exposed as visible nodes to TreeModelFilter's clients, the child level (if any) and take a reference on the first node in this level. Furthermore, for every row-inserted, row-changed or row-deleted signal (also these which were not handled because the node was not cached), TreeModelFilter will check if the visibility state of any parent node has changed.

Beware, however, that this explicit support is limited to these two cases. For example, if you want a node to be visible only if two nodes in a child’s child level (2 levels deeper) are visible, you are on your own. In this case, either rely on TreeStore to emit all signals because it does not implement reference counting, or for models that do implement reference counting, obtain references on these child levels yourself.

Implements

TreeModelFilterExt, glib::object::ObjectExt, TreeDragSourceExt, TreeModelExt

Implementations

impl TreeModelFilter[src]

pub fn new<T: IsA<TreeModel>>(
    child_model: &T,
    root: Option<&TreePath>
) -> TreeModelFilter
[src]

Trait Implementations

impl Clone for TreeModelFilter

impl Debug for TreeModelFilter

impl Display for TreeModelFilter[src]

impl Eq for TreeModelFilter

impl Hash for TreeModelFilter

impl IsA<TreeDragSource> for TreeModelFilter

impl IsA<TreeModel> for TreeModelFilter

impl Ord for TreeModelFilter

impl<T: ObjectType> PartialEq<T> for TreeModelFilter

impl<T: ObjectType> PartialOrd<T> for TreeModelFilter

impl StaticType for TreeModelFilter

Auto Trait Implementations

impl RefUnwindSafe for TreeModelFilter

impl !Send for TreeModelFilter

impl !Sync for TreeModelFilter

impl Unpin for TreeModelFilter

impl UnwindSafe for TreeModelFilter

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.