Important: The information in this document is obsolete and should not be used for new development.
Color Picker-Defined Functions
If you are creating your own color picker, it must support the functions described in this section. When you create a color picker, the Color Picker Manager uses the Component Manager to request services from your color picker. The code for your color picker should be contained in a resource, as described in "Creating a Component Resource for a Color Picker" (page 2-28) in Advanced Color Imaging on the Mac OS. The Component Manager expects that the entry point in this resource is a function having this format:
pascal ComponentResult MyColorPickerDispatch ( ComponentParameters *params, Handle storage);Listing 2-16 (page 2-32) in Advanced Color Imaging on the Mac OS illustrates how to implement this function.Whenever the Color Picker Manager uses the Component Manager to send a request to your color picker, the Component Manager calls your component's entry point and passes any parameters, along with information about the current connection, in a component parameters structure. The Component Manager also passes a handle to the global storage associated with that instance of your color picker.
The request codes that the Component Manager sends to your color picker are described in "Request Codes" (page 2-12). Your color picker must also support the four required request codes described in the chapter "Component Manager" in Inside Macintosh: More Macintosh Toolbox.
When your color picker receives a request, it should examine the parameters to determine the nature of the request, perform the appropriate processing, set an error code if necessary, and return an appropriate function result to the Component Manager.
To extract these parameters, your color picker code should use the
CallComponentFunctionWithStorage
function, which invokes a specified function of your color picker with the parameters originally provided by the Color Picker Manager. Your color picker passes these parameters by specifying the same component parameters structure that was received by your color picker's main entry point. TheCallComponentFunctionWithStorage
function also provides a handle to the memory associated with the current connection. Your color picker uses this memory to store private data that it initializes in response to thekInitPicker
request code. Therefore, all of the functions described in this section take a handle to storage as their first parameter.
Subtopics
- Setting Up a Color Picker
- Responding to Requests to Return and SetColor Picker Information
- Responding to Events in a Color Picker