Important: The information in this document is obsolete and should not be used for new development.
RectInIconMethod
You can use theRectInIconMethodfunction to hit-test a rectangle against an icon obtained by your icon getter function for a specified destination rectangle and alignment.
FUNCTION RectInIconMethod (testRect: Rect; iconRect: Rect; align: IconAlignmentType; theMethod: IconGetter; yourDataPtr: Ptr): Boolean;
testRect- The rectangle 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.
align- A value that specifies how the icon against which to hit-test is aligned within the rectangle specified by
iconRect. See the description ofPlotIconIDon page 5-20 for a list of constants you can use in this parameter.theMethod- A pointer to an icon getter function.
yourDataPtr- A pointer to data that is passed to your icon getter function.
DESCRIPTION
TheRectInIconMethodfunction hit-tests the rectangle specified bytestRectagainst an icon mask obtained with the aid of an icon getter function and as the icon appears in the destination rectangle. The parametersiconRectandalignshould be the same as when the icon was last drawn. The function returnsTRUEif the rectangle intersects the icon mask andFALSEif it doesn't.
RectInIconMethodpasses to your icon getter function the type of the icon your function should retrieve and the value specified in theyourDataPtrparameter. TheRectInIconMethodfunction examines the size of the rectangle and requests the appropriate icon from your icon getter function--an icon of icon type'ICN#'or'ics#'. Your icon getter function should return a handle to the data of the requested icon type. TheRectInIconMethodfunction extracts the mask from the icon data that your icon getter function returns. If your icon getter function returns data that does not correspond to an icon of type'ICN#'or type'ics#',RectInIconMethodattempts to generate a mask from the returned data.Your icon getter function can get the data for the icon and its mask using whatever method is appropriate to your application. For example, your application might maintain its own cache of icons (and pass a pointer to it in the
yourDataPtrparameter) or use its icon getter function to get an icon from the desktop database.SEE ALSO
For more information about icon getter functions, see page 5-58.