Some time ago, Oliver Graf wrote...
|+
| Ah, we're on our own...
| Do you know Xdnd (the protocol used by KDE)? It only uses MIME data in
| drags. If you drag some files, the mime type url/* is used, where * is some
| action verb (i.e. move or copy).
I think I got your point: you are asking about a protocol, right?
The protocol is base on three abstrations, "drop source", "drop
target"
and "data object".
Drop source is a very simple interface, implemented by the sourcing application.
It has two methods. One function is called by the system to set the cursor
shape, given an "effect" parameter. Another one, QueryDrop is called whenever
combination of pressed modifier keys and mouse button changes. It can return
values telling to either continue drag, cancel drag or immediate drop.
"Effect" can be one of:
- none. Drop is not possible.
- copy.
- move.
- link (a link to an object is placed at the drop point).
Drop target is also a simple thing, provided by target application. Drop
targets are registered upon creation, so system may associate a window
over which drag is done, with an instance of drop target interface.
First time, DragEnter method is called, giving data object, keys and buttons
state, point and in-out "effect" parameter. This method usually examines
the data object to see if this thing can be dropped here at all. Upon
further moves, DragOver is called repeatedly. DragLeave names itself.
The Drop method is called after QueryDrop of IDropTarget tells to drop, and
is passed data object and drop point.
"Data object" is an abstraction of data transfer, containment and change
notification, which goes far beyond drag and drop. A data object can be
asked for its data in given "format", to be transferred using
"medium".
It may also be asked whether it is capable of rendering data in given
"format", and to enumerate its format and media choices.
"Format" includes several component, most notable data type (text,
picture, set of file names etc. Applications may register their
own types of data) and "aspect" of data (content, thumbnail, icon,
printed document).
"Medium" can be shared memory handle, disk file, IStream (abstraction
of a stream), IStorage (abstraction of a structured storage), and
some other graphics-related types.
Kirill