diff options
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r-- | source/blender/editors/include/UI_tree_view.hh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/include/UI_tree_view.hh b/source/blender/editors/include/UI_tree_view.hh index 0d18eedeac9..5acee02a8cc 100644 --- a/source/blender/editors/include/UI_tree_view.hh +++ b/source/blender/editors/include/UI_tree_view.hh @@ -358,11 +358,18 @@ class AbstractTreeViewItem : public TreeViewItemContainer { * custom implementation of #AbstractTreeViewItem::create_drag_controller(). */ class AbstractTreeViewItemDragController { + protected: + AbstractTreeView &tree_view_; + public: + AbstractTreeViewItemDragController(AbstractTreeView &tree_view); virtual ~AbstractTreeViewItemDragController() = default; virtual int get_drag_type() const = 0; virtual void *create_drag_data() const = 0; + virtual void on_drag_start(); + + template<class TreeViewType> inline TreeViewType &tree_view() const; }; /** @@ -453,6 +460,13 @@ inline ItemT &TreeViewItemContainer::add_tree_item(Args &&...args) add_tree_item(std::make_unique<ItemT>(std::forward<Args>(args)...))); } +template<class TreeViewType> TreeViewType &AbstractTreeViewItemDragController::tree_view() const +{ + static_assert(std::is_base_of<AbstractTreeView, TreeViewType>::value, + "Type must derive from and implement the AbstractTreeView interface"); + return static_cast<TreeViewType &>(tree_view_); +} + template<class TreeViewType> TreeViewType &AbstractTreeViewItemDropController::tree_view() const { static_assert(std::is_base_of<AbstractTreeView, TreeViewType>::value, |