Blender V5.0
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::object::shapekey::ShapeKeyTreeView, blender::ed::spreadsheet::GeometryDataSetTreeView, blender::ed::spreadsheet::GeometryInstancesTreeView, blender::ed::spreadsheet::ViewerDataTreeView, 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 ()
void allow_multiselect_items ()
bool is_multiselect_supported () const
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_
TreeViewItemContainer * root_ = 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 321 of file tree_view.cc.

◆ find_hovered()

◆ foreach_item()

◆ foreach_root_item()

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

Definition at line 115 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 391 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 149 of file tree_view.cc.

References BLI_strncpy(), SET_FLAG_FROM_TEST, state, UI_INV_SCALE_FAC, and UI_VIEW_SHOW_FILTER_OPTIONS.

◆ 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 170 of file tree_view.cc.

References BLI_strncpy(), MIN_ROWS, blender::ui::padded_item_height(), round_fl_to_int(), set_default_rows(), state, UI_MAX_NAME_STR, UI_SCALE_FAC, and UI_VIEW_SHOW_FILTER_OPTIONS.

◆ scroll()

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

Reimplemented from blender::ui::AbstractView.

Definition at line 396 of file tree_view.cc.

References blender::ui::AbstractView::supports_scrolling(), and 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).

Note
Value should be greater than MIN_ROWS. This is to prevent resizing below certain height.

Definition at line 141 of file tree_view.cc.

References BLI_assert_msg, MIN_ROWS, and blender::ui::padded_item_height().

Referenced by persistent_state_apply(), blender::ed::object::shapekey::template_tree(), uiTemplateBoneCollectionTree(), uiTemplateGreasePencilLayerTree(), uiTemplateLightLinkingCollection(), and uiTemplateNodeTreeInterface().

◆ AbstractTreeViewItem

friend class AbstractTreeViewItem
friend

Definition at line 140 of file UI_tree_view.hh.

References AbstractTreeViewItem.

Referenced by AbstractTreeViewItem, build_tree(), find_hovered(), and ~AbstractTreeView().

◆ TreeViewBuilder

friend class TreeViewBuilder
friend

Definition at line 141 of file UI_tree_view.hh.

References TreeViewBuilder.

Referenced by TreeViewBuilder.

◆ TreeViewItemDropTarget

friend class TreeViewItemDropTarget
friend

Definition at line 143 of file UI_tree_view.hh.

References TreeViewItemDropTarget.

Referenced by TreeViewItemDropTarget.

◆ TreeViewLayoutBuilder

friend class TreeViewLayoutBuilder
friend

Definition at line 142 of file UI_tree_view.hh.

References TreeViewLayoutBuilder.

Referenced by TreeViewLayoutBuilder.


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