Plasma Engine  2.0
Loading...
Searching...
No Matches
DragDropHandler.h
1#pragma once
2
3#include <EditorFramework/EditorFrameworkDLL.h>
4#include <Foundation/Reflection/Reflection.h>
5
8
9class PL_EDITORFRAMEWORK_DLL plDragDropHandler : public plReflectedClass
10{
11 PL_ADD_DYNAMIC_REFLECTION(plDragDropHandler, plReflectedClass);
12
13public:
15 static bool IsHandlerActive() { return s_pActiveDnD != nullptr; }
16
19 static bool BeginDragDropOperation(const plDragDropInfo* pInfo, plDragDropConfig* pConfigToFillOut = nullptr);
20
22 static void UpdateDragDropOperation(const plDragDropInfo* pInfo);
23
25 static void FinishDragDrop(const plDragDropInfo* pInfo);
26
28 static void CancelDragDrop();
29
30
33 static bool CanDropOnly(const plDragDropInfo* pInfo);
34
36 static bool DropOnly(const plDragDropInfo* pInfo);
37
38public:
40
41
42protected:
47 virtual float CanHandle(const plDragDropInfo* pInfo) const = 0;
48
50 virtual void RequestConfiguration(plDragDropConfig* pConfigToFillOut) {}
51
53 virtual void OnDragBegin(const plDragDropInfo* pInfo) = 0;
54
56 virtual void OnDragUpdate(const plDragDropInfo* pInfo) = 0;
57
60 virtual void OnDragCancel() = 0;
61
63 virtual void OnDrop(const plDragDropInfo* pInfo) = 0;
64
65private:
66 static plDragDropHandler* FindDragDropHandler(const plDragDropInfo* pInfo);
67
68 static plDragDropHandler* s_pActiveDnD;
69};
After an plDragDropHandler has been chosen to handle an operation, it is queried once to fill out an ...
Definition DragDropInfo.h:60
Definition DragDropHandler.h:10
virtual void OnDrop(const plDragDropInfo *pInfo)=0
Final call to finish the drag & drop operation. Handler is destroyed after this.
virtual void OnDragCancel()=0
Called when the drag operation leaves the designated area. The handler will be destroyed after this....
virtual float CanHandle(const plDragDropInfo *pInfo) const =0
Used to ask a handler whether it knows how to handle a certain drag & drop situation.
virtual void OnDragBegin(const plDragDropInfo *pInfo)=0
Called shortly after CanHandle returned true to begin handling a drag operation.
static bool IsHandlerActive()
Returns whether the last call to BeginDragDropOperation() was successful and a handler is now in effe...
Definition DragDropHandler.h:15
virtual void OnDragUpdate(const plDragDropInfo *pInfo)=0
Called to update the drag operation with the latest state.
virtual void RequestConfiguration(plDragDropConfig *pConfigToFillOut)
Potentially called by the drag drop target to request information about how to determine the plDragDr...
Definition DragDropHandler.h:50
This type is used to provide plDragDropHandler instances with all the important information for a dra...
Definition DragDropInfo.h:16
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition DynamicRTTI.h:86