Blender  V3.3
Public Member Functions | Protected Attributes | List of all members
blender::ui::AbstractViewItemDropController Class Referenceabstract

#include <UI_abstract_view.hh>

Inheritance diagram for blender::ui::AbstractViewItemDropController:
blender::ed::asset_browser::AssetCatalogDropController

Public Member Functions

virtual ~AbstractViewItemDropController ()=default
 
virtual bool can_drop (const wmDrag &drag, const char **r_disabled_hint) const =0
 
virtual std::string drop_tooltip (const wmDrag &drag) const =0
 
virtual bool on_drop (struct bContext *C, const wmDrag &drag)=0
 
Drag 'n Drop
 AbstractViewItemDropController (AbstractView &view)
 
template<class ViewType >
ViewType & get_view () const
 

Protected Attributes

AbstractViewview_
 

Detailed Description

Class to define the behavior when dropping something onto/into a view item, plus the behavior when dragging over this item. An item can return a drop controller for itself via a custom implementation of #AbstractViewItem::create_drop_controller().

Definition at line 229 of file UI_abstract_view.hh.

Constructor & Destructor Documentation

◆ AbstractViewItemDropController()

blender::ui::AbstractViewItemDropController::AbstractViewItemDropController ( AbstractView view)

Definition at line 192 of file abstract_view_item.cc.

◆ ~AbstractViewItemDropController()

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

Member Function Documentation

◆ can_drop()

virtual bool blender::ui::AbstractViewItemDropController::can_drop ( const wmDrag drag,
const char **  r_disabled_hint 
) const
pure virtual

Check if the data dragged with drag can be dropped on the item this controller is for.

Parameters
r_disabled_hintReturn a static string to display to the user, explaining why dropping isn't possible on this item. Shouldn't be done too aggressively, e.g. don't set this if the drag-type can't be dropped here; only if it can but there's another reason it can't be dropped. Can assume this is a non-null pointer.

Implemented in blender::ed::asset_browser::AssetCatalogDropController.

◆ drop_tooltip()

virtual std::string blender::ui::AbstractViewItemDropController::drop_tooltip ( const wmDrag drag) const
pure virtual

Custom text to display when dragging over a view item. Should explain what happens when dropping the data onto this item. Will only be used if #AbstractViewItem::can_drop() returns true, so the implementing override doesn't have to check that again. The returned value must be a translated string.

Implemented in blender::ed::asset_browser::AssetCatalogDropController.

◆ get_view()

template<class ViewType >
ViewType & blender::ui::AbstractViewItemDropController::get_view
inline

Request the view the item is registered for as type #ViewType. Throws a std::bad_cast exception if the view is not of the requested type.

Definition at line 271 of file UI_abstract_view.hh.

References view_.

◆ on_drop()

virtual bool blender::ui::AbstractViewItemDropController::on_drop ( struct bContext C,
const wmDrag drag 
)
pure virtual

Execute the logic to apply a drop of the data dragged with drag onto/into the item this controller is for.

Implemented in blender::ed::asset_browser::AssetCatalogDropController.

Member Data Documentation

◆ view_

AbstractView& blender::ui::AbstractViewItemDropController::view_
protected

Definition at line 231 of file UI_abstract_view.hh.

Referenced by get_view().


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