wDataObject

A wDataObject represents data that can be copied to or from the clipboard, or dragged and dropped. For now, only text, files list, and bitmap are supported.

Seealso:wWindow wDragDropEvent
Effects:
Drag-Drop EffectsDescription
wDragNoneDrop target cannot accept the data.
wDragCopyDrop results in a copy.
wDragMoveDrag source should remove the data.
wDragLinkDrag source should create a link to the original data.

Types

wDataObjectError = object of wError
  
An error raised when wDataObject creation or operation failure.

Consts

wDragNone = 0
wDragCopy = 1
wDragMove = 2
wDragLink = 4
wDragError = 8
wDragCancel = 16

Procs

proc isText(self: wDataObject): bool {...}{.raises: [Exception], tags: [RootEffect].}
Checks the data is text or not.
proc getText(self: wDataObject): string {...}{.raises: [Exception], tags: [RootEffect].}
Gets the data in text format.
proc isFiles(self: wDataObject): bool {...}{.raises: [Exception], tags: [RootEffect].}
Checks the data is files list or not.
proc getFiles(self: wDataObject): seq[string] {...}{.raises: [Exception],
    tags: [RootEffect].}
Gets the files list as seq.
proc isBitmap(self: wDataObject): bool {...}{.raises: [Exception], tags: [RootEffect].}
Checks the data is bitmap or not.
proc getBitmap(self: wDataObject): wBitmap {...}{.raises: [Exception, wBitmapError],
    tags: [RootEffect].}
Gets the data in bitmap format.
proc doDragDrop(self: wDataObject; flags: int = 3 or 4): int {...}{.discardable, raises: [],
    tags: [].}
Starts the drag-and-drop operation which will terminate when the user releases the mouse. The result will be one of drag-drop effect, wDragCancel, or wDragError.
proc delete(self: wDataObject) {...}{.raises: [Exception], tags: [RootEffect].}
Nim's garbage collector will delete this object by default. However, sometimes you maybe want do that by yourself. Moreover, if the data object is still on the clipboard, delete it will force to flush it.
proc final(self: wDataObject) {...}{.raises: [Exception], tags: [RootEffect].}
Default finalizer for wDataObject.
proc init(self: wDataObject; dataObj: ptr IDataObject) {...}{.inline, raises: [], tags: [].}
Initializes a dataObject from IDataObject COM interface. Used internally.
proc DataObject(dataObj: ptr IDataObject): wDataObject {...}{.inline, discardable,
    raises: [Exception], tags: [RootEffect].}
Constructor.
proc init(self: wDataObject; text: string) {...}{.raises: [Exception, wDataObjectError],
                                        tags: [RootEffect].}
Initializes a dataObject from text.
proc DataObject(text: string): wDataObject {...}{.inline, discardable,
    raises: [Exception, wDataObjectError], tags: [RootEffect].}
Constructor.
proc init(self: wDataObject; files: openArray[string]) {...}{.
    raises: [wDataObjectError, Exception], tags: [RootEffect].}
Initializes a dataObject from files. The path must exist.
proc DataObject(files: openArray[string]): wDataObject {...}{.inline, discardable,
    raises: [Exception, wDataObjectError], tags: [RootEffect].}
Constructor.
proc init(self: wDataObject; bmp: wBitmap) {...}{.raises: [NilAccessError, wDataObjectError],
                                        tags: [].}
Initializes a dataObject from bitmap.
proc DataObject(bmp: wBitmap): wDataObject {...}{.inline, discardable,
    raises: [Exception, NilAccessError, wDataObjectError], tags: [RootEffect].}
Constructor.
proc init(self: wDataObject; dataObj: wDataObject) {...}{.
    raises: [NilAccessError, Exception, wDataObjectError, wBitmapError],
    tags: [RootEffect].}
Initializes a dataObject from a wDataObject, aka. copy.
proc DataObject(dataObj: wDataObject): wDataObject {...}{.inline, discardable,
    raises: [Exception, NilAccessError, wDataObjectError, wBitmapError],
    tags: [RootEffect].}
Constructor.

Iterators

iterator getFiles(self: wDataObject): string {...}{.raises: [Exception], tags: [RootEffect].}
Iterate each file in this file list.