CPObjectCPDocumentController
@implementation CPDocumentController : CPObject
This class is responsible for managing an application's open documents.
Method Summary | |
---|---|
+(id) | sharedDocumentController Returns the singleton instance of the application's document controller. |
-(void) | addDocument:(CPDocument)aDocument Adds aDocument under the control of the receiver. |
-(Class) | documentClassForType:(CPString)aType Returns the CPDocument subclass associated with aType . |
-(CPDocument) | documentForURL:(CPURL)aURL Returns the document matching the specified URL. |
-(CPArray) | documents Returns the array of all documents being managed. |
-(CPDocument) | makeDocumentForURL:(CPURL)anAbsoluteURL withContentsOfURL:(CPURL)absoluteContentsURL ofType:(CPString)aType delegate:(id)aDelegate didReadSelector:(SEL)aSelector contextInfo:(id)aContextInfo Creates a document from the contents of a URL, and sets the document's URL location as another URL. |
-(CPDocument) | makeDocumentWithContentsOfURL:(CPURL)anAbsoluteURL ofType:(CPString)aType delegate:(id)aDelegate didReadSelector:(SEL)aSelector contextInfo:(id)aContextInfo Creates a document from the contents at the specified URL. |
-(CPDocument) | makeUntitledDocumentOfType:(CPString)aType error:(CPError)anError Creates a document of the specified type. |
-(CFAction) | newDocument:(id)aSender Opens a new document in the application. |
-(CPDocument) | openDocumentWithContentsOfURL:(CPURL)anAbsoluteURL display:(BOOL)shouldDisplay error:(CPError)anError Opens the document at the specified URL. |
-(void) | openUntitledDocumentOfType:(CPString)aType display:(BOOL)shouldDisplay Creates a new document of the specified type. |
-(void) | removeDocument:(CPDocument)aDocument Removes aDocument from the control of the receiver. |
-(CPDocument) | reopenDocumentForURL:(CPURL)anAbsoluteURL withContentsOfURL:(CPURL)absoluteContentsURL error:(CPError)anError Loads a document for a specified URL with it's content retrieved from another URL. |
Method Detail |
---|
+(id)sharedDocumentController
CPDocumentController
-(void)addDocument:(CPDocument)aDocument
aDocument
under the control of the receiver.aDocument
- the document to add-(Class)documentClassForType:(CPString)aType
CPDocument
subclass associated with aType
.aType
- the type of documentnil
if no match was found
-(CPDocument)documentForURL:(CPURL)aURL
aURL
- the url of the documentnil
if such a document is not open
-(CPArray)documents
-(CPDocument)makeDocumentForURL:(CPURL)anAbsoluteURL withContentsOfURL:(CPURL)absoluteContentsURL ofType:(CPString)aType delegate:(id)aDelegate didReadSelector:(SEL)aSelector contextInfo:(id)aContextInfo
anAbsoluteURL
- the document's locationabsoluteContentsURL
- the location of the document's contentsaType
- the document's data typeaDelegate
- receives a callback after the load has completedaSelector
- the selector to invoke for the callbackaContextInfo
- an object passed as an argument for the callbacknil
if there was an error
-(CPDocument)makeDocumentWithContentsOfURL:(CPURL)anAbsoluteURL ofType:(CPString)aType delegate:(id)aDelegate didReadSelector:(SEL)aSelector contextInfo:(id)aContextInfo
anAbsoluteURL
- the location of the document dataaType
- the document typeaDelegate
- the delegate to notifyaSelector
- the selector to notify withaContextInfo
- the context infomration passed to the delegate-(CPDocument)makeUntitledDocumentOfType:(CPString)aType error:(CPError)anError
aType
- the document typeanError
- not used-(CFAction)newDocument:(id)aSender
aSender
- the requesting object-(CPDocument)openDocumentWithContentsOfURL:(CPURL)anAbsoluteURL display:(BOOL)shouldDisplay error:(CPError)anError
anAbsoluteURL
- the path to the document's fileshouldDisplay
- whether to display the document on screenanError
- not used-(void)openUntitledDocumentOfType:(CPString)aType display:(BOOL)shouldDisplay
aType
- the type of the new documentshouldDisplay
- whether to display the document on screen-(void)removeDocument:(CPDocument)aDocument
aDocument
from the control of the receiver.aDocument
- the document to remove-(CPDocument)reopenDocumentForURL:(CPURL)anAbsoluteURL withContentsOfURL:(CPURL)absoluteContentsURL error:(CPError)anError
anAbsoluteURL
- the document URLabsoluteContentsURL
- the location of the document's contentsanError
- not usednil
if there was an error
Created on Sat Sep 13 14:15:43 PDT 2008