
Public Member Functions | |
| (id) | - initWithPasteboard:arguments: |
| The designated initializer. | |
| (BOOL) | - writeToPasteboard: |
| Writes the receiver's represented data to the specified pasteboard. | |
| (id) | - initWithCoder: |
| Decodes and initializes the receiver. | |
| (void) | - encodeWithCoder: |
| Encodes the receiver to the specified coder. | |
| (void) | - dealloc |
| Deallocates the receiver. | |
| (NSData *) | - dataForRepresentedPasteboardType: |
| The data for the given pasteboard type as stored by the receiver. | |
| (void) | - viewDidBecomeAvailable |
| Sent to the receiver when its view becomes available. | |
| (void) | - viewWillBecomeUnavailable |
| Sent to the receiver when its view becomes unavailable. | |
| (IBAction) | - makeViewUnavailable: |
| Removes the receiver's view from Corkboard and potentially makes the receiver eligible for deallocation. | |
| (IBAction) | - redrawView: |
| Tells the view associated with the receiver to redraw. | |
| (NSRect) | - convertRectToHistoryItemView: |
| Transforms a rectangle from the receiver's view's coordinate space to a history item's view's coordinate space. | |
| (void) | - drawContentsInRect: |
| Sent to the receiver when its content needs to be drawn. | |
Static Public Member Functions | |
| (BOOL) | + canInitWithPasteboard:arguments: |
| Whether or not an attempt to instantiate the receiver with the given arguments would succeed. | |
| (NSArray *) | + supportedPasteboardTypes |
| The pasteboard types that the receiver can interpret. | |
| (NSInteger) | + priority |
| The priority, relative to other interpreters, of this class. | |
| (NSString *) | + localizedDisplayName |
| The display name, in the current locale, of the receiver. | |
| (NSImage *) | + icon |
| An icon representing the receiver. | |
Properties | |
| NSView * | view |
| The view associated with the receiver. | |
| NSArray * | supportedPasteboardTypes |
| Simply calls the class method + supportedPasteboardTypes. | |
| NSInteger | priority |
| Simply calls the class method + priority. | |
| NSString * | localizedDisplayName |
| Simply calls the class method + localizedDisplayName. | |
| NSImage * | icon |
| Simply calls the class method + icon. | |
| NSArray * | representedPasteboardTypes |
| The pasteboard types the receiver represents, in order of priority. | |
| NSString * | representedDataDescription |
| A string representing the data stored by the receiver, as provided by the receiver's developer. | |
| NSSet * | promisedFileWrappers |
| File wrappers representing any files promised by the original pasteboard data source. | |
| NSDate * | creationDate |
| The date when the receiver was initialized. | |
| BOOL | isHistoryItem |
| Whether or not the receiver is being displayed in the clipboard history window. | |
| NSSize | preferredViewSize |
| The preferred size of the view representing this pasteboard interpreter. | |
| NSColor * | closeButtonColor |
| The color of the close button used to remove the receiver's view. Unused. | |
| NSString * | accessibilityDescription |
| A textual representation of the data represented by the receiver. | |
CorkPboardInterpreter is the abstract superclass of your interpreters. You generally create a subclass of CorkPboardInterpreter to handle and display one or more pasteboard datatypes. The class is documented in greater detail in the Corkboard Developer Redbook.
Since Corkboard 1.1, CorkPboardInterpreter has implemented the NSCopying protocol. You should not need to make changes to your plug-ins to support this as it is done through the existing initWithPasteboard:arguments: (CorkPboardInterpreter) method.
Currently, interpreters execute in the same process as the Corkboard user interface. You should therefore code with performance in mind, as many interpreters may need to run concurrently. Avoid consuming large amounts of memory, spinning the CPU, etc.
In the future, interpreters may be spun off into child processes, sandboxed, or otherwise isolated from the address space of the Corkboard user interface. In such cases, the nature of performance concerns may change.
| - (id) initWithPasteboard: | (NSPasteboard *) | pboard | ||
| arguments: | (NSDictionary *) | args | ||
The designated initializer.
If your class cannot handle the contents of the pasteboard, release self and return nil; Corkboard will move on to the next available class that claims to handle the available pasteboard data.
| + (BOOL) canInitWithPasteboard: | (NSPasteboard *) | pboard | ||
| arguments: | (NSDictionary *) | args | ||
Whether or not an attempt to instantiate the receiver with the given arguments would succeed.
The result of this method is used by the Corkboard user interface to present options to the user.
| - (BOOL) writeToPasteboard: | (NSPasteboard *) | pboard |
Writes the receiver's represented data to the specified pasteboard.
If you do need to override this method (e.g. to write some user-generated state information), do not forget to call -[super writeToPasteboard:] to write the primary pasteboard data. Remember that interpreters represent the original data; they are not editors. Be sure you need additional state before overriding.
| - (id) initWithCoder: | (NSCoder *) | aDecoder |
Decodes and initializes the receiver.
If you do need to override this method (e.g. to read some user-generated state information), do not forget to call -[super initWithCoder:] to retrieve the primary pasteboard data. Remember that interpreters represent the original data; they are not editors. Be sure you need additional state before overriding.
If the user deletes the plug-in containing your subclass, or the subclass otherwise becomes unavailable, Corkboard will attempt to use another class to display the pasteboard data encoded by aDecoder.
| - (void) encodeWithCoder: | (NSCoder *) | aCoder |
Encodes the receiver to the specified coder.
If you do need to override this method (e.g. to write some user-generated state information), do not forget to call -[super encodeWithCoder:] to write the primary pasteboard data. Remember that interpreters represent the original data; they are not editors. Be sure you need additional state before overriding.
If the user deletes the plug-in containing your subclass, or the subclass otherwise becomes unavailable, Corkboard will attempt to use another class to display the encoded pasteboard data when it comes time to decode the receiver.
| - (void) dealloc |
Deallocates the receiver.
| + (NSArray *) supportedPasteboardTypes |
The pasteboard types that the receiver can interpret.
| + (NSInteger) priority |
The priority, relative to other interpreters, of this class.
You do not need to override this method to get this functionality. Instead, you can provide an integer or real value for the CorkPboardInterpreterPriority key of your class's info dictionary in your bundle's Info.plist. For more information on Corkboard's Info.plist additions, see the developer documentation at the Corkboard website.
| + (NSString *) localizedDisplayName |
The display name, in the current locale, of the receiver.
You do not need to override this method to get this functionality. Instead, you can provide a string value for the CorkPboardInterpreterDisplayName key of your class's info dictionary in your bundle's Info.plist. The display name can be localized in your bundle's InfoPlist.strings file.
@property localizedDisplayName
| + (NSImage *) icon |
An icon representing the receiver.
| - (NSData *) dataForRepresentedPasteboardType: | (NSString *) | type |
The data for the given pasteboard type as stored by the receiver.
| - (void) viewDidBecomeAvailable |
Sent to the receiver when its view becomes available.
This message is sent to a pasteboard interpreter once the associated view is set and assigned to a superview. Think of it as the equivalent of the -awakeFromNib message. The default implementation does nothing.
| - (void) viewWillBecomeUnavailable |
Sent to the receiver when its view becomes unavailable.
This message is sent to a pasteboard interpreter just before the associated view is removed from its superview and becomes eligible for deallocation. The view is still available at this point, but will be destroyed soon. The default implementation does nothing.
| - (IBAction) makeViewUnavailable: | (id) | sender |
Removes the receiver's view from Corkboard and potentially makes the receiver eligible for deallocation.
| - (IBAction) redrawView: | (id) | sender |
Tells the view associated with the receiver to redraw.
| - (NSRect) convertRectToHistoryItemView: | (NSRect) | rect |
Transforms a rectangle from the receiver's view's coordinate space to a history item's view's coordinate space.
| - (void) drawContentsInRect: | (NSRect) | rect |
Sent to the receiver when its content needs to be drawn.
By default, this method fills rect with white so that the user can see the view, but does nothing otherwise.
- (NSView*) view [read, assign] |
The view associated with the receiver.
This method may return nil if it is called before - viewDidBecomeAvailable has been sent to the receiver, or if it is called after - viewWillBecomeUnavailable has been sent to the receiver. You do not need to override it; doing so will not replace the view displayed by the Corkboard UI.
- (NSArray*) supportedPasteboardTypes [read, assign] |
Simply calls the class method + supportedPasteboardTypes.
- (NSInteger) priority [read, assign] |
Simply calls the class method + priority.
- (NSString*) localizedDisplayName [read, assign] |
Simply calls the class method + localizedDisplayName.
- (NSImage*) icon [read, assign] |
- (NSArray*) representedPasteboardTypes [read, assign] |
The pasteboard types the receiver represents, in order of priority.
An instance of an interpreter class automatically copies out all the data from the pasteboard used in its instantiation, then later writes that data to a pasteboard when the instance is to be transmitted outside of Corkboard or to disk. This preserves the precise state of that original pasteboard as closely as possible. This property simply lists the types of data that have been copied from that pasteboard.
For example, if the instance were created with a pasteboard containing data of NSStringPboardType and NSURLPboardType, this method would return an array containing NSStringPboardType and NSURLPboardType. The order of types matches the order of types returned by the initializing pasteboard's -types method.
- (NSString*) representedDataDescription [read, assign] |
A string representing the data stored by the receiver, as provided by the receiver's developer.
In Corkboard 1.x, this property is used with Corkboard's developer information. In Corkboard 2.0 and newer, it is also used as the interpreter instance's input when the user performs a search. You can return a string representing the data you're interpreting, and it will be compared against the user's search terms. By default, the value is nil (indicating no searchable content.)
- (NSSet*) promisedFileWrappers [read, assign] |
File wrappers representing any files promised by the original pasteboard data source.
Corkboard resolves file promises for you automatically. This property provides access to those files. If no files were promised or the promised files could not be resolved, the value of this property will be nil.
Not available on iPhone OS. The NSFileWrapper class does not exist on iPhone OS.
- (NSDate*) creationDate [read, assign] |
The date when the receiver was initialized.
Corkboard records the date and time of initialization of an interpreter instance for display to the user in some situations. In the case of archived objects, the date is maintained across encoding and decoding. In the case of copied objects, the date is not copied and the copy is assigned a new date based on the moment in time when it was allocated.
- (BOOL) isHistoryItem [read, assign] |
Whether or not the receiver is being displayed in the clipboard history window.
The clipboard history maintains a list of recent data copied to the clipboard in the form of interpreter instances. The window for the clipboard history is compact and allots a fixed amount of space to each interpreter instance's view. You may wish to change how you draw your content to match the smaller space.
- (NSSize) preferredViewSize [read, assign] |
The preferred size of the view representing this pasteboard interpreter.
By default, this method simply returns the constant size {32.0, 32.0}. To change this value, override the getter for this property.
- (NSColor*) closeButtonColor [read, assign] |
The color of the close button used to remove the receiver's view. Unused.
Interpreter instances' views are removed from the Corkboard window by clicking a button positioned near their top left corners. These buttons can be assigned a default color by the user, but interpreter instances may choose to assign their own custom color to the close button. By default, the value is nil, indicating the user's default close button color should be used. To change this value, override the getter for this property.
This property is ignored in Corkboard 1.1 and later.
- (NSString*) accessibilityDescription [read, assign] |
A textual representation of the data represented by the receiver.
To ensure accessibility for visually impaired users, Corkboard consults this property to help them determine what data is available to them. By default, the value of the property is nil. It is strongly recommended that, wherever possible, you override the getter for this property to return a localized, textual description of the data represented by the receiver.
CorkCore Framework Reference © 2008–2009 Ayluro, Inc. All rights reserved. Questions or comments? Contact us.