Blender  V3.3
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
blender::ui::PreviewGridItem Class Reference

#include <UI_grid_view.hh>

Inheritance diagram for blender::ui::PreviewGridItem:
blender::ui::AbstractGridViewItem blender::ui::AbstractViewItem

Public Types

using IsActiveFn = std::function< bool()>
 
using ActivateFn = std::function< void(PreviewGridItem &new_active)>
 

Public Member Functions

 PreviewGridItem (StringRef identifier, StringRef label, int preview_icon_id)
 
void build_grid_tile (uiLayout &layout) const override
 
void set_on_activate_fn (ActivateFn fn)
 
void set_is_active_fn (IsActiveFn fn)
 
- Public Member Functions inherited from blender::ui::AbstractGridViewItem
virtual ~AbstractGridViewItem ()=default
 
const AbstractGridViewget_view () const
 
- Public Member Functions inherited from blender::ui::AbstractViewItem
virtual ~AbstractViewItem ()=default
 
virtual void build_context_menu (bContext &C, uiLayout &column) const
 
virtual std::unique_ptr< AbstractViewItemDragControllercreate_drag_controller () const
 
virtual std::unique_ptr< AbstractViewItemDropControllercreate_drop_controller () const
 
AbstractViewget_view () const
 
bool is_active () const
 
virtual bool supports_renaming () const
 
virtual bool rename (StringRefNull new_name)
 
virtual StringRef get_rename_string () const
 
bool is_renaming () const
 
void begin_renaming ()
 
void end_renaming ()
 
void rename_apply ()
 

Public Attributes

std::string label {}
 
int preview_icon_id = ICON_NONE
 

Protected Attributes

ActivateFn activate_fn_
 
IsActiveFn is_active_fn_
 
- Protected Attributes inherited from blender::ui::AbstractGridViewItem
StringRef identifier_ {}
 
uiButViewItemview_item_but_ = nullptr
 
- Protected Attributes inherited from blender::ui::AbstractViewItem
AbstractViewview_ = nullptr
 
bool is_active_ = false
 
bool is_renaming_ = false
 

Additional Inherited Members

- Static Public Member Functions inherited from blender::ui::AbstractViewItem
template<typename ToType = AbstractViewItem>
static ToType * from_item_handle (uiViewItemHandle *handle)
 
- Protected Member Functions inherited from blender::ui::AbstractGridViewItem
 AbstractGridViewItem (StringRef identifier)
 
virtual bool matches (const AbstractViewItem &other) const override
 
void activate ()
 
void deactivate ()
 
- Protected Member Functions inherited from blender::ui::AbstractViewItem
 AbstractViewItem ()=default
 
virtual void update_from_old (const AbstractViewItem &old)
 
void add_rename_button (uiBlock &block)
 

Detailed Description

A grid item that shows preview image icons at a nicely readable size (multiple of the normal UI unit size).

Definition at line 182 of file UI_grid_view.hh.

Member Typedef Documentation

◆ ActivateFn

using blender::ui::PreviewGridItem::ActivateFn = std::function<void(PreviewGridItem &new_active)>

Definition at line 185 of file UI_grid_view.hh.

◆ IsActiveFn

Definition at line 184 of file UI_grid_view.hh.

Constructor & Destructor Documentation

◆ PreviewGridItem()

blender::ui::PreviewGridItem::PreviewGridItem ( StringRef  identifier,
StringRef  label,
int  preview_icon_id 
)

Definition at line 408 of file grid_view.cc.

Member Function Documentation

◆ build_grid_tile()

void blender::ui::PreviewGridItem::build_grid_tile ( uiLayout layout) const
overridevirtual

◆ set_is_active_fn()

void blender::ui::PreviewGridItem::set_is_active_fn ( IsActiveFn  fn)

Set a custom callback to check if this item should be active.

Definition at line 443 of file grid_view.cc.

References is_active_fn_.

◆ set_on_activate_fn()

void blender::ui::PreviewGridItem::set_on_activate_fn ( ActivateFn  fn)

Set a custom callback to execute when activating this view item. This way users don't have to sub-class PreviewGridItem, just to implement custom activation behavior (a common thing to do).

Definition at line 438 of file grid_view.cc.

References activate_fn_.

Member Data Documentation

◆ activate_fn_

ActivateFn blender::ui::PreviewGridItem::activate_fn_
protected

See set_on_activate_fn()

Definition at line 189 of file UI_grid_view.hh.

Referenced by set_on_activate_fn().

◆ is_active_fn_

IsActiveFn blender::ui::PreviewGridItem::is_active_fn_
protected

See set_is_active_fn()

Definition at line 191 of file UI_grid_view.hh.

Referenced by set_is_active_fn().

◆ label

std::string blender::ui::PreviewGridItem::label {}

Definition at line 194 of file UI_grid_view.hh.

Referenced by build_grid_tile().

◆ preview_icon_id

int blender::ui::PreviewGridItem::preview_icon_id = ICON_NONE

Definition at line 195 of file UI_grid_view.hh.

Referenced by build_grid_tile().


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