Skip to main content

Interface: DropTargetProps

Defined in: types.ts:81

Props for DropTarget controller.

Enables dropping content onto a widget. Attach a DropTarget to make a widget accept drops.

Properties

dropActions?

optional dropActions: DragAction

Defined in: types.ts:112

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


dropTypes?

optional dropTypes: number[]

Defined in: types.ts:117

Array of GTypes that this drop target accepts. Use typeFromName() to get GType values (e.g., typeFromName("gchararray") for strings).


onDrop()?

optional onDrop: (value, x, y) => boolean

Defined in: types.ts:89

Called when content is dropped on the widget.

Parameters

ParameterTypeDescription
valueValueThe dropped value (use value.getTypeName() to check type, then extract)
xnumberX coordinate of drop
ynumberY coordinate of drop

Returns

boolean

true if the drop was accepted


onDropEnter()?

optional onDropEnter: (x, y) => DragAction

Defined in: types.ts:96

Called when a drag enters the widget bounds.

Parameters

ParameterTypeDescription
xnumberX coordinate
ynumberY coordinate

Returns

DragAction

The preferred action, or 0 to reject


onDropLeave()?

optional onDropLeave: () => void

Defined in: types.ts:100

Called when a drag leaves the widget bounds.

Returns

void


onDropMotion()?

optional onDropMotion: (x, y) => DragAction

Defined in: types.ts:107

Called when a drag moves within the widget bounds.

Parameters

ParameterTypeDescription
xnumberX coordinate
ynumberY coordinate

Returns

DragAction

The preferred action, or 0 to reject