O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSDocumentController — Mac OS X 10.0

Synopsis

NSDocumentController is one of three classes that make up the document-based application architecture. The other two classes are NSDocument and NSWindowController. This class is responsible for managing an applications documents, in particular providing an implementation for the File Open and File New commands. Additionally, NSDocumentController takes responsibility for ensuring that documents are properly saved and closed before an application terminates.

image with no caption

@interface NSDocumentController : NSObject <NSCoding>
                                  // Initializers
   - (id)init;
                                  // Accessor Methods
   - (void)setShouldCreateUI:(BOOL)flag;
   - (BOOL)shouldCreateUI;
                                  // Class Methods
   + (id)sharedDocumentController;
                                  // Instance Methods
   - (BOOL)closeAllDocuments;
   - (NSArray *)URLsFromRunningOpenPanel;
   - (void)addDocument:(NSDocument *)document;
   - (IBAction)clearRecentDocuments:(id)sender;
   - (void)closeAllDocumentsWithDelegate:(id)delegate 
                                 didCloseAllSelector:(SEL)didAllCloseSelector
                                 contextInfo:(void *)contextInfo;
   - (NSString *)currentDirectory;
   - (id)currentDocument;
   - (NSString *)displayNameForType:(NSString *)documentTypeName;
   - (Class)documentClassForType:(NSString *)documentTypeName;
   - (id)documentForFileName:(NSString *)fileName;
   - (id)documentForWindow:(NSWindow *)window;
   - (NSArray *)documents;
   - (NSArray *)fileExtensionsFromType ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required