Blender V5.0
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 bool is_fully_visible () const
virtual void scroll (ViewScrollDirection direction)
virtual std::optional< uiViewStatepersistent_state () const
virtual void persistent_state_apply (const uiViewState &state)
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

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< int > item_count_filtered_
Map< StringRef, AbstractGridViewItem * > item_map_
GridViewStyle style_

Friends

class AbstractGridViewItem
class GridViewBuilder
class GridViewLayoutBuilder

Detailed Description

Definition at line 83 of file UI_grid_view.hh.

Member Typedef Documentation

◆ ItemIterFn

Constructor & Destructor Documentation

◆ AbstractGridView()

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

Definition at line 34 of file grid_view.cc.

References style_, UI_preview_tile_size_x(), and UI_preview_tile_size_y().

Referenced by build_items().

◆ ~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)
i
Definition text_draw.cc:230

You can add an item like this:

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

Definition at line 239 of file UI_grid_view.hh.

References add_item().

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

◆ build_items()

◆ foreach_filtered_item()

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

Definition at line 65 of file grid_view.cc.

References items_.

Referenced by blender::ui::GridViewLayoutBuilder::build_from_view(), and get_item_count_filtered().

◆ foreach_item()

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

Definition at line 58 of file grid_view.cc.

References items_.

◆ get_item_count()

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

Definition at line 103 of file grid_view.cc.

References items_.

Referenced by get_item_count_filtered().

◆ get_item_count_filtered()

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

◆ get_style()

◆ set_tile_size()

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

Definition at line 122 of file grid_view.cc.

References style_.

◆ AbstractGridViewItem

friend class AbstractGridViewItem
friend

Definition at line 84 of file UI_grid_view.hh.

References AbstractGridViewItem.

Referenced by AbstractGridViewItem, and build_items().

◆ GridViewBuilder

friend class GridViewBuilder
friend

Definition at line 85 of file UI_grid_view.hh.

References GridViewBuilder.

Referenced by GridViewBuilder.

◆ GridViewLayoutBuilder

friend class GridViewLayoutBuilder
friend

Definition at line 86 of file UI_grid_view.hh.

References GridViewLayoutBuilder.

Referenced by GridViewLayoutBuilder.

Member Data Documentation

◆ item_count_filtered_

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

Store this to avoid recomputing.

Definition at line 91 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 94 of file UI_grid_view.hh.

◆ items_

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

Definition at line 89 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 95 of file UI_grid_view.hh.

Referenced by AbstractGridView(), get_style(), and set_tile_size().


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