class DropTarget

Drop targets allow you to register a certain portion of a window as a drop target that accepts certain drop types from the OS (platform) specific drag and drop system.

Accepted drop types are provided by the OS and include things like file and item dragging.

You will receive events with the specified drop area as long as it is active.

Public

Methods

~DropTarget

~DropTarget()

SetArea

void SetArea(const Area2I &area)

Sets the drop target area, in local window coordinates.

GetArea

const Area2I &GetArea() const

Returns the drop target area, in local window coordinates.

GetDropType

DropTargetType GetDropType() const

Gets the type of drop that this drop target is looking for.

Only valid after a drop has been triggered.

GetFileList

const Vector<Path> &GetFileList() const

Returns a list of files received by the drop target.

Only valid after a drop of FileList type has been triggered.

staticCreate

static SPtr<DropTarget> Create(const RenderWindow *window, const Area2I &area)

Creates a new drop target.

Any drop events that happen on the specified window's drop area will be reported through the target's events.

window
Window to which the drop target will be attached to.
area
Area, relative to the window, in which the drop events are allowed.

Returns: Newly created drop target.

Fields

OnDragOver

Event<void (i32, i32)> OnDragOver

Triggered when a pointer is being dragged over the drop area.

Provides window coordinates of the pointer position.

OnDrop

Event<void (i32, i32)> OnDrop

Triggered when the user completes a drop while pointer is over the drop area.

Provides window coordinates of the pointer position.

OnEnter

Event<void (i32, i32)> OnEnter

Triggered when a pointer enters the drop area.

Provides window coordinates of the pointer position.

OnLeave

Event<void ()> OnLeave

Triggered when a pointer leaves the drop area.

Internal

Methods

ClearInternal

void ClearInternal()

Clears all internal values.

SetFileListInternal

void SetFileListInternal(const Vector<Path> &fileList)

Sets the file list and marks the drop event as FileList.

SetActiveInternal

void SetActiveInternal(bool active)

Marks the drop area as inactive or active.

IsInsideInternal

bool IsInsideInternal(const Vector2I &pos) const

Checks is the specified position within the current drop area.

Position should be in window local coordinates.

IsActiveInternal

bool IsActiveInternal() const

Returns true if the drop target is active.

GetOwnerWindowInternal

const RenderWindow *GetOwnerWindowInternal() const

Returns a render window this drop target is attached to.

Protected

Constructors

DropTarget

DropTarget(const RenderWindow *ownerWindow, const Area2I &area)

Fields

mArea

Area2I mArea

mActive

bool mActive

mOwnerWindow

const RenderWindow * mOwnerWindow

mDropType

DropTargetType mDropType

mFileList

Vector<Path> mFileList