Drag[en]gine Script Module DragonScript Script API  1.0
DefaultDragAndDrop Class Reference

Default implementation of DragAndDrop. More...

Inheritance diagram for DefaultDragAndDrop:

Public Member Functions

void beginDrag ()
 Begin drag and drop operation. More...
void dropDone (bool success)
 Drop has been processed. More...
bool endDrag (bool abord)
 End drag and drop operation. More...
bool getCanDrop ()
 Drop action is valid on the target. More...
DNDTypeList getDataTypes ()
 List of supported data types by the drag source. More...
Object getDragDataAs (String type)
 Drag data in a specific format or null if not supported. More...
Widget getDragSource ()
 Drag source. More...
Widget getDragTarget ()
 Current target. More...
void mouseMove (MouseEvent event)
 Process mouse move event. More...
DefaultDragAndDrop new (Widget source)
 Create default drag and drop. More...
void setCanDrop (bool canDrop)
 Set if dropping is possible at the current location. More...
void setDataTypes (DNDTypeList list)
 Set list of supported data types. More...
bool supportsDataType (String type)
 Drag source supports a type. More...

Detailed Description

Default implementation of DragAndDrop.

Provides support to conduct conveniently drag and drop operations. Use beginDrag to start a drag and drop operation. This grabs the mouse and keyboard on the widget used during creation time. Use mouseEvent in response to mouse move events to send the right messages to the drop widgets. This class takes care of tracking the hover widget and sending the proper events. You just have to call mouseEvent for this to work. During this call the target can alter the can drop status therefore you should check with getCanDrop after mouseEvent to adjust your look. Once you are ready to drop use endDrag. If the parameter is true the drop target is notified about the drag operation completion and carries out the appropriate action. If the operation ended successfully true is returned otherwise false. Therefore if you need to alter your own state in response to a drop action do this if the return value is true. This method also ungrabs the source widget.


Make DefaultDragAndDrop also implement MouseListener. Upon calling beginDrag() add dragAndDrop instance as mouse listener to source widget. Upon calling endDrag() remove dragAndDrop instance as mouse listener from source widget. This way it is not necessary for the user of dragAndDrop instance to manually send mouse events.

Also add support to manage an optional semi-transparent WindowPopup widget with a drag image inside. If used the window has to be placed at the right offset underneath the parent desktop mouse pointer. The window position is update when mouse events are received. This replaces the removed DragMousePointer class.

Member Function Documentation

◆ beginDrag()

void beginDrag ( )

Begin drag and drop operation.

◆ dropDone()

void dropDone ( bool  success)

Drop has been processed.

The drag and drop operation is finished after this call.

Implements DragAndDrop.

◆ endDrag()

bool endDrag ( bool  abord)

End drag and drop operation.

◆ getCanDrop()

bool getCanDrop ( )

Drop action is valid on the target.

◆ getDataTypes()

DNDTypeList getDataTypes ( )

List of supported data types by the drag source.

Implements DragAndDrop.

◆ getDragDataAs()

Object getDragDataAs ( String  type)

Drag data in a specific format or null if not supported.

Implements DragAndDrop.

◆ getDragSource()

Widget getDragSource ( )

Drag source.

Implements DragAndDrop.

◆ getDragTarget()

Widget getDragTarget ( )

Current target.

◆ mouseMove()

void mouseMove ( MouseEvent  event)

Process mouse move event.

◆ new()

DefaultDragAndDrop new ( Widget  source)

Create default drag and drop.

◆ setCanDrop()

void setCanDrop ( bool  canDrop)

Set if dropping is possible at the current location.

Implements DragAndDrop.

◆ setDataTypes()

void setDataTypes ( DNDTypeList  list)

Set list of supported data types.

◆ supportsDataType()

bool supportsDataType ( String  type)

Drag source supports a type.

Implements DragAndDrop.

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