PlotIconID
PlotIconID
Display an icon image with System 7 icon resource types Rect *theRect ; rectangle to draw in, in local coordinates short alignment ; icon alignment type
short transform ; icon transform type
short theResID ; resource ID of icon family to use.
specified by a rectangle.
theRect is the address of an 8-byte Rect structure, expressed in local coordinates.
alignment alignment method used in case the icon does not exactly fit the
rectangle give. See the Notes section below.
transform desired appearance of the icon on the screen. See the Notes section
below.
theResID resource ID of the family of 'icxx'-type resources to use. If the
correct bit depth or size required is not defined, the closest fitting
one will be used.
Notes: PlotIconID can be use with resources of type 'cicn' as well as icon families.
It is NOT necessary to explicitly create an icon family ( using
PlotIconID takes a parameter which specifies the aligment of the icon in the destination rectangle. Most icons do not fully fill their rectangle, and it
is sometimes necessary to draw the icon relative to other data (like menu
text). For this reason, you can specify one of these standard alignment
values for the alignment parameter. You can add a vertical alignment to a
horizontal alignment to create a composite alignment value.
atNone
atVerticalCenter
atTop
atBottom
atHorizontalCenter
atLeft
atRight
The transform parameter specifies the mode or "transform" in which the icon should be drawn. Transforms are analogous to certain Finder states for
the icons. For example the transform that you would use to show an icon of
a disk that has been ejected is ttOffline. The following transforms are
available.
ttNone
ttDisabled
ttOffline
ttOpen
ttSelected
ttSelectedDisabled
ttSelectedOffline
Note that the ttSelected transform can be added to any of the other
transform types.
Macintosh Technote #306 states that the actual appearance of the icon
drawn by each transform type may vary with future system software, so
you should always try to use the transform type that best fits the state it
represents in your application.
Additional transform types exist for displaying the icon of a file inside
your application that use the Finder's label colors to color the icon. To
determine the proper lable for a file's icon, you can check bits 1-3 of the
fdFlags in the file's Finder Info (obtained using GetFInfo or PBGetFInfo). The bits contain a number from 0 to 7. Simply add the corresponding ttLabel value to the transform that you pass to PlotIconID. The label values are
ttLabel0 ttLabel4
ttLabel1 ttLabel5
ttLabel2 ttLabel6
ttLabel3 ttLabel7
PlotIconID chooses the appropriate icon based primarily on size; once the proper icon size is determined (based on the destination rectangle), the
present member of that size with the deepest bit depth that the current
device can use is selected. A size category is considered present if the black
and white member (with mask) wis present, 'ICN#', 'ics#', or 'icm#'.
PlotIconID can be used for both picture accumulation and printing. This routine is not currently documented in MPW header files (hence, it is
not in any THINK C or THINK Pascal header file either). The information
given above comes from Macintosh Technical Note #306. This tech. note
also gives the inline glue for the call as follows:
short transform, short theResID) = {0x303C, 0x0500, 0xABC9};