Carbon Events Versus Classic DefProc Messages

The window event constants defined by the Carbon Event Manager map to the window messages sent to window defprocs (WDEFs) as shown in Table A-1.

Table A-1  Window events versus window defproc messages

Window event constant

Window defproc message

kEventWindowDrawFrame

kWindowMsgDraw

kEventWindowDrawPart

kWindowMsgDraw

kEventWindowHitTest

kWindowMsgTestHit

kEventWindowInit

kWindowMsgInitialize

kEventWindowDispose

kWindowMsgCleanUp

kEventWindowGrowBox

kWindowMsgDrawGrowBox

kEventWindowGetRegion

kWindowMsgGetRegion

kEventWindowDragHilite

kWindowMsgDragHilite

kEventWindowModified

kWindowMsgModified

kEventWindowSetUpProxyDragImage

kWindowMsgSetUpProxyDragImage

kEventWindowStateChanged

kWindowMsgStateChanged

kEventWindowMeasureTitle

kWindowMsgMeasureTitle

kEventWindowGetGrowImageRegion

kWindowMsgGetGrowImageRegion

kEventWindowPaint

No equivalent message

Table A-2 shows window defproc messages that have no direct Carbon Event equivalent.

Table A-2  Deprecated or unsupported WDEF messages

Message

Why no Carbon event equivalent

kWindowMsgCalculateShape

Obsolete in Carbon. The Window Manager sends two kEventWindowGetRegion events (or two kWindowMsgGetRegion messages): one for the structure region, another for the content region.

kWindowMsgDrawGrowOutLine

Functionality replaced by kEventWindowGetGrowImageRegion. Instead of asking the custom window to draw the grow outline, the Window Manager asks for the grow image outline and draws it itself.

kWindowMsgGetFeatures

Functionality is now included in the kEventWindowInit event. When called, the initialization handler should place the window features into the kEventParamWindowFeatures parameter before returning.

kWindowMsgDrawInCurrentPort

Essentially replaced by kEventWindowDrawFrame, which implies drawing into the current port.

The control event constants defined by the Carbon Event Manager generally map to control messages sent to control defprocs (CDEFs) as shown in Table A-3.

Table A-3  Control events versus Control defproc messages

Control event constant

Control defproc messages

kEventControlInitialize

initCntlkControlMsgTestNewMsgSupportkControlMsgGetFeatures (in that order)

kEventControlDispose

dispCntl

kEventControlGetOptimalBounds

kControlMsgCalcBestRect

kEventControlDefInitialize

Same as for kEventControlInitializes

kEventControlDefDispose

Same as for kEventControlDispose

kEventControlHit

No equivalent message

kEventControlSimulateHit

No equivalent message

kEventControlHitTest

testCntl

kEventControlDraw

drawCntl

kEventControlApplyBackground

kControlMsgSetUpBackground

kEventControlApplyTextColor

kControlMsgApplyTextColor

kEventControlSetFocusPart

kControlMsgFocus

kEventControlGetFocusPart

No equivalent message

kEventControlActivate

kControlMsgActivate (with param = 1)

kEventControlDeactivate

kControlMsgActivate (with param = 0)

kEventControlSetCursor

kControlMsgSetCursor

kEventControlContextualMenuClick

kControlMsgContextualMenuClick

kEventControlTrack

kControlMsgHandleTracking

kEventControlGetScrollToHereStartPoint

No equivalent message

kEventControlGetIndicatorDragConstraint

thumbCntl

kEventControlIndicatorMoved

kControlMsgDrawGhost (for non-live tracking) or kControlMsgCalcValueFromPos (for live tracking)

kEventControlGhostingFinished

posCntl

kEventControlGetActionProcPart

No equivalent message

kEventControlGetPartRegion

kControlMsgGetRegion for controls that support GetRegion, calcCntlRgn or calcThumbRgn otherwise

kEventControlGetPartBounds

No equivalent message

kEventControlSetData

kControlMsgSetData

kEventControlGetData

kControlMsgGetData

kEventControlValueFieldChanged

drawCntl with param = kControlIndicatorPart

kEventControlAddedSubControl

kControlMsgSubControlAdded

kEventControlRemovingSubControl

kControlMsgSubControlRemoved

kEventControlArbitraryMessage

Anything sent using SendControlMessage

kEventWindowGetClickActivation (of event class kEventClassWindow)

kControlMsgGetClickActivation

Some control messages are no longer supported, as shown in Table A-4

Table A-4  Unsupported CDEF messages

Message

Why no Carbon event equivalent

calcCRgns

Obsolete. Use kControlMsgGetRegion instead.

autoTrack

Use kControlMsgHandleTracking instead.

dragCntl

Obsolete. No one needs to use this anymore.

drawThumbOutline

Obsolete. Use kControlDrawMsgGhost, kControlMsgCalcValueFromPos, and posCntl instead.

kControlMsgKeyDown

Only marginal support available in Mac OS X using kEventControlArbitraryMessage. Use kEventTextInput class of Carbon events instead.

kControlMsgIdle

Only marginal support available in Mac OS X using kEventControlArbitraryMessage. The CDEF should install a timer instead.

kControlMsgSubValueChanged

Only marginal support available in Mac OS X using kEventControlArbitraryMessage. CDEF should install kEventControlValueFieldChanged on its children instead.

kControlMsgFlatten

Obsolete. Never implementted.