Canvas Toolkit
← Class index

CDrag

Core · extends CObject

Represents an application drag-and-drop operation.

import { CDrag } from "canvas-toolkit-lib";

Declared members

constructor(source: CObject);

Creates a drag operation for a source object. @param source Object that initiated the drag.

source(): CObject;

Returns the object that initiated the drag. @returns Drag source object.

mimeData(): CMimeData | null;

Returns the data carried by the drag operation. @returns MIME data, or `null` if none has been assigned.

setMimeData(mimeData: CMimeData | null): void;

Sets the data carried by the drag operation. @param mimeData MIME data to carry, or `null`.

supportedActions(): CDropAction;

Returns the supported drop actions. @returns Bit mask of supported drop actions.

defaultAction(): CDropAction;

Returns the preferred default drop action. @returns Default drop action.

dropAction(): CDropAction;

Returns the action selected when the drag finished. @returns Resulting drop action.

isActive(): boolean;

Returns whether the drag operation is active. @returns `true` while the drag is active.

exec(actions: CDropAction, defaultAction?: CDropAction): void;

Starts the drag operation with the supplied actions. @param actions Bit mask of supported drop actions. @param defaultAction Preferred action; unsupported values are replaced with `IgnoreAction`.

finish(action: CDropAction): void;

Finishes the drag operation with a selected action. @param action Drop action to record; unsupported values become `IgnoreAction`.

cancel(): void;

Cancels the drag operation.