Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 5 - Icon Utilities / Icon Utilities Reference
Icon Utilities Routines / Determining Whether a Point or Rectangle Is Within an Icon


PtInIconSuite

You can use the PtInIconSuite function to determine whether a specified point is within an icon. (A point is considered to be within an icon if the point is within the icon's mask.) For example, you might use this function to determine whether a user clicked an icon in a window of your application. You specify as parameters to PtInIconSuite the same rectangle and alignment that you last used to draw the icon. PtInIconSuite uses the size of this rectangle to determine which icon mask from the icon suite to use for the operation. The PtInIconSuite function uses the location of this rectangle (along with the alignment) to determine whether a specified point is within the icon.

FUNCTION PtInIconSuite (testPt: Point; iconRect: Rect; 
                        align: IconAlignmentType; 
                        theIconSuite: Handle): Boolean;
testPt
The point to be tested, specified in local coordinates of the current graphics port.
iconRect
The rectangle in which the icon appears, specified in local coordinates
of the current graphics port. PtInIconSuite determines, from the
size of the rectangle specified in this parameter, which icon mask from the icon suite specified by theIconSuite to test the point against. PtInIconSuite then uses the location of this rectangle (and the location of the icon in the rectangle) to determine whether the specified point is within the icon.
align
A value that specifies how the icon against which to hit-test is aligned within the rectangle specified by iconRect. See the description of PlotIconSuite on page 5-35 for a list of constants you can use in this parameter.
theIconSuite
A handle to an icon suite.
DESCRIPTION
The PtInIconSuite function hit-tests the point specified by testPt against the appropriate icon mask from the specified icon suite. PtInIconSuite determines which icon mask to use ('ICN#' or 'ics#') according to the rectangle specified in iconRect. The parameters iconRect and align should be the same as when the icon was last drawn. The PtInIconSuite function returns TRUE if the point is in the icon mask and FALSE if it is not.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996