Important: The information in this document is obsolete and should not be used for new development.
Color Picker Parameter Block
When your application calls thePickColor
function (page 2-35) to display a standard color picker dialog box, your application uses a color picker parameter block to specify information to and obtain information from the Color Picker Manager. The color picker parameter block is defined by theColorPickerInfo
data type.
typedef struct ColorPickerInfo {/* color picker parameter block */ PMColor theColor; /* a picker color */ CMProfileHandledstProfile; /* destination profile */ long flags; /* color picker flags */ DialogPlacementSpecplaceWhere;/* dialog box placement specifier */ Point dialogOrigin;/* upper-left corner of dialog box */ long pickerType; /* color picker type */ UserEventProc eventProc; /* event filter function */ ColorChangedProccolorProc; /* color-changed function */ long colorProcData;/* data for color-changed function */ Str255 prompt; /* color picker prompt */ MenuItemInfo mInfo; /* application's edit menu items */ Boolean newColorChosen;/* whether user changed color */ } ColorPickerInfo;
Field Description
theColor
- A picker color structure (page 2-15). The color that your application supplies in this field is passed to the color picker for editing. This becomes the original color for the color picker. After the user clicks either the OK or Cancel button to close the dialog box, this field contains the new color, that is, the color last chosen by the user. Although the new colors selected by the user may vary widely, the original color remains fixed for comparison. Figure 2-1 (page 2-4) in Advanced Color Imaging on the Mac OS shows how the standard dialog box displays both the original and the new colors.
dstProfile
- A handle to a ColorSync 1.0 profile for the final output device. To use the default system profile, set this field to
nil
.- Important
- This version of the Color Picker Manager uses ColorSync 1.0 profiles only. The ColorSync 1.0 profile is a handle-based profile. The profile format is defined by Apple Computer. You cannot use version 2.x profiles, which are identified by profile references, with this version of the Color Picker Manager. ColorSync 1.0 profiles typically reside in the ColorSyncTM Profiles folder (within the Preferences folder of the System Folder). They may also be embedded with the images to which they pertain in graphics files. The appendix "ColorSync Manager Backward Compatibility" in Advanced Color Imaging on the Mac OS provides information about the relationship between the ColorSync Manager version 2.x and ColorSync 1.0 profiles, which you may find useful.
flags
- Bits representing the color picker flags (page 2-8). Your application can set any of the following flags:
#define CanModifyPalette 4 #define CanAnimatePalette 8 #define AppIsColorSyncAware 16
- The color picker may set any of the following flags and override your application settings:
#define InSystemDialog 32 #define InApplicationDialog 64 #define InPickerDialog 128 #define DetachedFromChoices 256
placeWhere
- A specification for where to position the dialog box. Your application uses one of the following constants, which are described in more detail in "Dialog Placement Specifiers" (page 2-8), to specify the position for the color picker dialog box:
enum DialogPlacementSpecifiers { kAtSpecifiedOrigin, kDeepestColorScreen, kCenterOnMainScreen }; typedef short DialogPlacementSpec;
dialogOrigin
- The point, in global coordinates, at which to locate the upper-left corner of the dialog box. This origin point is used only if your application supplies the
kAtSpecifiedOrigin
specifier in theplaceWhere
field.pickerType
- The component subtype of the initial color picker. If your application sets this field to 0, the default color picker is used (that is, the last color picker chosen by the user). When
PickColor
returns, this field contains the component subtype of the color picker that was chosen when the user closed the color picker dialog box.eventProc
- A pointer to an application-defined event filter function (page 2-57) for handling user events meant for your application. If your filter function returns
true
, the Color Picker Manager won't process the event any further. If your filter function returnsfalse
, the Color Picker Manager handles the event as if it were meant for the color picker.colorProc
- A pointer to an application-defined function (page 2-58) to handle color changes. 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.prompt
- A text string prompting the user to choose a color for a particular use (for example, "Choose a highlight color:").
mInfo
- A
MenuItemInfo
structure (page 2-19). This structure allows your application to specify your Edit menu for use when a color picker dialog box is displayednewColorChosen
- Upon completion, the
PickColor
function returns the valuetrue
if the user chose a color and clicked the OK button, andfalse
if the user clicked Cancel.