class
DragAndDrop
Handles GUI drag and drop operations.
When active GUI elements will be notified of any drag events and will be able to retrieve dragged data. When cursor is released the data will be dropped and underlying GUI elements will be notified the data is dropped. The dropped data is also available for a single frame via GetDropData() method.
Public
Constructors
DragAndDrop
Methods
~DragAndDrop
StartDrag
Starts a drag operation with the specified data.
This means GUI elements will start receiving drag and drop related events and they may choose to handle them.
- data
- Some operation specific data that is just passed through to however needs it.
StartDrag
Starts a drag operation with the specified data.
This means GUI elements will start receiving drag and drop related events and they may choose to handle them.
- data
- Some operation specific data that is just passed through to however needs it.
- dropCallback
- The drop callback that gets triggered whenever mouse button is released and drag operation ends. You should perform any cleanup here.
- needsValidDropTarget
- (optional) Determines whether the drop operation may happen anywhere or does the GUI element need to specifically accept the drag of this type. If false all GUI elements we mouse over will receive drag/drop events, otherwise only those that specifically subscribe to the specified drag operation of this typeId will. Additionally this will determine the cursor displayed (whether or not it can have a "denied" state).
IsDragInProgress
Returns true if drag is currently in progress.
IsDropInProgress
Returns true if a drop operation happened this frame.
GetDragTypeId
Get RTTI ID of the dragged data.
Only valid if drag is in progress.
GetDropTypeId
Get RTTI ID of the dropped data.
Only valid if drop is in progress.
GetDragData
Gets drag specific data specified when the drag started.
Only valid if drag is in progress.
GetDropData
Gets drag specific data specified when the drag started.
Only valid if drop is in progress. This is only valid for a single frame when a drop happens.
NeedsValidDropTarget
Determines whether the drop operation may happen anywhere or does the GUI element need to specifically accept the drag of this type.
If false all GUI elements we mouse over will receive drag/drop events, otherwise only those that specifically subscribe to the specified drag operation of this typeId will.
Additionally this will determine the cursor displayed (whether or not it can have a "denied" state).
AddDropCallback
Registers a new callback that will be triggered when dragged item is dropped.
Provided parameter specifies if the drop operation was handled by anyone or not.
Update
Called once per frame.
Checks if drag ended, drop started/ended or if window loses focus.
staticInstance
Returns a reference to the module instance.
Module has to have been started up first otherwise an exception will be thrown.
staticInstancePtr
Returns a pointer to the module instance.
Module has to have been started up first otherwise an exception will be thrown.
staticShutDown
Shuts down this module and frees any resources it is using.
staticIsStarted
Query if the module has been started.
Fields
OnDragEnded
Triggers a callback when user releases the pointer and the drag operation ends.
Provided parameters inform the subscriber where the pointer was released, and allows the subscriber to note whether the drag operation was processed or not.
Protected
Methods
~Module<T>
OnStartUp
Override if you want your module to be notified once it has been constructed and started.
OnShutDown
Override if you want your module to be notified just before it is deleted.
staticInstanceInternal
Returns a singleton instance of this module.
Private
Methods
EndDrag
Triggers any drop callbacks, clears callback data and starts drop operation.
MouseCaptureChanged
Called by the render thread whenever mouse capture state changes.
This can happen when window loses focus (for example alt+tab). In that case we want to end the drag even if the user is still holding the dragged item.
CursorReleased
Called by the input system when pointer is released.