| Conforms to | |
| Availability | Available in Mac OS X v10.6 and later. |
| Declared in | NSPasteboard.h |
| Companion guides | |
| Related sample code |
The NSPasteboardWriting protocol specifies the interface for retrieving a representation of an object that can be written to a pasteboard. The Cocoa framework classes NSString, NSAttributedString, NSURL, NSColor, NSSound, NSImage, and NSPasteboardItem implement this protocol. You can make your custom class conform to this protocol so that you can write instances of the class to a pasteboard using the writeObjects: method of NSPasteboard.
– writableTypesForPasteboard: required method
– pasteboardPropertyListForType: required method
– writingOptionsForType:pasteboard: required method
Returns a property list object to represent the receiver on a pasteboard as an object of a specified type. (required)
- (id)pasteboardPropertyListForType:(NSString *)type
One of the types the receiver supports for writing (one of the UTIs returned by its implementation of writableTypesForPasteboard:).
A property list object to represent the receiver on a pasteboard as an object of type type.
The returned value will commonly be the NSData object for the specified data type. However, if this method returns either a string, or any other property-list type, the pasteboard will automatically convert these items to the correct data format required for the pasteboard.
NSPasteboard.hReturns an array of UTI strings of data types the receiver can write to a given pasteboard. (required)
- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard
A pasteboard.
You can use this argument to provide different options based on the pasteboard name, if you need to.
An array of UTI strings of data types the receiver can write to pasteboard.
By default, data for the first returned type is put onto the pasteboard immediately, with the remaining types being promised.
To change the default behavior, implement -writingOptionsForType:pasteboard: and return NSPasteboardWritingPromised to lazily provide data for types, return no option to provide the data for that type immediately. Use the pasteboard argument to provide different types based on the pasteboard name, if desired. Do not perform other pasteboard operations in the method implementation.
NSPasteboard.hReturns options for writing data of a specified type to a given pasteboard. (required)
- (NSPasteboardWritingOptions)writingOptionsForType:(NSString *)type pasteboard:(NSPasteboard *)pasteboard
One of the types the receiver supports for writing (one of the UTIs returned by its implementation of writableTypesForPasteboard:).
A pasteboard.
You can use this argument to provide different options based on the pasteboard name, if you need to.
Options for writing data of type type to pasteboard. Return 0 for no options, or a value given in “Pasteboard Writing Options.”
Do not perform other pasteboard operations in the method implementation.
NSPasteboard.hConstant to specify options for writing to a pasteboard, used by writingOptionsForType:pasteboard:.
enum {
NSPasteboardWritingPromised = 1 << 9,
};
NSPasteboardWritingPromisedData for a type with this option will be promised, not immediately written.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
Type to specify options for writing to a pasteboard.
typedef NSUInteger NSPasteboardWritingOptions;
For possible values, see “Pasteboard Writing Options.”
NSPasteboard.hLast updated: 2009-01-20