ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Palettes/MiscDragViews/MiscViews.subproj/MiscDragView.h

This is MiscDragView.h in view mode; [Download] [Up]

/**************************************************************************
  CLASS:			MiscDragView
  INHERITS FROM:	View
  PROGRAMMERS:		Todd Thomas			(todd@avocado.supernet.ab.ca)
  					Bill Shirley		(Bill_Shirley@pcp.ca)
					Bruce McKenzie 		(spuds@netcom.com)
					Steve Hayman 		(shayman@Objectario.com)
  BEGAN:			February 14, 1994
  LAST CHANGED:		October 24, 1996
  VERSION:			1.4
  CHANGES:			See the end of MiscDragView.m
  		
  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 initDragTypes to register the draggingTypes that your view 	
 			will accept.
 		-override setupForSourceDrag to put the data (representing the 
			dragged icon) 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 (used for a destination drag view)
 	
  The above is the minimum needed, but you'll likely want to override
  other methods to check whether incoming drags are acceptable, etc.
 
  Finally, the delegate (if there is one) will be sent messages like: 
  didInitiateSourceDrag:, didFinishSourceDrag:, didInitiateDestinationDrag:,
  and didFinishDestinationDrag:. (The delegate methods have changed to be
  more like NeXT's will/did methods. The old ones are still sent for 
  backward compatability though). The skeleton of this code came from the 
  NW_DragLab example by Greg Burd and Randy Nelson...thanks for sharing 
  your code. 
 
  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.

 * Copyright (C) 1995 Robert Todd Thomas
 * Use is governed by the MiscKit license
 ***************************************************************************/

#import <appkit/View.h>


@interface MiscDragView : View
{
	id  theImage,theAcceptingImage;			// the image to display the well
	NXSize  imageSize;		// the original size just in case you shrink it
	int  border;			// border type (same as Box)

// why not making a bitfield out of this
	BOOL  allowSourceDragging;
	BOOL  allowDestinationDragging;
	BOOL  freeWhenDragDone;
	BOOL  shadowIncoming;
	BOOL  dragImageIsMyImage;
	
    id  delegate; 				
	id 	target;		// For control-style target/action stuff. ..shayman
	SEL  action;
	id	_sender;
}

//-------------------- Methods to get things set up 
+ initialize;
- initFrame:(const NXRect *)frameRect;
- initDragTypes;
- free;

//--------------------- Image Manipulation Stuff
- setImage: (NXImage *)anImage;
- setAcceptingImage: (NXImage *)anImage;
- setImageByName: (const char *)aName;
- setAcceptingImageByName: (const char *)aName;
- setImageByFilename: (const char *)aFilename;
- (NXImage *)image;
- setDragImage: (NXImage *)anImage;
- setDragImage: (NXImage *)anImage freeWhenDone: (BOOL)freeIt;
-(NXImage *)dragImage;
-(NXImage *)acceptingImage;
-(const char*) imageName;
-(const char*) acceptingImageName;
//-------------------- Dragging Options
- setAllowSourceDragging: (BOOL)aBool;
-(BOOL)allowSourceDragging;
- setAllowDestinationDragging: (BOOL)aBool;
- (BOOL)allowDestinationDragging;

- (BOOL)acceptForeignDrag;
- (BOOL)acceptLocalDrag;
- (BOOL)acceptSelfDrag;
- (BOOL)retainData;
- (BOOL)shadowIncoming;
- setShadowIncoming:(BOOL) aBool;
- (NXColor)shadowColor;

- (BOOL)dragImageIsMyImage;
- setDragImageIsMyImage:(BOOL)aDragImageIsMyImage;

//-------------------- Methods for source dragging 
- mouseDown:(NXEvent *)theEvent;
- cleanupAfterSourceDrag;
- (BOOL)setupForSourceDrag;
- (BOOL)slideback;
- draggingPasteboard;
- calculateDragPoint: (NXPoint *)dragPoint andOffset: (NXPoint *)offset;
- (NXDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag;
- 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;
- cleanupAfterDestinationDrag;
- sender;

//-------------------- Basic useful methods 
- (BOOL)acceptsFirstMouse;
- (BOOL)shouldDelayWindowOrderingForEvent:(NXEvent *)theEvent;

//-------------------- Display
- setBorderType: (int)aType;
- (int)borderType;
- drawSelf: (const NXRect *)rects :(int)rectCount;

//-------------------- Archiving methods
- read: (NXTypedStream *)stream;
- write: (NXTypedStream *)stream;
- awake;

//-------------------- Control-style Target-action stuff  (shayman)
- target;
- setTarget:aTarget;
- (SEL)action;
- setAction:(SEL)anAction;
- (const char *)stringValue;
- setStringValue:(const char *)aValue;
- takeStringValueFrom:sender;

@end


@interface Object (MiscDragViewDelegate)

- didInitiateSourceDrag: sender;
- didFinishSourceDrag: (BOOL)successful;
- didInitiateDestinationDrag: sender;
- didFinishDestinationDrag: (BOOL)successful;
- initDragTypes:sender;
- setupForSourceDrag:sender;
-(NXImage*) image:sender;
-(NXImage*) acceptingImage:sender;
-(NXImage*) image;
-(NXImage*) acceptingImage;
-(BOOL) takeDataFromPasteboard:sender;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.