Blender V4.5
blender::ui::AbstractTreeView Class Referenceabstract

#include <UI_tree_view.hh>

Inherits blender::ui::AbstractView, and blender::ui::TreeViewItemContainer.

Inherited by blender::ed::asset::shelf::AssetCatalogSelectorTree, blender::ed::asset::shelf::AssetCatalogTreeView, blender::ed::asset_browser::AssetCatalogTreeView, blender::ed::spreadsheet::GeometryDataSetTreeView, blender::ed::spreadsheet::GeometryInstancesTreeView, blender::ed::spreadsheet::ViewerPathTreeView, blender::ui::bonecollections::BoneCollectionTreeView, and blender::ui::greasepencil::LayerTreeView.

Public Member Functions

 ~AbstractTreeView () override=default
 
void draw_overlays (const ARegion &region, const uiBlock &block) const override
 
void foreach_item (ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
 
void foreach_root_item (ItemIterFn iter_fn) const
 
bool is_fully_visible () const override
 
void scroll (ViewScrollDirection direction) override
 
AbstractTreeViewItemfind_hovered (const ARegion &region, const int2 &xy)
 
void set_default_rows (int default_rows)
 
- Public Member Functions inherited from blender::ui::AbstractView
virtual ~AbstractView ()=default
 
void register_item (AbstractViewItem &item)
 
virtual std::unique_ptr< DropTargetInterfacecreate_drop_target ()
 
virtual bool listen (const wmNotifier &) const
 
virtual bool begin_filtering (const bContext &C) const
 
bool is_renaming () const
 
bool begin_renaming ()
 
void end_renaming ()
 
Span< char > get_rename_buffer () const
 
MutableSpan< char > get_rename_buffer ()
 
std::optional< rctiget_bounds () const
 
std::string get_context_menu_title () const
 
void set_context_menu_title (const std::string &title)
 
bool get_popup_keep_open () const
 
void set_popup_keep_open ()
 
void clear_search_highlight ()
 
- Public Member Functions inherited from blender::ui::TreeViewItemContainer
template<class ItemT , typename... Args>
ItemT & add_tree_item (Args &&...args)
 
AbstractTreeViewItemadd_tree_item (std::unique_ptr< AbstractTreeViewItem > item)
 

Protected Member Functions

virtual void build_tree ()=0
 
std::optional< uiViewStatepersistent_state () const override
 
void persistent_state_apply (const uiViewState &state) override
 
- Protected Member Functions inherited from blender::ui::AbstractView
 AbstractView ()=default
 
virtual void change_state_delayed ()
 
void update_from_old (uiBlock &new_block)
 
bool is_reconstructed () const
 
const AbstractViewItemsearch_highlight_item () const
 
void filter (std::optional< StringRef > filter_str)
 
- Protected Member Functions inherited from blender::ui::TreeViewItemContainer
void foreach_item_recursive (ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
 
void foreach_parent (ItemIterFn iter_fn) const
 

Friends

class AbstractTreeViewItem
 
class TreeViewBuilder
 
class TreeViewLayoutBuilder
 
class TreeViewItemDropTarget
 

Additional Inherited Members

- Public Types inherited from blender::ui::TreeViewItemContainer
enum class  IterOptions { None = 0 , SkipCollapsed = 1 << 0 , SkipFiltered = 1 << 1 }
 
using ItemIterFn = FunctionRef<void(AbstractTreeViewItem &)>
 
- Protected Attributes inherited from blender::ui::TreeViewItemContainer
Vector< std::unique_ptr< AbstractTreeViewItem > > children_
 
TreeViewItemContainerroot_ = nullptr
 
AbstractTreeViewItemparent_ = nullptr
 
bool is_flat_ = false
 

Detailed Description

Definition at line 120 of file UI_tree_view.hh.

Constructor & Destructor Documentation

◆ ~AbstractTreeView()

blender::ui::AbstractTreeView::~AbstractTreeView ( )
overridedefault

Member Function Documentation

◆ build_tree()

◆ draw_overlays()

void blender::ui::AbstractTreeView::draw_overlays ( const ARegion & region,
const uiBlock & block ) const
overridevirtual

Reimplemented from blender::ui::AbstractView.

Definition at line 309 of file tree_view.cc.

◆ find_hovered()

AbstractTreeViewItem * blender::ui::AbstractTreeView::find_hovered ( const ARegion & region,
const int2 & xy )

◆ foreach_item()

◆ foreach_root_item()

void blender::ui::AbstractTreeView::foreach_root_item ( ItemIterFn iter_fn) const

Definition at line 113 of file tree_view.cc.

References blender::ui::TreeViewItemContainer::children_.

◆ is_fully_visible()

bool blender::ui::AbstractTreeView::is_fully_visible ( ) const
overridevirtual
Returns
True when everything in this view is visible, i.e. no scrolling is needed.

Reimplemented from blender::ui::AbstractView.

Definition at line 378 of file tree_view.cc.

◆ persistent_state()

std::optional< uiViewState > blender::ui::AbstractTreeView::persistent_state ( ) const
overrideprotectedvirtual

From the current view state, return certain state that will be written to files (stored in ARegion.view_states) to preserve it over UI changes and file loading. The state can be restored using persistent_state_apply().

Return an empty value if there's no state to preserve (default implementation).

Reimplemented from blender::ui::AbstractView.

Definition at line 144 of file tree_view.cc.

References uiViewState::custom_height, state, and UI_INV_SCALE_FAC.

◆ persistent_state_apply()

void blender::ui::AbstractTreeView::persistent_state_apply ( const uiViewState & state)
overrideprotectedvirtual

Restore a view state given in state, which was created by persistent_state() for saving in files, and potentially loaded from a file.

Reimplemented from blender::ui::AbstractView.

Definition at line 162 of file tree_view.cc.

References blender::ui::padded_item_height(), round_fl_to_int(), set_default_rows(), state, and UI_SCALE_FAC.

◆ scroll()

void blender::ui::AbstractTreeView::scroll ( ViewScrollDirection direction)
overridevirtual

Reimplemented from blender::ui::AbstractView.

Definition at line 383 of file tree_view.cc.

References blender::ui::UP.

◆ set_default_rows()

void blender::ui::AbstractTreeView::set_default_rows ( int default_rows)

Visual feature: Define a number of item rows the view will show by default. If there are fewer items, empty dummy items will be added. These contribute to the view bounds, so the drop target of the view includes them, but they are not interactive (e.g. no mouse-hover highlight).

Definition at line 139 of file tree_view.cc.

References blender::ui::padded_item_height().

Referenced by persistent_state_apply(), uiTemplateBoneCollectionTree(), uiTemplateGreasePencilLayerTree(), uiTemplateLightLinkingCollection(), and uiTemplateNodeTreeInterface().

Friends And Related Symbol Documentation

◆ AbstractTreeViewItem

friend class AbstractTreeViewItem
friend

Definition at line 134 of file UI_tree_view.hh.

◆ TreeViewBuilder

friend class TreeViewBuilder
friend

Definition at line 135 of file UI_tree_view.hh.

◆ TreeViewItemDropTarget

Definition at line 137 of file UI_tree_view.hh.

◆ TreeViewLayoutBuilder

Definition at line 136 of file UI_tree_view.hh.


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