/*
**      Newton Developer Technical Support Sample Code
**
**      DragonDrop, a drag and drop example
**
**      by J. Christopher Bell and James Speir, Newton Developer Technical Support
**
**      Copyright © 1994-5 by Apple Computer, Inc.  All rights reserved.
**
**      You may incorporate this sample code into your applications without
**      restriction.  This sample code has been provided "AS IS" and the
**      responsibility for its operation is 100% yours.  You are not
**      permitted to modify and redistribute the source as "DTS Sample Code."
**      If you are going to re-distribute the source, we require that you
**      make it clear in the source that the code was descended from
**      Apple-provided sample code, but that you've made changes.
*/

This example shows how to use the drag and drop API of Newton 2.0.

Note, this sample uses the "Smart container, dumb data" paradigm. In other
words, the container view knows all about how and what to drag and drop.
The container implements all the drag and drop messages for the source
view and initiates the DragAndDrop from its viewClickScript.

The other way to do this would be a "Smart container, smart data". In this
case, the data would know about the drag data it should return and may
even handle all the sourceView messages.

At this time we do recommend using the "smart container, dumb data" way.
We think that this localizes the messages to one area and is much more
readable and maintable. Also there are no standard system messages for
querying the data view for its information.


#1 Misconception about Drag and Drop: "you are actually dragging views." 

Although the primary DragAndDrop method is a view method, the items that you drag
around have a visual representation (visual feedback via the drawDragDataScript)
and a data representation (the dragInfo frame you pass around), but they are not
views. However, when the "drag" is completed (as in this example), views might
be created or destroyed, at the discretion of the sender or receiver application.


Note that when the dragon is dragged to the Notepad, a complete conversion takes place.
In the dragon's DragRef frame we specify that the dragon can be either type 'picture or
type 'text.  The Notepad first looks for type 'text so, when it receives a dragon it 
recognizes it as type text.  The views in the application also support 'text and 'picture.
They have been set up to look for the picture first, so they will accept the dragon as
type picture, instead of type text.

Newton 2.0 currently has a few defined drag system data types. The table below
lists the types as well as the required and optional slots for the
frame returned from the viewGetDragDataScript:

dragType:	required slots		optional slots
'text 		text				viewBounds
								any other clParagraphView slots

'polygon	points	
			viewBounds			any other clPolygonView slots

'ink		ink
			viewBounds			any other clPolygonView slots

'picture	icon
			viewBounds			any other clPictureView slots
			
'meeting	(see Newton Programmers Guide)


If the text dragged to the app's views contain the word "dragon", it will be converted
to an official dragon within the app.


Note: the grey rectangles showing "drag" feedback is not intended to be the official
'look and feel' of the drag and drop system on the Newton. It is implemented this
way for API illustration purposes only.


[future directions?: 
    1) having the icon and/or special slots stay in the notepad version of the dragon
    2) adding caves and knights to the sample...
]



Version History:
	d7 -- Added one more argument to DragAndDrop(), the view method
		  the fourth argument is now pinbounds (can set it to nil)
		  					**Correction**
		  pinBounds is the third argument to DragAndDrop().  The fourth
		  argument is the copy argument.
		  
	d8 -- Modified the sample so that the container views handle the drag and drop
		  messages (instead of the Dragon).  You really don't want the object you 
		  are dragging to have to worry about who can accept it and where it should 
		  draw itself.  The parent views should take care of this for themselves.
		  Also added a view slot to the DragRef frame and the dragInfo frame in 
		  Dragon.ViewClickScript.  This helps the DragAndDrop system know where
		  to start looking for the DragAndDrop messages.
		  
	d9 -- Added a clEditView to the bottom of the sample.  I beleieve that the 
		  clEditView makes it easier to write in text and drag text.  The clEditView 
		  acts just like the Notepad.  Also added a protoRecToggle, so you can switch
		  from normal text to ink text.
 
		
