Skip to main content

Interface: DragSourceProps

Defined in: types.ts:42

Props for DragSource controller.

Enables dragging content from a widget. Attach a DragSource to make a widget draggable.

Properties

dragActions?

optional dragActions: DragAction

Defined in: types.ts:72

The allowed drag actions (COPY, MOVE, LINK, ASK). Defaults to Gdk.DragAction.COPY if not specified.


onDragBegin()?

optional onDragBegin: (drag) => void

Defined in: types.ts:54

Called when the drag operation begins.

Parameters

ParameterTypeDescription
dragDragThe Gdk.Drag object representing the ongoing drag

Returns

void


onDragCancel()?

optional onDragCancel: (drag, reason) => boolean

Defined in: types.ts:67

Called when the drag operation is cancelled.

Parameters

ParameterTypeDescription
dragDragThe Gdk.Drag object
reasonDragCancelReasonThe reason for cancellation

Returns

boolean

true if the cancel was handled


onDragEnd()?

optional onDragEnd: (drag, deleteData) => void

Defined in: types.ts:60

Called when the drag operation ends.

Parameters

ParameterTypeDescription
dragDragThe Gdk.Drag object
deleteDatabooleanWhether the data should be deleted (for move operations)

Returns

void


onDragPrepare()?

optional onDragPrepare: (x, y) => ContentProvider | null

Defined in: types.ts:49

Called when a drag is about to start. Return a ContentProvider with the data to be dragged, or null to cancel the drag.

Parameters

ParameterTypeDescription
xnumberX coordinate where drag started
ynumberY coordinate where drag started

Returns

ContentProvider | null