Release 1.4  Copyright ©1993, 1994 by Todd Thomas.  All Rights Reserved.





MiscIconWell




Inherits From: MiscDragView : View : Responder : Object
Declared In: misckit/MiscIconWell.h
Protocols: none



Class Description

A general purpose IconWell that allows you to graphically display a filename via its icon representation. The image (and its associated filename) can either be set by dragging a new icon into it, or through setImageByFilename:. It accepts pasteboard data of the NXFilenamePboardType type. See MiscDragView if you are interested in it's inherited target/action or delegate features.



Instance Variables

char *filename;
BOOL allowDoubleClickLaunch;


filename Filename of the current icon representation in the view.
allowDoubleClickLaunch Determines whether an icon can be opened in Workspace via a double click.




Method Types

Initializing a MiscIconWell - initFrame
- initDragTypes
- free
Setting the icon - setImageByFilename:
- filename
Communication with Workspace - launch:
Options - setAllowDoubleClickLaunch:
- allowDoubleClickLaunch
Source dragging methods - mouseDown:
- setupForSourceDrag
Destination dragging methods - performDragOperation:
- concludeDragOperation:
Archiving - read:
- write:



Instance Methods

allowDoubleClickLaunch
- (BOOL)allowDoubleClickLaunch

Returns YES if double clicking on the icon should launch it in Workspace.




concludeDragOperation:

- concludeDragOperation: sender

Overridden to read the filename from the NXDragPboard pasteboard, and display the new icon image. Returns self.




filename

- (char *)filename

Returns the filename associated with the icon displayed within the IconWell. If there is no icon currently in the view, NULL is returned.

See also:  - setImageByFilename




free

- free

Frees the filename if needed.




initDragTypes

- initDragTypes

Initializes the dragging type (NXFilenamePboardType) that MiscIconWell will accept. Returns self.




initFrame:

- initFrame: (BOOL)frameRect

Initializes the view, with allowDoubleClick set to YES. Returns self.

See also:  - awake




launch:

- launch: sender

Launches the files that the receiver represents via the Workspace.

See also:  - allowDoubleClickLaunch,  - setAllowDoubleClickLaunch:




mouseDown:

- mouseDown:(NXEvent *)theEvent

Overidden to check whether the icon was double clicked. If not, then the mouseDown is passed up to MiscDragView's implementation, which will begin a source drag session if all goes well (dragImage set, info on the pasteboard, allowSounceDragging = YES, etc). If it detects a double click then the file(s) are opened via Workspace.app.




performDragOperation:

- (BOOL)performDragOperation: sender

Overridden to check whether there is a filename on the pasteboard. If there is, it returns YES.




read:

- read:(NXTypedStream *)stream

Unarchives a MiscIconWell object. Returns self.

See also:  - write:




setAllowDoubleClickLaunch:

- setAllowDoubleClickLaunch: (BOOL)aBool

Sets whether to allow the user to double click on the icon(s) in the view and have the Workspace open it(them).

See also:  - allowDoubleClickLaunch,  - launch:




setImage:

- setImage:(NXImage *)anImage

Overridden from MiscDragView to make sure that if anImage was nil, that the filename is also freed, since the Well is not representing any file. Additionally, you should not use this method in MiscIconWell, since it needs to know the filename that is associated with the image. Use setImageByFilename: instead. Returns self.

See also:  -filename




setImageByFilename:

- setImageByFilename:(char *)aFilename

Sets the image to the icon representatiion for aFilename. If aFilename happens to be multiple files, then the view sneaks the multiple.tiff  image (the one with the cards on it) from Librarian.app and displays that. If aFilename is only one file, then the workspace is asked for its image representation and it is displayed. Returns self.

See also:  -filename




setupForSourceDrag

- setupForSourceDrag

Overridden from MiscDragView to put the filename onto the pasteboard (NXFilenamePboardType) and set the drag image (as the icon in the receiver's view). Returns YES if there is a filename to drag.




write:

- write:(NXTypedStream *)stream

Archives the receiver. Returns self.

See also:  -read: