API  1.0.0
CPDocument Class Reference

#import <CPDocument.h>

+ Inheritance diagram for CPDocument:

Instance Methods

(void) - addViewController:forWindowController:
 
(void) - addWindowController:
 
(void) - alertDidEnd:returnCode:
 
(void) - canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
 
(void) - close
 
(void) - connection:didFailWithError:
 
(void) - connection:didReceiveData:
 
(void) - connection:didReceiveResponse:
 
(void) - connectionDidFinishLoading:
 
(CPData- dataOfType:error:
 
(CPString- displayName
 
(CPString- fileType
 
(CPURL- fileURL
 
(BOOL) - hasUndoManager
 
(id) - init
 
(id) - initForURL:withContentsOfURL:ofType:delegate:didReadSelector:contextInfo:
 
(id) - initWithContentsOfURL:ofType:delegate:didReadSelector:contextInfo:
 
(id) - initWithType:error:
 
(BOOL) - isDocumentEdited
 
(void) - makeViewAndWindowControllers
 
(void) - makeWindowControllers
 
(void) - readFromData:ofType:error:
 
(void) - readFromURL:ofType:delegate:didReadSelector:contextInfo:
 
(void) - removeViewController:
 
(void) - removeWindowController:
 
(void) - saveDocument:
 
(void) - saveDocumentAs:
 
(void) - saveDocumentWithDelegate:didSaveSelector:contextInfo:
 
(void) - saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:
 
(void) - setFileType:
 
(void) - setFileURL:
 
(void) - setHasUndoManager:
 
(void) - setUndoManager:
 
(void) - shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:
 
(void) - showWindows
 
(CPUndoManager- undoManager
 
(void) - updateChangeCount:
 
(CPView- view
 
(CPString- viewCibName
 
(void) - viewControllerDidLoadCib:
 
(CPViewController- viewControllerForWindowController:
 
(CPArray) - viewControllers
 
(void) - viewControllerWillLoadCib:
 
(CPString- windowCibName
 
(void) - windowControllerDidLoadCib:
 
(CPArray) - windowControllers
 
(void) - windowControllerWillLoadCib:
 
(CPUndoManager- windowWillReturnUndoManager:
 
- Instance Methods inherited from CPResponder
(BOOL) - acceptsFirstResponder
 
(BOOL) - becomeFirstResponder
 
(void) - cursorUpdate:
 
(void) - doCommandBySelector:
 
(void) - encodeWithCoder:
 
(void) - flagsChanged:
 
(id) - initWithCoder:
 
(void) - insertBackTab:
 
(void) - insertLineBreak:
 
(void) - insertNewline:
 
(void) - insertTab:
 
(void) - insertText:
 
(void) - interpretKeyEvents:
 
(void) - keyDown:
 
(void) - keyUp:
 
(CPMenu- menu
 
(void) - mouseDown:
 
(void) - mouseDragged:
 
(void) - mouseEntered:
 
(void) - mouseExited:
 
(void) - mouseMoved:
 
(void) - mouseUp:
 
(CPResponder- nextResponder
 
(void) - noResponderFor:
 
(BOOL) - performKeyEquivalent:
 
(BOOL) - resignFirstResponder
 
(void) - rightMouseDown:
 
(void) - rightMouseUp:
 
(void) - scrollWheel:
 
(void) - setMenu:
 
(void) - setNextResponder:
 
(BOOL) - tryToPerform:with:
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPString- description
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray) - exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(void) - performSelector:withObject:afterDelay:
 
(void) - performSelector:withObject:afterDelay:inModes:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Additional Inherited Members

- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(void) + cancelPreviousPerformRequestsWithTarget:
 
(void) + cancelPreviousPerformRequestsWithTarget:selector:object:
 
(Class) + class
 
(BOOL) + conformsToProtocol:
 
(void) + exposeBinding:
 
(void) + initialize
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesImplementSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isBindingExclusive:
 
(BOOL) + isSubclassOfClass:
 
(CPSet) + keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + object:performSelector:withObject:afterDelay:inModes:
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Detailed Description

CPDocument is used to represent a document/file in a Cappuccino application. In a document-based application, generally multiple documents are open simultaneously (multiple text documents, slide presentations, spreadsheets, etc.), and multiple CPDocuments should be used to represent this.

Definition at line 2 of file CPDocument.h.

Method Documentation

◆ addViewController:forWindowController:()

- (void) addViewController: (CPViewController aViewController
forWindowController: (CPWindowController aWindowController 
implementation

Definition at line 330 of file CPDocument.j.

◆ addWindowController:()

- (void) addWindowController: (CPWindowController aWindowController
implementation

Add a controller to the document's list of controllers. This should be called after making a new window controller.

Parameters
aWindowControllerthe controller to add

Definition at line 298 of file CPDocument.j.

◆ alertDidEnd:returnCode:()

- (void) alertDidEnd: (CPAlert alert
returnCode: (int)  returnCode 
implementation

Provided by category CPDocument(ClosingDocuments).

Definition at line 893 of file CPDocument.j.

◆ canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:()

- (void) canCloseDocumentWithDelegate: (id)  aDelegate
shouldCloseSelector: (SEL)  aSelector
contextInfo: (Object)  context 
implementation

Provided by category CPDocument(ClosingDocuments).

Definition at line 872 of file CPDocument.j.

◆ close()

- (void) close
implementation

Provided by category CPDocument(ClosingDocuments).

Definition at line 846 of file CPDocument.j.

◆ connection:didFailWithError:()

- (void) connection: (CPURLConnection aConnection
didFailWithError: (CPError anError 
implementation

Definition at line 577 of file CPDocument.j.

◆ connection:didReceiveData:()

- (void) connection: (CPURLConnection aConnection
didReceiveData: (CPString aData 
implementation

Definition at line 549 of file CPDocument.j.

◆ connection:didReceiveResponse:()

- (void) connection: (CPURLConnection aConnection
didReceiveResponse: (CPURLResponse aResponse 
implementation

Definition at line 489 of file CPDocument.j.

◆ connectionDidFinishLoading:()

- (void) connectionDidFinishLoading: (CPURLConnection aConnection
implementation

Definition at line 606 of file CPDocument.j.

◆ dataOfType:error:()

- (CPData) dataOfType: (CPString aType
error: (/*{*/CPError/*}*/)  anError 
implementation

Returns the receiver's data in a specified type. The default implementation just throws an exception.

Parameters
aTypethe format of the data
anErrornot used
Exceptions
CPUnsupportedMethodExceptionif this method hasn't been overridden by the subclass
Returns
the document data

Definition at line 209 of file CPDocument.j.

◆ displayName()

- (CPString) displayName
implementation

Returns the name of the document as displayed in the title bar.

Definition at line 362 of file CPDocument.j.

◆ fileType()

- (CPString) fileType
implementation

Returns the document's file type

Definition at line 653 of file CPDocument.j.

◆ fileURL()

- (CPURL) fileURL
implementation

Returns the path to the document's file.

Definition at line 427 of file CPDocument.j.

◆ hasUndoManager()

- (BOOL) hasUndoManager
implementation

Returns YES if the document has a CPUndoManager.

Definition at line 663 of file CPDocument.j.

◆ init()

- (id) init
implementation

Initializes an empty document.

Returns
the initialized document

Reimplemented from CPObject.

Definition at line 116 of file CPDocument.j.

◆ initForURL:withContentsOfURL:ofType:delegate:didReadSelector:contextInfo:()

- (id) initForURL: (CPURL anAbsoluteURL
withContentsOfURL: (CPURL absoluteContentsURL
ofType: (CPString aType
delegate: (id)  aDelegate
didReadSelector: (SEL)  aDidReadSelector
contextInfo: (id)  aContextInfo 
implementation

Initializes the document from a URL.

Parameters
anAbsoluteURLthe document location
absoluteContentsURLthe location of the document's contents
aTypethe type of the contents
aDelegatethis object will receive a callback after the document's contents are loaded
aDidReadSelectorthe message selector that will be sent to aDelegate
aContextInfopassed as the argument to the message sent to the aDelegate
Returns
the initialized document

Definition at line 186 of file CPDocument.j.

◆ initWithContentsOfURL:ofType:delegate:didReadSelector:contextInfo:()

- (id) initWithContentsOfURL: (CPURL anAbsoluteURL
ofType: (CPString aType
delegate: (id)  aDelegate
didReadSelector: (SEL)  aDidReadSelector
contextInfo: (id)  aContextInfo 
implementation

Initializes a document of a specific type located at a URL. Notifies the provided delegate after initialization.

Parameters
anAbsoluteURLthe url of the document content
aTypethe type of document located at the URL
aDelegatethe delegate to notify
aDidReadSelectorthe selector used to notify the delegate
aContextInfocontext information passed to the delegate after initialization
Returns
the initialized document

Definition at line 161 of file CPDocument.j.

◆ initWithType:error:()

- (id) initWithType: (CPString aType
error: (/*{*/CPError/*}*/)  anError 
implementation

Initializes the document with a specific data type.

Parameters
aTypethe type of document to initialize
anErrornot used
Returns
the initialized document

Definition at line 140 of file CPDocument.j.

◆ isDocumentEdited()

- (BOOL) isDocumentEdited
implementation

Returns YES if there are any unsaved changes.

Definition at line 616 of file CPDocument.j.

◆ makeViewAndWindowControllers()

- (void) makeViewAndWindowControllers
implementation

Definition at line 247 of file CPDocument.j.

◆ makeWindowControllers()

- (void) makeWindowControllers
implementation

Creates the window controller for this document.

Definition at line 242 of file CPDocument.j.

◆ readFromData:ofType:error:()

- (void) readFromData: (CPData aData
ofType: (CPString aType
error: (CPError anError 
implementation

Sets the content of the document by reading the provided data. The default implementation just throws an exception.

Parameters
aDatathe document's data
aTypethe document type
anErrornot used
Exceptions
CPUnsupportedMethodExceptionif this method hasn't been overridden by the subclass

Definition at line 224 of file CPDocument.j.

◆ readFromURL:ofType:delegate:didReadSelector:contextInfo:()

- (void) readFromURL: (CPURL anAbsoluteURL
ofType: (CPString aType
delegate: (id)  aDelegate
didReadSelector: (SEL)  aDidReadSelector
contextInfo: (id)  aContextInfo 
implementation

Set the document's data from a URL. Notifies the provided delegate afterwards.

Parameters
anAbsoluteURLthe URL to the document's content
aTypethe document type
aDelegatedelegate to notify after reading the data
aDidReadSelectormessage that will be sent to the delegate
aContextInfocontext information that gets sent to the delegate

Definition at line 414 of file CPDocument.j.

◆ removeViewController:()

- (void) removeViewController: (CPViewController aViewController
implementation

Definition at line 339 of file CPDocument.j.

◆ removeWindowController:()

- (void) removeWindowController: (CPWindowController aWindowController
implementation

Remove a controller to the document's list of controllers. This should be called after closing the controller's window.

Parameters
aWindowControllerthe controller to remove

Definition at line 311 of file CPDocument.j.

◆ saveDocument:()

- (void) saveDocument: (id)  aSender
implementation

Saves the document. If the document does not have a file path to save to (fileURL) then -saveDocumentAs: will be called.

Parameters
aSenderthe object requesting the save

Definition at line 782 of file CPDocument.j.

◆ saveDocumentAs:()

- (void) saveDocumentAs: (id)  aSender
implementation

Saves the document to a user specified path.

Parameters
aSenderthe object requesting the operation

Definition at line 805 of file CPDocument.j.

◆ saveDocumentWithDelegate:didSaveSelector:contextInfo:()

- (void) saveDocumentWithDelegate: (id)  delegate
didSaveSelector: (SEL)  didSaveSelector
contextInfo: (Object)  contextInfo 
implementation

Definition at line 787 of file CPDocument.j.

◆ saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:()

- (void) saveToURL: (CPURL anAbsoluteURL
ofType: (CPString aTypeName
forSaveOperation: (CPSaveOperationType)  aSaveOperation
delegate: (id)  aDelegate
didSaveSelector: (SEL)  aDidSaveSelector
contextInfo: (id)  aContextInfo 
implementation

Saves the document to the specified URL. Notifies the provided delegate with the provided selector and context info afterwards.

Parameters
anAbsoluteURLthe url to write the document data to
aTypeNamethe document type
aSaveOperationthe type of save operation
aDelegatethe delegate to notify after saving
aDidSaveSelectorthe selector to send the delegate
aContextInfocontext info that gets passed to the delegate

Definition at line 456 of file CPDocument.j.

◆ setFileType:()

- (void) setFileType: (CPString aType
implementation

Sets the document's file type

Parameters
aTypethe document's type

Definition at line 645 of file CPDocument.j.

◆ setFileURL:()

- (void) setFileURL: (CPURL aFileURL
implementation

Sets the path to the document's file.

Parameters
aFileURLthe path to the document's file

Definition at line 436 of file CPDocument.j.

◆ setHasUndoManager:()

- (void) setHasUndoManager: (BOOL)  aFlag
implementation

Sets whether the document should have a CPUndoManager.

Parameters
aFlagYES makes the document have an undo manager

Definition at line 672 of file CPDocument.j.

◆ setUndoManager:()

- (void) setUndoManager: (CPUndoManager anUndoManager
implementation

Definition at line 711 of file CPDocument.j.

◆ shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:()

- (void) shouldCloseWindowController: (CPWindowController controller
delegate: (id)  delegate
shouldCloseSelector: (SEL)  selector
contextInfo: (Object)  info 
implementation

Provided by category CPDocument(ClosingDocuments).

Definition at line 852 of file CPDocument.j.

◆ showWindows()

- (void) showWindows
implementation

Shows all the document's windows.

Definition at line 353 of file CPDocument.j.

◆ undoManager()

- (CPUndoManager) undoManager
implementation

Returns the document's undo manager. If the document should have one, but the manager is nil, it will be created and then returned.

Returns
the document's undo manager

Reimplemented from CPResponder.

Definition at line 758 of file CPDocument.j.

◆ updateChangeCount:()

- (void) updateChangeCount: (CPDocumentChangeType)  aChangeType
implementation

Updates the number of unsaved changes to the document.

Parameters
aChangeTypea new document change to apply

Definition at line 625 of file CPDocument.j.

◆ view()

- (CPView) view
implementation

Definition at line 320 of file CPDocument.j.

◆ viewCibName()

- (CPString) viewCibName
implementation

Definition at line 376 of file CPDocument.j.

◆ viewControllerDidLoadCib:()

- (void) viewControllerDidLoadCib: (CPViewController aViewController
implementation

Definition at line 234 of file CPDocument.j.

◆ viewControllerForWindowController:()

- (CPViewController) viewControllerForWindowController: (CPWindowController aWindowController
implementation

Definition at line 344 of file CPDocument.j.

◆ viewControllers()

- (CPArray) viewControllers
implementation

Definition at line 325 of file CPDocument.j.

◆ viewControllerWillLoadCib:()

- (void) viewControllerWillLoadCib: (CPViewController aViewController
implementation

Definition at line 230 of file CPDocument.j.

◆ windowCibName()

- (CPString) windowCibName
implementation

Returns the document's Cib name

Definition at line 384 of file CPDocument.j.

◆ windowControllerDidLoadCib:()

- (void) windowControllerDidLoadCib: (CPWindowController aWindowController
implementation

Called after aWindowController loads the document's Nib file.

Parameters
aWindowControllerthe controller that loaded the Nib file

Definition at line 393 of file CPDocument.j.

◆ windowControllers()

- (CPArray) windowControllers
implementation

Returns the document's window controllers

Definition at line 288 of file CPDocument.j.

◆ windowControllerWillLoadCib:()

- (void) windowControllerWillLoadCib: (CPWindowController aWindowController
implementation

Called before aWindowController will load the document's Nib file.

Parameters
aWindowControllerthe controller that will load the Nib file

Definition at line 401 of file CPDocument.j.

◆ windowWillReturnUndoManager:()

- (CPUndoManager) windowWillReturnUndoManager: (CPWindow aWindow
implementation

Definition at line 770 of file CPDocument.j.


The documentation for this class was generated from the following files: