Blender V4.3
blender::ui::AbstractGridView Class Referenceabstract

#include <UI_grid_view.hh>

Inherits blender::ui::AbstractView.

Inherited by blender::ed::asset::shelf::AssetView.

Public Types

using ItemIterFn = FunctionRef<void(AbstractGridViewItem &)>
 

Public Member Functions

 AbstractGridView ()
 
 ~AbstractGridView () override=default
 
void foreach_item (ItemIterFn iter_fn) const
 
void foreach_filtered_item (ItemIterFn iter_fn) const
 
template<class ItemT , typename... Args>
ItemT & add_item (Args &&...args)
 
const GridViewStyleget_style () const
 
int get_item_count () const
 
int get_item_count_filtered () const
 
void set_tile_size (int tile_width, int tile_height)
 
- 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
 
virtual void draw_overlays (const ARegion &region, const uiBlock &block) const
 
virtual bool supports_scrolling () const
 
virtual void scroll (ViewScrollDirection direction)
 
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

virtual void build_items ()=0
 
- 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 Attributes

Vector< std::unique_ptr< AbstractGridViewItem > > items_
 
std::optional< intitem_count_filtered_
 
Map< StringRef, AbstractGridViewItem * > item_map_
 
GridViewStyle style_
 

Friends

class AbstractGridViewItem
 
class GridViewBuilder
 
class GridViewLayoutBuilder
 

Detailed Description

Definition at line 80 of file UI_grid_view.hh.

Member Typedef Documentation

◆ ItemIterFn

Constructor & Destructor Documentation

◆ AbstractGridView()

blender::ui::AbstractGridView::AbstractGridView ( )

Definition at line 33 of file grid_view.cc.

◆ ~AbstractGridView()

blender::ui::AbstractGridView::~AbstractGridView ( )
overridedefault

Member Function Documentation

◆ add_item()

template<class ItemT , typename... Args>
ItemT & blender::ui::AbstractGridView::add_item ( Args &&... args)
inline

Convenience wrapper constructing the item by forwarding given arguments to the constructor of the type (ItemT).

E.g. if your grid-item type has the following constructor:

MyGridItem(std::string str, int i);
#define str(s)

You can add an item like this:

add_item<MyGridItem>("blabla", 42);
ItemT & add_item(Args &&...args)

Definition at line 237 of file UI_grid_view.hh.

Referenced by blender::ed::asset::shelf::AssetView::build_items().

◆ build_items()

virtual void blender::ui::AbstractGridView::build_items ( )
protectedpure virtual

◆ foreach_filtered_item()

void blender::ui::AbstractGridView::foreach_filtered_item ( ItemIterFn iter_fn) const

◆ foreach_item()

void blender::ui::AbstractGridView::foreach_item ( ItemIterFn iter_fn) const

Definition at line 57 of file grid_view.cc.

References items_.

◆ get_item_count()

int blender::ui::AbstractGridView::get_item_count ( ) const

Definition at line 102 of file grid_view.cc.

References items_.

Referenced by get_item_count_filtered().

◆ get_item_count_filtered()

◆ get_style()

◆ set_tile_size()

void blender::ui::AbstractGridView::set_tile_size ( int tile_width,
int tile_height )

Friends And Related Symbol Documentation

◆ AbstractGridViewItem

friend class AbstractGridViewItem
friend

Definition at line 81 of file UI_grid_view.hh.

◆ GridViewBuilder

friend class GridViewBuilder
friend

Definition at line 82 of file UI_grid_view.hh.

◆ GridViewLayoutBuilder

friend class GridViewLayoutBuilder
friend

Definition at line 83 of file UI_grid_view.hh.

Member Data Documentation

◆ item_count_filtered_

std::optional<int> blender::ui::AbstractGridView::item_count_filtered_
mutableprotected

Store this to avoid recomputing.

Definition at line 88 of file UI_grid_view.hh.

Referenced by get_item_count_filtered().

◆ item_map_

Map<StringRef, AbstractGridViewItem *> blender::ui::AbstractGridView::item_map_
protected

<identifier, item> map to lookup items by identifier, used for efficient lookups in update_from_old().

Definition at line 91 of file UI_grid_view.hh.

◆ items_

Vector<std::unique_ptr<AbstractGridViewItem> > blender::ui::AbstractGridView::items_
protected

Definition at line 86 of file UI_grid_view.hh.

Referenced by foreach_filtered_item(), foreach_item(), and get_item_count().

◆ style_

GridViewStyle blender::ui::AbstractGridView::style_
protected

Definition at line 92 of file UI_grid_view.hh.

Referenced by get_style(), and set_tile_size().


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