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: Advanced Color Imaging Reference /
Chapter 2 - Color Picker Manager Reference /
Constants and Data Types


Event Data Structure

When your application uses the DoPickerEvent function (page 2-44) to pass an event to a color picker for handling, your application uses an EventData structure to supply the color picker with information about the event and to receive information about how the color picker handled the event.

typedef struct EventData {
   EventRecord *event;     /* an event record */
   PickerActionaction;     /* the action performed by 
                              the color picker */
   short       itemHit;    /* the item number for the item 
                              associated with the event */
   Boolean     handled;    /* true if the color picker 
                              handled the event */
   ColorChangedProc
               colorProc;  /* application-defined function for 
                              changing colors in a document */
   long        colorProcData;/* data used by application for 
                              function in ColorChangedProc 
                              field */
   EventForcasterforcast;  /* event forecaster */
} EventData;
Field Description
event
An event record. Your application supplies this field with an event to pass to the color picker. The event record is described in the chapter "Event Manager" in Inside Macintosh: Macintosh Toolbox Essentials.
action
The nature of the event. In this field, the Color Picker Manager returns a value, defined in the PickerAction enumeration, describing the event. See the description of the PickerAction enumeration (page 2-5) for a discussion about how your application should respond to these actions.
               enum PickerAction {
                kDidNothing,  /* no action worth reporting */
                kColorChanged,/* user chose different color */
                kOkHit,       /* user clicked OK */
                kCancelHit,   /* user clicked Cancel */
                kNewPickerChosen,
                              /* user chose new color picker */
                kApplItemHit  /* Dialog Manager returned an 
                                 item in an application-owned 
                                 dialog box */
               };
               typedef short PickerAction;
itemHit
For the item associated with the event, the number corresponding to the item's position with the item list resource of the color picker's dialog box. See the chapter "Dialog Manager" in Inside Macintosh: Macintosh Toolbox Essentials for information about items, item list resources, and dialog boxes.
handled
A Boolean value indicating whether the color picker or the Color Picker Manager handled the event. If the Color Picker Manager returns the value true in this field, then the event was handled; otherwise, your application should process the event.
If your application sends an event forecaster to the color picker, the color picker informs your application about whether the color picker is ready for the action to occur by setting this field to true if it's not ready and false if it is.
colorProc
A pointer to an application-defined function to handle color changes (page 2-58). This function should support the updating of colors in a document as the user selects them.
colorProcData
A long integer that the Color Picker Manager passes to the application-defined function supplied in the colorProc field. Your application-defined function can use this value for any purpose it needs.
forcast
An event forecaster (that is, a warning) for the color picker. To send an event forecaster to the color picker, set the event field to nil and set the forcast field to a value from the following enumeration. See "Sending Event Forecasters to the Color Picker" (page 2-23) in Advanced Color Imaging on the Mac OS for more information.
               enum EventForcasters {
                kNoForcast,   /* no forecast (e.g., an update 
                                 event) */
                kMenuChoice,  /* this event causes a menu to  
                                 be chosen */
                kDialogAccept,/* the dialog box will be  
                                 accepted */
                kDialogCancel,/* the dialog box will be  
                                 canceled */
                kLeaveFocus,  /* the focus will leave the  
                                 color picker */
                kPickerSwitch,/* new color picker chosen in  
                                 More Choices list */
                kNormalKeyDown,/* a normal key-down event in an 
                                 edit field */
                kNormalMouseDown/* a normal click in the  
                                 color picker's focus */
               };
               typedef short EventForcaster;

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 NOV 1996