ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/ApplicationKit/Classes/NSColorList.rtf

This is NSColorList.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 NSColorList 
pard s14 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject
fs20 
fs28 s7 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding
fi0 NSObject (NSObject)
fs20 
fs28 s8 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 AppKit/NSColorList.h 
fs20 
fs28 pard s19 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 Instances of NSColorList are used to manage named lists of NSColors. NSColorPanel'27s list-mode color picker uses instances of NSColorList to represent any lists of colors that come with the system, as well as any lists created by the user. An application can use NSColorList to manage document-specific color lists, which may be added to an application'27s NSColorPanel using its b attachColorList:b0  method.
fs16 
fs28 An NSColorList is similar to a dictionary object: An NSColor is added to, looked up in, and removed from the list by specifying its key, which is an NSString. In addition, colors can be inserted at specified positions in the list. The list itself has a name, specified when you create the object (using either b initWithName:b0  or b initWithName:fromFile:b0 ).
fs16 
fs28 An NSColorList saves and retrieves its colors from files with the extension b 'aa.clrb0 'ba in directories defined by a standard search path. To access all the color lists in the standard search path, use the b availableColorListsb0  method; this returns an array of NSColorLists, from which you can retrieve the individual color lists by name.
fs16 
fs28 NSColorList reads color list files in several different formats; it saves color lists using the archiver API.
fs16 
fs28 pard s19 li100 fi0 ri1007 ql f0 b fs24 
fs28 Initializing an NSColorList
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (id)b initWithName:b0 (NSString *)i namei0 tab Initializes and returns the receiver, registering it under the specified name if the name isn'27t in use already. 
fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithName:b0 (NSString *)i namei0 tab Initializes and returns the receiver, registering it under the
s11 li7030 fi-6553 fi-5796 b fromFile:b0 (NSString *)i pathi0 tab tab specified name if the name isn'27t in use already. i pathi0  should be the full path to the file for the color list; i namei0  should be the name of the file for the color list (minus the 'aa.clr'ba extension). 
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Getting All Color Lists
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (NSArray *)b availableColorListsb0 tab Returns an array of all NSColorLists found in the standard color list directories. Color lists created at run time aren'27t included in this list unless they'27re saved into one of the standard color list directories.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Getting a Color List by Name
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (NSColorList *)b colorListNamed:b0 (NSString *)i name
s11 li7030 fi-6553 fi-5796 i0 tab Searches the array that'27s returned by b availableColorListsb0  and returns the NSColorList named i namei0 , or b nilb0  if no such color list exists. i namei0  mustn'27t include the 'aa.clr'ba suffix.
s9 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b nameb0 tab Returns the name of the NSColorList. 
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Managing Colors by Key
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSArray *)b allKeysb0 tab Returns an array of NSString objects that contains all the keys by which the NSColors are stored in the NSColorList. The length of this array equals the number of colors, and its contents are arranged according to the ordering specified when the colors were inserted.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSColor *)b colorWithKey:b0 (NSString *)i keyi0 tab Returns the NSColor associated with i keyi0 , or b nilb0  if there is nonei .
fi-6552 i0 fs16 
fs28 fi-6552 {f3 -} (void)b insertColor:b0 (NSColor *)i colori0 tab Inserts i colori0  at the specified location in the list (which is
s11 li7030 fi-6553 fi-5796 b key:b0 (NSString *)i keyi0 tab tab numbered starting with 0). If the list already contains a
b atIndex:b0 (unsigned)i locationi0 tab tab color with the same key at a different location, it'27s removed from the old location. This method posts the NSColorListChangedNotification notification to the default notification center. Raises NSColorListNotEditableException if the color list is not editable. This method posts the NSColorListChangedNotification notification to the default notification center.
s9 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b removeColorWithKey:b0 (NSString *)i keyi0 tab Removes the color associated with i key i0 from the list. This method does nothing if the list doesn'27t contain the key. This method posts the NSColorListChangedNotification notification to the default notification center. Raises NSColorListNotEditableException if the color list is not editable.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setColor:b0 (NSColor *)i aColori0 tab Associates the specified NSColor with the key i keyi0 . If the
s11 li7030 fi-6553 fi-5796 b forKey:b0 (NSString *)i keyi0 tab tab list already contains i keyi0 , this method sets the corresponding color to i aColori0 ; otherwise, it inserts i aColori0  at the end of the list.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Editing
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (BOOL)b isEditableb0 tab Returns YES if the color list can be modified. This depends on the source of the list: If it came from a write-protected file, this method returns NO.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Writing and Removing Files
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (BOOL)b writeToFile:b0 (NSString *)i pathi0 tab If i pathi0  is a directory, saves the NSColorList in a file named i listnamei0 .clr (where i listnamei0  is the name with which the NSColorList was initialized). If i pathi0  includes a file name, this method saves the file under that name. If i pathi0  is b nilb0 , this method saves the file as i listnamei0 .clr in the standard location. Returns YES upon success.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b removeFileb0 tab Deletes the file from which the list was created, unless the user doesn'27t own the color list. The receiver is removed from the list of available colors, but isn'27t released.
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.