Blender V5.0
blender::ui::AbstractView Class Referenceabstract

#include <UI_abstract_view.hh>

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

Public Member Functions

virtual ~AbstractView ()=default
virtual void foreach_view_item (FunctionRef< void(AbstractViewItem &)> iter_fn) const =0
void register_item (AbstractViewItem &item)
Default implementations of virtual functions
virtual std::unique_ptr< DropTargetInterfacecreate_drop_target ()
virtual bool listen (const wmNotifier &) const
virtual bool begin_filtering (const bContext &C) const
virtual void draw_overlays (const ARegion &region, const uiBlock &block) const
virtual bool supports_scrolling () const
virtual bool is_fully_visible () const
virtual void scroll (ViewScrollDirection direction)
virtual std::optional< uiViewStatepersistent_state () const
virtual void persistent_state_apply (const uiViewState &state)
Renaming
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

Protected Member Functions

 AbstractView ()=default
virtual void update_children_from_old (const AbstractView &old_view)=0
State Management
virtual void change_state_delayed ()
View Reconstruction
void update_from_old (uiBlock &new_block)
bool is_reconstructed () const
const AbstractViewItemsearch_highlight_item () const
Filtering
void filter (std::optional< StringRef > filter_str)

Friends

class AbstractViewItem
struct ::ViewLink

Detailed Description

Definition at line 55 of file UI_abstract_view.hh.

Constructor & Destructor Documentation

◆ ~AbstractView()

virtual blender::ui::AbstractView::~AbstractView ( )
virtualdefault

References C.

◆ AbstractView()

blender::ui::AbstractView::AbstractView ( )
protecteddefault

Member Function Documentation

◆ allow_multiselect_items()

void blender::ui::AbstractView::allow_multiselect_items ( )

Definition at line 257 of file abstract_view.cc.

Referenced by blender::ed::object::shapekey::template_tree().

◆ begin_filtering()

bool blender::ui::AbstractView::begin_filtering ( const bContext & C) const
virtual

Enable filtering. Typically used to enable a filter text button. Triggered on Ctrl+F by default.

Returns
True when filtering was enabled successfully.

Reimplemented in blender::ed::asset::shelf::AssetView.

Definition at line 119 of file abstract_view.cc.

Referenced by ui_view_start_filter_invoke().

◆ begin_renaming()

bool blender::ui::AbstractView::begin_renaming ( )
Returns
If renaming was started successfully.

Definition at line 202 of file abstract_view.cc.

References is_renaming().

◆ change_state_delayed()

void blender::ui::AbstractView::change_state_delayed ( )
protectedvirtual

Items may want to do additional work when state changes. But these state changes can only be reliably detected after the view has completed reconstruction (see is_reconstructed()). So the actual state changes are done in a delayed manner through this function.

Overrides should call the base class implementation.

Definition at line 79 of file abstract_view.cc.

References AbstractViewItem, BLI_assert_msg, blender::ui::AbstractViewItem::change_state_delayed(), foreach_view_item(), is_reconstructed(), and blender::ui::AbstractViewItem::should_be_active().

Referenced by blender::ui::GridViewBuilder::build_grid_view(), and blender::ui::TreeViewBuilder::build_tree_view().

◆ clear_search_highlight()

void blender::ui::AbstractView::clear_search_highlight ( )

◆ create_drop_target()

std::unique_ptr< DropTargetInterface > blender::ui::AbstractView::create_drop_target ( )
virtual

If a view wants to support dropping data into it, it has to return a drop target here. That is an object implementing DropTargetInterface.

Note
This drop target may be requested for each event. The view doesn't keep the drop target around currently. So it cannot contain persistent state.

Definition at line 107 of file abstract_view.cc.

◆ draw_overlays()

void blender::ui::AbstractView::draw_overlays ( const ARegion & region,
const uiBlock & block ) const
virtual

Reimplemented in blender::ui::AbstractTreeView.

Definition at line 124 of file abstract_view.cc.

◆ end_renaming()

void blender::ui::AbstractView::end_renaming ( )

Definition at line 212 of file abstract_view.cc.

References BLI_assert, and is_renaming().

Referenced by blender::ui::AbstractViewItem::end_renaming().

◆ filter()

◆ foreach_view_item()

virtual void blender::ui::AbstractView::foreach_view_item ( FunctionRef< void(AbstractViewItem &)> iter_fn) const
pure virtual

◆ get_bounds()

std::optional< rcti > blender::ui::AbstractView::get_bounds ( ) const

Get the rectangle containing all the view items that are in the layout, in button space. Updated as part of UI_block_end(), before that it's unset.

Definition at line 227 of file abstract_view.cc.

◆ get_context_menu_title()

std::string blender::ui::AbstractView::get_context_menu_title ( ) const

Definition at line 232 of file abstract_view.cc.

Referenced by UI_but_context_menu_title_from_button().

◆ get_popup_keep_open()

bool blender::ui::AbstractView::get_popup_keep_open ( ) const

Definition at line 242 of file abstract_view.cc.

Referenced by UI_view_item_popup_keep_open().

◆ get_rename_buffer() [1/2]

MutableSpan< char > blender::ui::AbstractView::get_rename_buffer ( )

Definition at line 222 of file abstract_view.cc.

◆ get_rename_buffer() [2/2]

Span< char > blender::ui::AbstractView::get_rename_buffer ( ) const

Definition at line 218 of file abstract_view.cc.

◆ is_fully_visible()

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

Reimplemented in blender::ui::AbstractTreeView.

Definition at line 134 of file abstract_view.cc.

◆ is_multiselect_supported()

bool blender::ui::AbstractView::is_multiselect_supported ( ) const

Definition at line 262 of file abstract_view.cc.

◆ is_reconstructed()

bool blender::ui::AbstractView::is_reconstructed ( ) const
protected

Check if the view is fully (re-)constructed. That means, both the build function and update_from_old() have finished.

Definition at line 28 of file abstract_view.cc.

Referenced by change_state_delayed().

◆ is_renaming()

bool blender::ui::AbstractView::is_renaming ( ) const

Only one item can be renamed at a time.

Definition at line 197 of file abstract_view.cc.

Referenced by begin_renaming(), blender::ui::AbstractViewItem::begin_renaming(), and end_renaming().

◆ listen()

bool blender::ui::AbstractView::listen ( const wmNotifier & ) const
virtual

Listen to a notifier, returning true if a redraw is needed.

Reimplemented in blender::ui::bonecollections::BoneCollectionTreeView.

Definition at line 113 of file abstract_view.cc.

◆ persistent_state()

std::optional< uiViewState > blender::ui::AbstractView::persistent_state ( ) const
virtual

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 in blender::ui::AbstractTreeView.

Definition at line 144 of file abstract_view.cc.

◆ persistent_state_apply()

void blender::ui::AbstractView::persistent_state_apply ( const uiViewState & state)
virtual

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

Reimplemented in blender::ui::AbstractTreeView.

Definition at line 149 of file abstract_view.cc.

◆ register_item()

void blender::ui::AbstractView::register_item ( AbstractViewItem & item)

Makes item valid for display in this view. Behavior is undefined for items not registered with this.

Definition at line 17 of file abstract_view.cc.

References AbstractViewItem, and blender::ui::AbstractViewItem::view_.

Referenced by blender::ui::TreeViewItemContainer::add_tree_item().

◆ scroll()

void blender::ui::AbstractView::scroll ( ViewScrollDirection direction)
virtual

Reimplemented in blender::ui::AbstractTreeView.

Definition at line 139 of file abstract_view.cc.

References BLI_assert_msg.

◆ search_highlight_item()

const AbstractViewItem * blender::ui::AbstractView::search_highlight_item ( ) const
protected

◆ set_context_menu_title()

◆ set_popup_keep_open()

void blender::ui::AbstractView::set_popup_keep_open ( )

If this view is displayed in a popup, don't close it when clicking to activate items.

Definition at line 247 of file abstract_view.cc.

Referenced by blender::ed::asset::shelf::AssetCatalogTreeView::AssetCatalogTreeView().

◆ supports_scrolling()

bool blender::ui::AbstractView::supports_scrolling ( ) const
virtual

Definition at line 129 of file abstract_view.cc.

Referenced by blender::ui::AbstractTreeView::scroll().

◆ update_children_from_old()

virtual void blender::ui::AbstractView::update_children_from_old ( const AbstractView & old_view)
protectedpure virtual

References AbstractView(), and AbstractViewItem.

Referenced by update_from_old().

◆ update_from_old()

void blender::ui::AbstractView::update_from_old ( uiBlock & new_block)
protected

Match the view and its items against an earlier version of itself (if any) and copy the old UI state (e.g. collapsed, active, selected, renaming, etc.) to the new one. See #AbstractViewItem.update_from_old(). After this, reconstruction is complete (see is_reconstructed()).

Definition at line 45 of file abstract_view.cc.

References AbstractView(), uiBlock::oldblock, ui_block_view_find_matching_in_old_block(), and update_children_from_old().

Referenced by blender::ui::GridViewBuilder::build_grid_view(), and blender::ui::TreeViewBuilder::build_tree_view().

◆ ::ViewLink

friend struct ::ViewLink
friend

Definition at line 57 of file UI_abstract_view.hh.

◆ AbstractViewItem


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