Drag[en]gine Script Module DragonScript
1.23
|
Default implementation of DragAndDrop. More...
Classes | |
class | TrackDragListener |
Drag processing listener. More... | |
Public Member Functions | |
void | addSupportedDataType (String type) |
Add supported drag type. More... | |
void | beginDrag (int mouseButton) |
Begin drag and drop operation. More... | |
void | dropDone (bool success) |
Drop has been processed. More... | |
void | 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... | |
Protected Member Functions | |
void | onCanDropChanged () |
Can drop changed. More... | |
void | onDragFinished () |
Drag finished. More... | |
void | onDropFinished () |
Drop finished. More... | |
void | onDropTargetChanged () |
Drop target changed. More... | |
Default implementation of DragAndDrop.
Provides support to do conveniently drag and drop operations. Subclass to use. Call beginDrag to start a drag and drop operation with a specific mouse button to track to end the drag operation. This grabs the mouse and keyboard on the widget used during constructing the object and adds a temporary mouse listener to track events. While tracking events the drop target can alter the can drop status. To react to these changes overwrite onCanDropChanged() and check getCanDrop(). Upon receiving mouse button release event matching the requested mouse button endDrag() is called. Drag can be cancelled any time by calling endDrag with abort set to true. The endDrag() call removes the temporary mouse listener and notifies the drop target if getCanDrop() is true. To react to this event overwrite onDragFinished(). The drop target then calls getDragDataAs() to retrieve the data. Overwrite getDragDataAs() to provide the data in the desired format if possible. Once processed the drop target calls dropDone() to indicate drop having finished. This can be any time later in case the drop target needs a longer time to finish. Once dropDone() is called onDropFinished() is called which marks the end of the drag and drop operation.
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.
void Dragengine.Gui.DefaultDragAndDrop.addSupportedDataType | ( | String | type | ) |
Add supported drag type.
void Dragengine.Gui.DefaultDragAndDrop.beginDrag | ( | int | mouseButton | ) |
Begin drag and drop operation.
Indicate mouse button tracked to end drag operation.
void Dragengine.Gui.DefaultDragAndDrop.dropDone | ( | bool | success | ) |
Drop has been processed.
Called by the drop target to signal it has finished processing the data. The drag and drop operation is finished after this call.
Implements Dragengine.Gui.DragAndDrop.
void Dragengine.Gui.DefaultDragAndDrop.endDrag | ( | bool | abord | ) |
End drag and drop operation.
Called by TrackDragListener.
bool Dragengine.Gui.DefaultDragAndDrop.getCanDrop | ( | ) |
Drop action is valid on the target.
DNDTypeList Dragengine.Gui.DefaultDragAndDrop.getDataTypes | ( | ) |
List of supported data types by the drag source.
Do not modify this unless you are the owner. If you need to modify this list create a copy first.
Implements Dragengine.Gui.DragAndDrop.
Object Dragengine.Gui.DefaultDragAndDrop.getDragDataAs | ( | String | type | ) |
Drag data in a specific format or null if not supported.
Overwrite in subclass to provided data in the appropriate format if possible.
Implements Dragengine.Gui.DragAndDrop.
Widget Dragengine.Gui.DefaultDragAndDrop.getDragSource | ( | ) |
Drag source.
Implements Dragengine.Gui.DragAndDrop.
Widget Dragengine.Gui.DefaultDragAndDrop.getDragTarget | ( | ) |
Current target.
void Dragengine.Gui.DefaultDragAndDrop.mouseMove | ( | MouseEvent | event | ) |
Process mouse move event.
Called by TrackDragListener.
DefaultDragAndDrop Dragengine.Gui.DefaultDragAndDrop.new | ( | Widget | source | ) |
Create default drag and drop.
|
protected |
Can drop changed.
|
protected |
Drag finished.
|
protected |
Drop finished.
|
protected |
Drop target changed.
void Dragengine.Gui.DefaultDragAndDrop.setCanDrop | ( | bool | canDrop | ) |
Set if dropping is possible at the current location.
Implements Dragengine.Gui.DragAndDrop.
void Dragengine.Gui.DefaultDragAndDrop.setDataTypes | ( | DNDTypeList | list | ) |
Set list of supported data types.
bool Dragengine.Gui.DefaultDragAndDrop.supportsDataType | ( | String | type | ) |
Drag source supports a type.
Implements Dragengine.Gui.DragAndDrop.