                            Drag and Drop for Tk
			        version 0.3
			Oliver Graf <ograf@fga.de>
          			original by
                   Alfredo K. Kojima <kojima@inf.ufrgs.br>

	This is a implementation of the DND drag and drop 
protocol (aka OffiX Drag and Drop) from Cesar Crusius <c.crusius@ieee.org>
for the Tk toolkit. It should work with Tk version 4.2p2

	This implementation has some limitations. They are:

	- for now, there is no way to bind scripts for drops in the 
	root window and on icons (root win is NOT . but your desktop)

	But it has also some advantages over DND for Xt, like:

	- you can optionally select the pointer cursor to anything you
	want during the drag
	- Tcl/Tk is much easier to program than Xt, and so is the Tcl interface
	to the protocol
	
                                --*--

DROP HANDLING:

To bind some script to a drop event in a widget just use the normal 
`` bind'' mechanism, setting the event as <Drop>, like in:

	bind . <Drop> {puts "Got a Drop!"}
	
New % replacements were defined to allow information about the drop to be
retrieved.

	%D - the data retrieved from the drop. If the data type is
	DndFiles, \0 characters will be converted to \n.
	For the RawData type anything below 32 and the backslash
        will be backslashed.

	%P - gives the type of the data droppped. It can have the 
	following values:
		Unknown (treated as RawData)
		RawData (0-31 == \[0-O] (this is 48+x), \=\\)
 		File         
 		Files (returns values seperated by \n)
 		Text         
 		Dir
 		Link         
		Exe
		URL
		MIME
		or a number (treated as RawData)

	%Z - the size of the original data (ignoring any convertions made
	by tcl/tk)

				--*--

DRAG HANDLING:

To bind a script to a drag event use the built-in bind command with the 
<Drag> event type:

	bind window <Drag> script

To set the data to be dragged use the dnd_setdata command. It's sintax is:

	dnd_setdata datatype data ?size?

where
	datatype - is the type of the data to send, which can be one of
		RawData (0-31 == \[0-O] (this is 48+x), \=\\)
 		File         
 		Files (use \n for seperating entries)
 		Text         
 		Dir
 		Link         
		Exe
		URL
		MIME
	        or a number (treated as RawData if not within standart
                             range of types RawData==1, MIME==9)
	data     - is the string to send
	size     - is the size of the string to be sent. If size if
		not supplied, the whole string will be sent

After setting the data type and doing other processing, you must call
dnd_handledrag (inside the event handler) to proceed the dragging.
You can specify an optional cursor to be used during the drag as in:
	dnd_handledrag top_left_arrow
If no cursor is specified it defaults to the DND standart cursor for
the data type set. An unknown data type results in the RawData cursor.
	
The cursor identifier must be a standard Tk cursor nameId (see manpage
for Tk_GetCursor)

Example:
	bind .label <Drag> {dnd_setdata Text "Hello, I'm TkDND!!!!"
				dnd_handledrag trek }
				
See the OffiX/DragAndDrop documentation for more information about 
the protocol.
				--*--

Send bug reports, comments, patches etc. to ograf@fga.de
