Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSSavePanel 

Inherits From:	NSPanel : NSWindow : NSResponder : NSObject

Conforms To:	NSCoding (NSResponder)
NSObject (NSObject)

Declared In:	AppKit/NSSavePanel.h

Class Description

NSSavePanel creates a Save panel. The Save panel provides a simple way for a user to specify a file to use when saving a document or other data. It can restrict the user to files of a certain type, as specified by a file name extension. 

When the user decides on a file name, the message panel:isValidFilename: is sent to the NSSavePanel's delegate (if it responds to that message). The delegate can then determine whether that file name can be used; it returns YES if the file name is valid, or NO if the Save panel should stay up and wait for the user to type in a different file name.

Typically, you access an NSSavePanel by invoking the savePanel method. When the class receives a savePanel message, it tries to reuse an existing panel rather than create a new one. When a panel is reused, its attributes are reset to the default values so that the effect is the same as receiving a new panel. Because a Save panel may be reused, you shouldn't modify the instance returned by savePanel, except through the methods listed below. For example, you can set the panel's title and required file type, but not the arrangement of the buttons within the panel. If you must modify the Save panel substantially, create and manage your own instance using the alloc... and init... methods rather than the savePanel method.

Creating an NSSavePanel 

+(NSSavePanel *)savePanel	Returns an NSSavePanel object, creating it if necessary.

Customizing the NSSavePanel 

- (void)setAccessoryView:(NSView *)aView	Adds an application-customized view to the save panel. 

- (NSView *)accessoryView	Returns the application-customized view object. 

- (void)setTitle:(NSString *)title	Sets the title of the NSSavePanel to title. 

- (NSString *)title	Returns the title of the NSSavePanel.

- (void)setPrompt:(NSString *)prompt	Sets the title of the form field for the path to prompt.

- (NSString *)prompt	Returns the title of the form field for the path.

Setting Directory and File Type 

- (NSString *)requiredFileType	Gets the required file type (if any). 

- (void)setDirectory:(NSString *)path	Sets the current directory of the NSSavePanel.

- (void)setRequiredFileType:(NSString *)type	Sets the required file type (if any). An empty string indicates that the user can save to any ASCII file.

- (void)setTreatsFilePackagesAsDirectories:(BOOL)flag
	Sets whether the NSSavePanel object treats file packages as directories by showing their contents in the browser.

- (BOOL)treatsFilePackagesAsDirectories	Returns YES if the NSSavePanel treats file packages as directories, thereby allowing users to browse the contents of file packages.

Running the NSSavePanel 

- (int)runModalForDirectory:(NSString *)path	Displays the NSSavePanel and begins its event loop,
file:(NSString *)filename		showing path in the browser and selecting filename. 

- (int)runModal	Displays the NSSavePanel and begins its event loop. 

Reading Save Information 

- (NSString *)directory	Returns the directory that the chosen file resides in. 

- (NSString *)filename	Returns the absolute path name of the file to be saved.

Target and Action Methods 

- (void)ok:(id)sender	Method invoked by the OK button. 

- (void)cancel:(id)sender	Method invoked by the Cancel button.

Responding to User Input 

- (void)selectText:(id)sender	Invoked when users press Tab, Shift-Tab, or an arrow key.

Setting the Delegate 

- (void)setDelegate:(id)anObject	Makes anObject the NSSavePanel's delegate. 

Methods Implemented by the Delegate 

- (NSComparisonResult)panel:(id)sender	Returns NSOrderedDescending if filename1 precedes
compareFilename:(NSString *)filename1	 	filename2, NSOrderedAscending in the opposite case,
with:(NSString *)filename2	 	NSOrderedSame if the two are equivalent.
caseSensitive:(BOOL)caseSensitive	 

- (BOOL)panel:(id)sender	Returns YES if filename should be displayed in the
shouldShowFilename:(NSString *)filename	 	browser. 

- (BOOL)panel:(id)sender	Returns YES if filename is acceptable to the delegate. 
isValidFilename:(NSString*)filename