Blender V4.3
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 void scroll (ViewScrollDirection direction)
 
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 ()
 

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 54 of file UI_abstract_view.hh.

Constructor & Destructor Documentation

◆ ~AbstractView()

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

◆ AbstractView()

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

Member Function Documentation

◆ 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 183 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 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 193 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 208 of file abstract_view.cc.

◆ get_context_menu_title()

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

Definition at line 213 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 223 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 203 of file abstract_view.cc.

◆ get_rename_buffer() [2/2]

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

Definition at line 199 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 178 of file abstract_view.cc.

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

◆ 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.

◆ 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 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 134 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 228 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.

◆ update_children_from_old()

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

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 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().

Friends And Related Symbol Documentation

◆ ::ViewLink

friend struct ::ViewLink
friend

Definition at line 56 of file UI_abstract_view.hh.

◆ AbstractViewItem

friend class AbstractViewItem
friend

Definition at line 55 of file UI_abstract_view.hh.


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