This is MODocumentWell.rtf in view mode; [Download] [Up]
Version 1.0 Copyright ©1992, 1993, 1994 by Mike Ferris. All Rights Reserved. Mike Ferris - October 9th, 1993 MODocumentWell Inherits From: View : Responder : Object Declared In: MOKit/MODocumentWell.h Class Description MODocumentWell is a subclass of View which implements a document well. The well has a current path and a current icon. It displays as an inset box with the icon drawn in the center. If the path is set and an icon is provided, the path does not have to be valid, the icon is just displayed. If the path is set without an icon being provided, the well asks the workspace to provide the icon for the file and displays that. The well normally has a bezeled border, but it can be made to be borderless and transparent (except for the icon). The well can also do any combination of the following three things: accept files dragged from elsewhere, allow its file to be dragged elsewhere, and allow its file to be opened by double-clicking the icon. These features can be turned on and off independantly. The whole well can be disabled without upsetting these options as well. Instance Variables id pathString; id icon; id delegate; BOOL enabled; BOOL isDragDestination; BOOL isDragSource; BOOL opensFiles; BOOL bordered; id ghostHighlight; BOOL isReceiving; char *dragPath; id dragImage; id ghostImage; BOOL isDragging; pathString A MOString object which holds the current path of the well. icon An NXImage object which holds the current icon of the well. delegate The object which will be notified of goings on in the well. enabled Whether or not the well is enabled. isDragDestination Whether the well accepts dragged files when enabled. isDragSource Whether the well can drag its file out when enabled. opensFile Whether double-clicking the well will cause its document to be opened via Workspace. bordered Whether the well is bordered or not. ghostHighlight An NXImage object used by the well to do ghost highlighting during drag operations. isReceiving An internally used state variable which is set to YES while the well is in the process of accepting a dragged file. dragPath An internally used state variable used to hold the path of a file currently in the process of being dragged into the well. dragImage An internally used NXImage object which holds the icon of the file in the process of being dragged into the well. ghostImage An internally used NXImage object which holds the icon to use as a ghost image during dragging. This image is created by compositing the ghostHighlight onto the dragImage. isDragging An internally used state variable which is set to YES while the well is in the process of dragging its file out. Method Types Initializing the class +initialize Creating and freeing instances - initFrame: - copyFromZone: - free Dealing with the well attributes - setPath:andIcon: - path - icon - setDelegate: - delegate - setEnabled: - enabled - setIsDragDestination: - isDragDestination - setIsDragSource: - isDragSource - setDoesOpenFiles: - doesOpenFiles - setBordered: - bordered The meaty methods - drawSelf:: - mosueDown: - openDocument: Dragging destination methods - draggingEntered: - draggingExited: - prepareForDragOperation: - performDragOperation: - concludeDragOperation: Dragging source methods - draggingSourceOperationMaskForLocal: Internally useful methods - getFilenameFromPborad: - getOrigin:forImage: Archiving - read: - write: - awake Class Methods initialize + initialize Initializes the class instance doing things like setting the version number. Instance Methods awake - awake Initializes all the temporary stuff that doesn't get restored by a read. See also: ±€write:, ±€read: concludeDragOperation: -concludeDragOperation:(id <NXDraggingInfo>)sender Part of the informal drag destination protocol. See also: ±€draggingEntered:, ±€draggingExited:, ±€prepareForDragOperation:, ±€performDragOperation: copyFromZone: - copyFromZone:(NXZone *)zone Makes a copy of the DocumentWell. This method makes sure to copy all the subobjects that it needs to. See also: ±€initFrame:, ±€free delegate - delegate Returns the delegate of the well. See below for messages that the delegate can respond to. See also: ±€setDelegate: doesOpenFiles -(BOOL)doesOpenFiles Returns whether the well is allowed to open files by double-clicking. See also: ±€setEnabled:, ±€isEnabled, ±€setIsDragDestination:, ±€isDragDestination, ±€setIsDragSource:, ±€isDragSource, ±€setDoesOpenFiles: draggingEntered: -(NXDragOperation)draggingEntered:(id <NXDraggingInfo>)sender Part of the informal drag destination protocol. See also: ±€draggingExited:, ±€prepareForDragOperation:, ±€performDragOperation:, ±€concludeDragOperation: draggingExited: -draggingExited:(id <NXDraggingInfo>)sender Part of the informal drag destination protocol. See also: ±€draggingEntered:, ±€prepareForDragOperation:, ±€performDragOperation:, ±€concludeDragOperation: draggingSourceOperationMaskForLocal: - (NXDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal Part of the informal drag source protocol. drawSelf:: - drawSelf:(const NXRect *)rects :(int)rectCount Draws the well's border (if it has one) and icon (if it has one). free - free Frees the object and all its subobjects that need freeing. See also: ±€copyFromZone:, ±€initFrame: getFilenameFromPboard: - getFilenameFromPboard:pb Reads the filename from the pasteboard and puts it in the dragPath instance variable. getOrigin:forImage: - getOrigin:(NXPoint *)toPoint forImage:(NXImage *)image Finds the proper origin for the given image so it will end up centered in our frame. icon - icon Returns the well's current icon. See also: ±€setPath:andIcon:, ±€path initFrame: - initFrame:(const NXRect *)frm Initializes the well as enabled, accepting drags, allowing outgoing drags, allowing opening of files, bordered, and empty. See also: ±€copyFromZone:, ±€free isBordered - (BOOL)isBordered Returns whether the well is bordered. See also: ±€setBordered: isDragDestination -(BOOL)isDragDestination Returns whether the well is allowed to be a destination for dragged files. See also: ±€setEnabled:, ±€isEnabled, ±€setIsDragDestination:, ±€setIsDragSource:, ±€isDragSource, ±€setDoesOpenFiles:, ±€doesOpenFiles isDragSource -(BOOL)isDragSource Returns whether the well is allowed to be a source for dragged files. See also: ±€setEnabled:, ±€isEnabled, ±€setIsDragDestination:, ±€isDragDestination, ±€setIsDragSource:, ±€setDoesOpenFiles:, ±€doesOpenFiles isEnabled -(BOOL)isEnabled Returns whether the well is enabled. See also: ±€setEnabled:, ±€setIsDragDestination:, ±€isDragDestination, ±€setIsDragSource:, ±€isDragSource, ±€setDoesOpenFiles:, ±€doesOpenFiles mouseDown: - mouseDown:(NXEvent *)theEvent Handles, dragging out files, and opening files, if those options are turned on. openDocument: - openDocument:sender If the well has a document in it, and is configured to allow opening of its document, this will cause Worspace Manager to open the file. path - (const char *)path Returns the well's current path. See also: ±€setPath:andIcon:, ±€icon performDragOperation: - (BOOL)performDragOperation:(id <NXDraggingInfo>)sender Part of the informal drag destination protocol. See also: ±€draggingEntered:, ±€draggingExited:, ±€prepareForDragOperation:, ±€concludeDragOperation: prepareForDragOperation: - (BOOL)prepareForDragOperation:(id <NXDraggingInfo>)sender Part of the informal drag destination protocol. See also: ±€draggingEntered:, ±€draggingExited:, ±€performDragOperation:, ±€concludeDragOperation: read: - read:(NXTypedStream *)strm Reads the object from the typed stream. See also: ±€write:, ±€awake setBordered: - setBordered:(BOOL)flag Sets whether the well is bordered. See also: ±€isBordered setDelegate: - setDelegate:anObject Sets the delegate of the well. See below for messages that the delegate can respond to. See also: ±€delegate setDoesOpenFiles: - setDoesOpenFiles:(BOOL)flag Enables or disables the opening of files by double-clicking the well. See also: ±€setEnabled:, ±€isEnabled, ±€setIsDragDestination:, ±€isDragDestination, ±€setIsDragSource:, ±€isDragSource, ±€doesOpenFiles setEnabled: - setEnabled:(BOOL)flag Enables or disables the whole well. See also: ±€isEnabled, ±€setIsDragDestination:, ±€isDragDestination, ±€setIsDragSource:, ±€isDragSource, ±€setDoesOpenFiles:, ±€doesOpenFiles setIsDragDestination: - setIsDragDestination:(BOOL)flag Enables or disables the well as a destination for file drags. See also: ±€setEnabled:, ±€isEnabled, ±€isDragDestination, ±€setIsDragSource:, ±€isDragSource, ±€setDoesOpenFiles:, ±€doesOpenFiles setIsDragSource: - setIsDragSource:(BOOL)flag Enables or disables the well as a source for file drags. See also: ±€setEnabled:, ±€isEnabled, ±€setIsDragDestination:, ±€isDragDestination, ±€isDragSource, ±€setDoesOpenFiles:, ±€doesOpenFiles setPath:andIcon: - (BOOL)setPath:(const char *)path andIcon:(NXImage *)theIcon Sets the path and icon of the well. If no icon is provided (ie theIcon is nil), then the well will ask Worksapce Manager for the icon for the given path. Returns YES unless there's a problem. See also: ±€path, ±€icon write: - write:(NXTypedStream *)strm Writes the object to the typed stream. See also: ±€read:, ±€awake Methods Implemented by the Delegate docWellDidOpenDocument: ±€(BOOL)docWellDidOpenDocument:(MODocumentWell *)sender This message is sent to the delegate if it responds after the well has opened a document. This message is sent to the delegate on indirectly through perform:with:afterDelay:cancelPrevious:. This is done so that these method can perform more complicated actions and not be within the context of a mouseDown: or (even worse) a concludeDragOperation: call. docWellDidAcceptDocument: ±€docWellDidAcceptDocument:(MODocumentWell *)sender This message is sent to the delegate if it responds after a new file has been deposited into the well. This message is sent to the delegate on indirectly through perform:with:afterDelay:cancelPrevious:. This is done so that these method can perform more complicated actions and not be within the context of a mouseDown: or (even worse) a concludeDragOperation: call. docWell:isValidDocument: ±€(BOOL)docWell:(MODocumentWell *)sender isValidDocument:(const char *)path This message is sent to the delegate if it responds when a new file enters the well during a drag. If this method returns YES, the drag will be allowed. If it returns NO, the drag is not allowed. docWell:willAcceptDocument: ±€(BOOL)docWell:(MODocumentWell *)sender willAcceptDocument:(const char *)path This message is sent to the delegate if it responds when a new file has been dropped onto the well. If this method returns YES, the deposit will be allowed. If it returns NO, the deposit is not allowed. docWellWillOpenDocument: ±€(BOOL)docWellWillOpenDocument:(MODocumentWell *)sender This message is sent to the delegate if it responds when the well is about to open a document. If this method returns YES, the open will be allowed. If it returns NO, the open is not allowed.
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.