Blender
V3.3
|
#include <UI_tree_view.hh>
Public Types | |
enum class | IterOptions { None = 0 , SkipCollapsed = 1 << 0 } |
using | ItemIterFn = FunctionRef< void(AbstractTreeViewItem &)> |
Public Member Functions | |
template<class ItemT , typename... Args> | |
ItemT & | add_tree_item (Args &&...args) |
AbstractTreeViewItem & | add_tree_item (std::unique_ptr< AbstractTreeViewItem > item) |
Protected Member Functions | |
void | foreach_item_recursive (ItemIterFn iter_fn, IterOptions options=IterOptions::None) const |
Protected Attributes | |
Vector< std::unique_ptr< AbstractTreeViewItem > > | children_ |
TreeViewItemContainer * | root_ = nullptr |
AbstractTreeViewItem * | parent_ = nullptr |
Friends | |
class | AbstractTreeView |
class | AbstractTreeViewItem |
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.
Definition at line 70 of file UI_tree_view.hh.
|
strong |
Enumerator | |
---|---|
None | |
SkipCollapsed |
Definition at line 64 of file UI_tree_view.hh.
|
inline |
Convenience wrapper constructing the item by forwarding given arguments to the constructor of the type (ItemT).
E.g. if your tree-item type has the following constructor:
You can add an item like this:
Definition at line 322 of file UI_tree_view.hh.
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!
Add a tree-item to the container. This is the only place where items should be added, it handles important invariants!
Definition at line 31 of file tree_view.cc.
References children_, parent_, blender::ui::AbstractView::register_item(), and root_.
|
protected |
Definition at line 54 of file tree_view.cc.
References children_, options, and SkipCollapsed.
Referenced by blender::ui::AbstractTreeView::foreach_item().
|
friend |
Definition at line 50 of file UI_tree_view.hh.
|
friend |
Definition at line 51 of file UI_tree_view.hh.
|
protected |
Definition at line 57 of file UI_tree_view.hh.
Referenced by add_tree_item(), foreach_item_recursive(), and blender::ui::AbstractTreeViewItem::is_collapsible().
|
protected |
Pointer back to the owning item.
Definition at line 61 of file UI_tree_view.hh.
Referenced by add_tree_item(), blender::ui::AbstractTreeViewItem::ensure_parents_uncollapsed(), and blender::ui::AbstractTreeViewItem::matches().
|
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().