home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************
- * CLASS: MiscDragView
- * PROGRAMMER: Todd Thomas (todd@avocado.cuc.ab.ca)
- * DATE: Feb 14, 1994
- * VERSION: 0.3
- *
- * MiscDragView is an abstract class (cannot be used as is) designed to be
- * easily extensible. Please refer to the docs for a more indepth description.
- *
- * To make any subclass useable for both source and destination dragging:
- *
- * -override initFrame: to register the draggingTypes that your view
- * will accept (and call [super initFrame: ]).
- * -override setupForSourceDrag to put data on the pasteboard of your
- choice, and choose the image you would like to be dragged.
- Don't call the [super setupForSourceDrag].
- * -override performDragOperation: to get the data from the
- * pasteboard
- *
- * The above is the minimum needed, but you'll likely want to override
- * other methods to check whether incoming draggings are acceptable, etc.
- *
- * Finally, the delegate (if there is one) will be sent messages like:
- * sourceDragInitiated:, sourceDragFinished:, destinationDragInitiated:,
- * destinationDragFinished. The skeleton of this code came from the
- * NW_DragLab example by Greg Burd and Randy Nelson...thanks for sharing
- * your code.
- *
- * I combined this class with the MiscImageView class because dragging
- * and images usually go hand in hand. You usually need to display an
- * image representing the data on the pasteboard...
- *
- * This object is included in the MiscKit by permission from the author
- * and its use is governed by the MiscKit license, found in the file
- * "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- * for a list of all applicable permissions and restrictions.
- ***************************************************************************/
-
- #import <appkit/appkit.h>
-
-
- @interface MiscDragView : View
- {
- id theImage;
- NXSize imageSize;
- int border;
-
- id delegate;
- id dragImage;
- BOOL allowSourceDragging, allowDestinationDragging;
- BOOL acceptForeignDrag, acceptLocalDrag;
- BOOL acceptSelfDrag, retainData;
- }
-
- //-------------------- Methods to get things set up
- - initFrame:(const NXRect *)frameRect;
- - awake;
- - free;
-
- //--------------------- Image Manipulation Stuff
- - setImage: (NXImage *)anImage;
- - setImageByFilename: (char *)aFilename;
- - (NXImage *)image;
-
- //-------------------- Dragging Options
- - setAllowSourceDragging: (BOOL)aBool;
- - (BOOL)allowSourceDragging;
- - setAllowDestinationDragging: (BOOL)aBool;
- - (BOOL)allowDestinationDragging;
- - setAcceptForeignDrag: (BOOL)aBool;
- - (BOOL)acceptForeignDrag;
- - setAcceptLocalDrag: (BOOL)aBool;
- - (BOOL)acceptLocalDrag;
- - setAcceptSelfDrag: (BOOL)aBool;
- - (BOOL)acceptSelfDrag;
- - setRetainData: (BOOL)aBool;
- - (BOOL)retainData;
-
- //-------------------- Methods for source dragging
- - mouseDown:(NXEvent *)theEvent;
- - (BOOL)setupForSourceDrag;
- - calculateDragPoint: (NXPoint *)dragPoint andOffset: (NXPoint *)offset;
- - (NXDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag;
- - draggedImage:(NXImage *)image beganAt:(NXPoint *)screenPoint;
- - draggedImage:(NXImage *)image endedAt:(NXPoint *)screenPoint
- deposited:(BOOL)flag;
-
- //-------------------- Methods for destination dragging */
- - (NXDragOperation)draggingEntered:sender;
- - (NXDragOperation)draggingUpdated:sender;
- - draggingExited:sender;
- - (BOOL)prepareForDragOperation:sender;
- - (BOOL)performDragOperation:sender;
- - concludeDragOperation:sender;
-
- //-------------------- Basic useful methods
- - (BOOL)acceptsFirstMouse;
- - (BOOL)shouldDelayWindowOrderingForEvent:(NXEvent *)theEvent;
-
- //-------------------- Delegate methods
- - delegate;
- - setDelegate: theDelegate;
- - sourceDragInitiated: view;
- - sourceDragFinished: (BOOL)success;
- - destinationDragInitiated: view;
- - destinationDragFinished: (BOOL)success;
-
- //-------------------- Display
- - setBorderType: (int)aType;
- - (int)borderType;
- - drawSelf: (const NXRect *)rects :(int)rectCount;
-
- //-------------------- Archiving methods
- - read: (NXTypedStream *)stream;
- - write: (NXTypedStream *)stream;
-
- - (const char *)getInspectorClassName;
-
- @end
-