This is NSPasteboard.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc. All Rights Reserved. s4 li100 fi0 ri1007 ql f0 b fs36 fs100 fs36 NSPasteboard pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject fs20 fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSObject (NSObject) fs20 fs28 s7 f0 b fs24 Declared In:tab b0 fs28 f1 AppKit/NSPasteboard.h fs20 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 fs28 Class Description fs14 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 NSPasteboard objects transfer data to and from the pasteboard server. The server is shared by all running applications. It contains data that the user has cut or copied and may paste, as well as other data that one application wants to transfer to another. NSPasteboard objects are an application'27s sole interface to the server and to all pasteboard operations. fs16 fs28 pard s15 li477 fi0 ri1007 ql f0 b fs24 fs4 fs24 Named Pasteboards pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 fs28 Data in the pasteboard server is associated with a name that indicates how it'27s to be used. Each set of data and its associated name is, in effect, a separate pasteboard, distinct from the others. An application keeps a separate NSPasteboard object for each named pasteboard that it uses. There are five standard pasteboards in common use: fs16 fs28 pard s18 li4509 fi-3655 ri1007 ql tx4509 tx10432 General pasteboardtab The pasteboard that'27s used for ordinary cut, copy, and paste operations. It holds the contents of the last selection that'27s been cut or copied. fs16 fs28 fi-3655 fi-3655 Font pasteboardtab The pasteboard that holds font and character information and supports the Copy Font and Paste Font commands. fs16 fs28 fi-3655 fi-3655 Ruler pasteboardtab The pasteboard that holds information about paragraph formats in support of the Copy Ruler and Paste Ruler commands. fs16 fs28 fi-3655 fi-3655 Find pasteboardtab The pasteboard that holds information about the current state of the active application'27s Find panel. This information permits users to enter a search string into the Find panel, then switch to another application to conduct the search. fs16 fs28 fi-3655 fi-3655 Drag pasteboardtab The pasteboard that stores data to be manipulated as the result of a drag operation. fs16 fs28 fi-3655 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 Each standard pasteboard is identified by a unique name (stored in global string objects): fs16 fs28 pard s17 li854 fi0 ri1007 ql tx4509 tx10180 NSGeneralPboard fi0 NSFontPboard fi0 NSRulerPboard fi0 NSFindPboard fi0 NSDragPboard fs6 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 fs10 fs28 You can create private pasteboards by asking for an NSPasteboard object with any name other than those listed above. The name of a private pasteboard can be passed to other applications to allow them to share the data it holds. fs16 fs28 The NSPasteboard class makes sure there'27s never more than one object for each named pasteboard. If you ask for a new object when one has already been created for the pasteboard with that name, the existing object will be returned to you. fs16 fs28 pard s15 li477 fi0 ri1007 ql f0 b fs24 fs4 fs24 Data Types pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 fs28 Data can be placed in the pasteboard server in more than one representation. For example, an image might be provided both in Tag Image File Format (TIFF) and as encapsulated PostScript code (EPS). Multiple representations give pasting applications the option of choosing which data type to use. In general, an application taking data from the pasteboard should choose the richest representation it can handle'd0rich text over plain ASCII, for example. An application putting data in the pasteboard should promise to supply it in as many data types as possible, so that as many applications as possible can make use of it. fs16 fs28 Data types are identified by string objects containing the full type name. These global variables identify the string objects for the standard pasteboard types: fs16 fs28 pard s19 li854 fi0 ri1007 ql tx4509 tx10180 f0 b fs24 Typetab Description fs6 fs24 s17 f1 b0 fs28 NSStringPboardTypetab NSString data fi0 NSPostScriptPboardTypetab Encapsulated PostScript code (EPS) fi0 NSTIFFPboardTypetab Tag Image File Format (TIFF) fi0 NSRTFPboardTypetab Rich Text Format (RTF) fi0 NSFilenamesPboardTypetab ASCII text designating one or more file names fi0 NSTabularTextPboardTypetab Tab-separated fields of ASCII text fi0 NSFontPboardTypetab Font and character information fi0 NSRulerPboardTypetab Paragraph formatting information fi0 NSFileContentsPboardTypetab A representation of a file'27s contents fi0 NSColorPboardTypetab NSColor data fi0 NSGeneralPboardTypetab Describes a selection fi0 NSDataLinkPboardTypetab Defines a link between documents fs6 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 fs10 fs28 Types other than those listed can also be used. For example, your application may keep data in a private format that'27s richer than any of the types listed above. That format can also be used as a pasteboard type. fs16 fs28 pard s15 li477 fi0 ri1007 ql f0 b fs24 fs4 fs24 Reading and Writing Data pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 fs28 Typically, data is written to the pasteboard using b setData:forType:b0 and read using b dataForType:b0 . However, data of the type NSFileContentsPboardType, representing the contents of a named file, must be written to the NSPasteboard object using b writeFileContents:b0 and copied from the object to a file using b readFileContentsType:toFile:b0 . fs16 fs28 pard s15 li477 fi0 ri1007 ql f0 b fs24 fs4 fs24 Errors pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 fs28 Except where errors are specifically mentioned in the method descriptions, any communications error with the pasteboard server raises an NSPasteboardCommunicationException exception. fs16 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 fs28 Creating and Releasing an NSPasteboard Object fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (NSPasteboard *)b generalPasteboardb0 tab Returns the general NSPasteboard. fi-6552 fs16 fs28 fi-6552 + (NSPasteboard *)b pasteboardWithName:b0 (NSString *)i namei0 tab s9 li7030 fi-6553 fi-5796 tab Returns the NSPasteboard named i namei0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSPasteboard *)b pasteboardWithUniqueNameb0 tab Returns a uniquely named NSPasteboard. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b releaseGloballyb0 tab Releases the NSPasteboard and its resources in the pasteboard server. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Getting Data in Different Formats fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (NSPasteboard *)b pasteboardByFilteringData:b0 (NSData *)i datai0 tab s9 li7030 fi-6553 fi-5796 b ofType:b0 (NSString *)i typei0 tab Returns an NSPasteboard that contains data of all types filterable from i datai0 of type i typei0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSPasteboard *)b pasteboardByFilteringFile:b0 (NSString *)i filenamei0 tab s9 li7030 fi-6553 fi-5796 tab Returns an NSPasteboard that contains data of all types filterable from i filenamei0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSPasteboard *)b pasteboardByFilteringTypesInPasteboard:b0 (NSPasteboard *)i pboardi0 tab s9 li7030 fi-6553 fi-5796 tab Returns an NSPasteboard that contains data of all types filterable from i pboardi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSArray *)b typesFilterableTo:b0 (NSString *)i typei0 tab Returns an array specifying all types i typei0 can be filtered to. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Referring to a Pasteboard by Name fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSString *)b nameb0 tab Returns the NSPasteboard'27s name. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Writing Data fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (int)b addTypes:b0 (NSArray *)i newTypesi0 tab Adds data types to the NSPasteboard and declares a new s9 li7030 fi-6553 fi-5796 b owner:b0 (id)i newOwneri0 tab tab owner. Returns the new change count or 0 in case of error. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (int)b declareTypes:b0 (NSArray *)i newTypesi0 tab Sets the data types and owner of the NSPasteboard and s9 li7030 fi-6553 fi-5796 b owner:b0 (id)i newOwneri0 tab tab returns the new change count. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b setData:b0 (NSData *)i datab i0 b0 tab Writes data of type i dataTypei0 to the pasteboard server from s9 li7030 fi-6553 fi-5796 b forType:b0 (NSString *)i dataTypei0 tab i tab datai0 . Returns YES if the data is successfully written; otherwise returns NO. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b setPropertyList:b0 (id)i propertyListb i0 tab b0 Writes data of type i dataTypei0 to the pasteboard server from s9 li7030 fi-6553 fi-5796 b forType:b0 (NSString *)i dataTypei0 tab i tab propertyListi0 . Returns YES if the data is successfully written; otherwise returns NO. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b setString:b0 (NSString *)i stringb i0 b0 tab Writes data of type i dataTypei0 to the pasteboard server from s9 li7030 fi-6553 fi-5796 b forType:b0 (NSString *)i dataTypei0 tab i tab stringi0 . Returns YES if the data is successfully written; otherwise returns NO. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b writeFileContents:b0 (NSString *)i filenamei0 tab Writes data from i filenamei0 to the pasteboard server. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Determining Types fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSString *)b availableTypeFromArray:b0 (NSArray *)i typesi0 tab s9 li7030 fi-6553 fi-5796 tab Returns first type in i typesi0 that matches a type declared in the receiver. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSArray *)b typesb0 tab Returns an array of the NSPasteboard'27s data types. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Reading Data fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (int)b changeCountb0 tab Returns the NSPasteboard'27s change count. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSData *)b dataForType:b0 (NSString *)i dataTypei0 tab Returns NSPasteboard data using the type specified by i dataTypei0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b propertyListForType:b0 (NSString *)i dataTypei0 tab Returns a property list object using the type specified by i dataTypei0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b readFileContentsType:b0 (NSString *)i typeb i0 s9 li7030 fi-6553 fi-5796 b0 b toFile:b0 (NSString *)i filenamei0 tab Reads data of type i typei0 representing a file'27s contents from the NSPasteboard and writes it to i filenamei0 . Returns the actual name of the file that was written. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringForType:b0 (NSString *)i dataTypei0 tab Returns an NSString using the type specified by i dataTypei0 . pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Methods Implemented by the Owner fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (void)b pasteboard:b0 (NSPasteboard *)i senderb i0 tab b0 Implemented to write promised data to i senderi0 as i typei0 . s9 li7030 fi-6553 fi-5796 b provideDataForType:b0 (NSString *)i typei0 tab s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b pasteboardChangedOwner:b0 (NSPasteboard *)i sender s9 li7030 fi-6553 fi-5796 i0 tab Notifies prior owner that ownership changed. }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.