Blender V4.3
blender::ui::TreeViewItemContainer Class Reference

#include <UI_tree_view.hh>

Inherited by blender::ui::AbstractTreeView, and blender::ui::AbstractTreeViewItem.

Public Types

enum class  IterOptions { None = 0 , SkipCollapsed = 1 << 0 , SkipFiltered = 1 << 1 }
 
using ItemIterFn = FunctionRef<void(AbstractTreeViewItem &)>
 

Public Member Functions

template<class ItemT , typename... Args>
ItemT & add_tree_item (Args &&...args)
 
AbstractTreeViewItemadd_tree_item (std::unique_ptr< AbstractTreeViewItem > item)
 

Protected Member Functions

void foreach_item_recursive (ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
 
void foreach_parent (ItemIterFn iter_fn) const
 

Protected Attributes

Vector< std::unique_ptr< AbstractTreeViewItem > > children_
 
TreeViewItemContainerroot_ = nullptr
 
AbstractTreeViewItemparent_ = nullptr
 

Friends

class AbstractTreeView
 
class AbstractTreeViewItem
 

Detailed Description

Both the tree-view (as the root of the tree) and the items can have children. This is the base class for both, to store and manage child items. Children are owned by their parent container (tree-view or item).

That means this type can be used whenever either an AbstractTreeView or an AbstractTreeViewItem is needed, but the TreeViewOrItem alias is a better name to use then.

Definition at line 49 of file UI_tree_view.hh.

Member Typedef Documentation

◆ ItemIterFn

Member Enumeration Documentation

◆ IterOptions

Enumerator
None 
SkipCollapsed 
SkipFiltered 

Definition at line 64 of file UI_tree_view.hh.

Member Function Documentation

◆ add_tree_item() [1/2]

template<class ItemT , typename... Args>
ItemT & blender::ui::TreeViewItemContainer::add_tree_item ( Args &&... args)
inline

◆ add_tree_item() [2/2]

AbstractTreeViewItem & blender::ui::TreeViewItemContainer::add_tree_item ( std::unique_ptr< AbstractTreeViewItem > item)

Add an already constructed tree item to this parent. Ownership is moved to it. All tree items must be added through this, it handles important invariants!

Definition at line 46 of file tree_view.cc.

References children_, parent_, blender::ui::AbstractView::register_item(), and root_.

◆ foreach_item_recursive()

◆ foreach_parent()

void blender::ui::TreeViewItemContainer::foreach_parent ( ItemIterFn iter_fn) const
protected

Friends And Related Symbol Documentation

◆ AbstractTreeView

friend class AbstractTreeView
friend

Definition at line 50 of file UI_tree_view.hh.

◆ AbstractTreeViewItem

friend class AbstractTreeViewItem
friend

Definition at line 51 of file UI_tree_view.hh.

Member Data Documentation

◆ children_

Vector<std::unique_ptr<AbstractTreeViewItem> > blender::ui::TreeViewItemContainer::children_
protected

◆ parent_

AbstractTreeViewItem* blender::ui::TreeViewItemContainer::parent_ = nullptr
protected

◆ root_

TreeViewItemContainer* blender::ui::TreeViewItemContainer::root_ = nullptr
protected

Adding the first item to the root will set this, then it's passed on to all children.

Definition at line 59 of file UI_tree_view.hh.

Referenced by add_tree_item().


The documentation for this class was generated from the following files: