Customized Icons
Customized Icons
You can create customized icons for your documents. Users can also create
customized icons. Customized icons are stored with resource ID -16455 in the
resource fork of the file. (Compare this to the method described in
Finder-Related Resources whereby icons are defined through a bundle
resource and its associated icon list and file reference resources.)
In System 7.0, the user can customize individual icons. By selecting a file and
choosing Get Info from the File menu, the user sees the information window for
that file. The user can then select the icon displayed in the upper-left corner
of the information window and use the Paste command in the Edit menu to
replace it with a picture from the Clipboard. The Finder creates a family of
icons based on the user's customized icon, assigns a resource ID of -16455 to
each icon resource in the family, stores these resources in the resource fork
of the file that the icon represents, and sets the hasCustomIcon bit in the file's
Finder flags field.
Your application can use the same strategy to provide customized icons to the
documents that it creates. For example, a drawing application might create
miniature versions of the illustrations contained within its documents and use
those for the documents' icons.
If you are a database developer who creates and distributes query documents
that support the Data Access Manager, you can also use this strategy to
create icons that identify your database's query documents. Similarly, if
instead of producing an application you produce and distribute information
(such as database files, stationery pads, clip art libraries, or dictionaries) to
be used by other applications, you might want to provide icons that
distin-guish your documents.
To make the System 7.0 Finder display customized icons for a document, you
must create-at least-an 'ICN#' resource with resource ID -16455 and store it
in the document's resource fork. (To create this while your application is
running, your application can call the AddResource procedure, described in
the Resource Manager) You can use the following constant in place of the ID
number.
kCustomIconResource = res ID for custom icon
If you provide only an 'ICN#' resource, the Finder uses a black-and-white
icon on all screen displays and automatically reduces it when a small version
of the icon is required. To create color versions and to define a small version of
the icon, create an entire icon family as described in Icon resources.
After creating icon resources with the kCustomIconResource constant as their
IDs, you must set the hasCustomIcon bit in the file's Finder flags field. To
prevent users from changing these icons, set the nameLocked bit in the file's
Finder flags field. (Most development environments for System 7.0 provide
tools for setting these bits. Finder Information in the Volume Catalog describes
Finder flags.)
Note: If you want your document to appear with its own icons on earlier
versions of system software, you must create a file reference resource and a
bundle resource.