Mac OS 9
CarbonEvents.h File Reference

Carbon Event Manager. More...

#include <Events.h>
#include <Menus.h>
#include <Controls.h>
#include <MacWindows.h>
#include <CFString.h>
#include <AERegistry.h>
#include <AEDataModel.h>

Go to the source code of this file.

Data Structures

struct  EventTypeSpec
 
struct  HIPoint
 
struct  HICommand
 
struct  TabletPointRec
 
struct  TabletProximityRec
 
struct  EventHotKeyID
 

Macros

#define kEventDurationSecond   ((EventTime)1.0)
 
#define kEventDurationMillisecond   ((EventTime)(kEventDurationSecond / 1000))
 
#define kEventDurationMicrosecond   ((EventTime)(kEventDurationSecond / 1000000))
 
#define kEventDurationNanosecond    ((EventTime)(kEventDurationSecond / 1000000000))
 
#define kEventDurationMinute   ((EventTime)(kEventDurationSecond * 60))
 
#define kEventDurationHour   ((EventTime)(kEventDurationMinute * 60))
 
#define kEventDurationDay   ((EventTime)(kEventDurationHour * 24))
 
#define kEventDurationNoWait   ((EventTime)0.0)
 
#define kEventDurationForever   ((EventTime)(-1.0))
 
#define TicksToEventTime(t)   ((EventTime)((t) / 60.0))
 
#define EventTimeToTicks(t)   ((UInt32)(((t) * 60) + 0.5))
 
#define GetEventTypeCount(t)   (sizeof((t)) / sizeof(EventTypeSpec))
 
#define NewEventComparatorUPP(userRoutine)
 
#define DisposeEventComparatorUPP(userUPP)   DisposeRoutineDescriptor(userUPP)
 
#define InvokeEventComparatorUPP(inEvent, inCompareData, userUPP)
 
#define NewEventComparatorProc(userRoutine)   NewEventComparatorUPP(userRoutine)
 
#define CallEventComparatorProc(userRoutine, inEvent, inCompareData)    InvokeEventComparatorUPP(inEvent, inCompareData, userRoutine)
 
#define NewEventLoopTimerUPP(userRoutine)
 
#define DisposeEventLoopTimerUPP(userUPP)   DisposeRoutineDescriptor(userUPP)
 
#define InvokeEventLoopTimerUPP(inTimer, inUserData, userUPP)
 
#define NewEventLoopTimerProc(userRoutine)   NewEventLoopTimerUPP(userRoutine)
 
#define CallEventLoopTimerProc(userRoutine, inTimer, inUserData)    InvokeEventLoopTimerUPP(inTimer, inUserData, userRoutine)
 
#define NewEventHandlerUPP(userRoutine)
 
#define DisposeEventHandlerUPP(userUPP)   DisposeRoutineDescriptor(userUPP)
 
#define InvokeEventHandlerUPP(inHandlerCallRef, inEvent, inUserData, userUPP)
 
#define NewEventHandlerProc(userRoutine)   NewEventHandlerUPP(userRoutine)
 
#define CallEventHandlerProc(userRoutine, inHandlerCallRef, inEvent, inUserData)    InvokeEventHandlerUPP(inHandlerCallRef, inEvent, inUserData, userRoutine)
 
#define InstallApplicationEventHandler(h, n, l, u, r)    InstallEventHandler(GetApplicationEventTarget(), (h), (n), (l), (u), (r))
 
#define InstallWindowEventHandler(t, h, n, l, u, r)    InstallEventHandler(GetWindowEventTarget(t), (h), (n), (l), (u), (r))
 
#define InstallControlEventHandler(t, h, n, l, u, r)    InstallEventHandler(GetControlEventTarget(t), (h), (n), (l), (u), (r))
 
#define InstallMenuEventHandler(t, h, n, l, u, r)    InstallEventHandler(GetMenuEventTarget(t), (h), (n), (l), (u), (r))
 
#define DEFINE_ONE_SHOT_HANDLER_GETTER(x)
 
#define SendEventToApplication(e)    SendEventToEventTarget((e), GetApplicationEventTarget())
 
#define SendEventToWindow(e, t)    SendEventToEventTarget((e), GetWindowEventTarget(t))
 
#define SendEventToControl(e, t)    SendEventToEventTarget((e), GetControlEventTarget(t))
 
#define SendEventToMenu(e, t)   SendEventToEventTarget((e), GetMenuEventTarget(t))
 
#define SendEventToUserFocus(e)    SendEventToEventTarget((e), GetUserFocusEventTarget())
 

Typedefs

typedef SInt16 EventPriority
 
typedef double EventTime
 
typedef EventTime EventTimeout
 
typedef EventTime EventTimerInterval
 
typedef struct EventTypeSpec EventTypeSpec
 
typedef UInt16 MouseTrackingResult
 
typedef OSType EventParamName
 
typedef OSType EventParamType
 
typedef struct OpaqueEventLoopRef * EventLoopRef
 
typedef UInt32 EventAttributes
 
typedef struct OpaqueEventQueueRef * EventQueueRef
 
typedef void * inCompareData
 
typedef struct OpaqueEventLoopTimerRef * EventLoopTimerRef
 
typedef void * inUserData
 
typedef struct HIPoint HIPoint
 
typedef UInt16 EventMouseButton
 
typedef UInt16 EventMouseWheelAxis
 
typedef struct HICommand HICommand
 
typedef struct TabletPointRec TabletPointRec
 
typedef TabletPointRec TabletPointerRec
 
typedef struct TabletProximityRec TabletProximityRec
 
typedef struct OpaqueEventHandlerRef * EventHandlerRef
 
typedef struct OpaqueEventHandlerCallRef * EventHandlerCallRef
 
typedef EventRef inEvent
 
typedef struct OpaqueEventTargetRef * EventTargetRef
 
typedef struct OpaqueToolboxObjectClassRef * ToolboxObjectClassRef
 
typedef struct EventHotKeyID EventHotKeyID
 
typedef struct OpaqueEventHotKeyRef * EventHotKeyRef
 

Enumerations

enum  {
  eventAlreadyPostedErr = -9860 , eventTargetBusyErr = -9861 , eventClassInvalidErr = -9862 , eventClassIncorrectErr = -9864 ,
  eventHandlerAlreadyInstalledErr = -9866 , eventInternalErr = -9868 , eventKindIncorrectErr = -9869 , eventParameterNotFoundErr = -9870 ,
  eventNotHandledErr = -9874 , eventLoopTimedOutErr = -9875 , eventLoopQuitErr = -9876 , eventNotInQueueErr = -9877 ,
  eventHotKeyExistsErr = -9878 , eventHotKeyInvalidErr = -9879
}
 
enum  { kEventPriorityLow = 0 , kEventPriorityStandard = 1 , kEventPriorityHigh = 2 }
 
enum  { kEventLeaveInQueue = false , kEventRemoveFromQueue = true }
 
enum  { kTrackMouseLocationOptionDontConsumeMouseUp = (1 << 0) }
 
enum  {
  kMouseTrackingMouseDown = 1 , kMouseTrackingMouseUp = 2 , kMouseTrackingMouseExited = 3 , kMouseTrackingMouseEntered = 4 ,
  kMouseTrackingMouseDragged = 5 , kMouseTrackingKeyModifiersChanged = 6 , kMouseTrackingUserCancelled = 7 , kMouseTrackingTimedOut = 8
}
 
enum  { kEventAttributeNone = 0 , kEventAttributeUserEvent = (1 << 0) }
 
enum  { uppEventComparatorProcInfo = 0x000003D0 }
 
enum  { uppEventLoopTimerProcInfo = 0x000003C0 }
 
enum  {
  kEventClassMouse = FOUR_CHAR_CODE('mous') , kEventClassKeyboard = FOUR_CHAR_CODE('keyb') , kEventClassTextInput = FOUR_CHAR_CODE('text') , kEventClassApplication = FOUR_CHAR_CODE('appl') ,
  kEventClassAppleEvent = FOUR_CHAR_CODE('eppc') , kEventClassMenu = FOUR_CHAR_CODE('menu') , kEventClassWindow = FOUR_CHAR_CODE('wind') , kEventClassControl = FOUR_CHAR_CODE('cntl') ,
  kEventClassCommand = FOUR_CHAR_CODE('cmds') , kEventClassTablet = FOUR_CHAR_CODE('tblt') , kEventClassVolume = FOUR_CHAR_CODE('vol ') , kEventClassAppearance = FOUR_CHAR_CODE('appm') ,
  kEventClassService = FOUR_CHAR_CODE('serv')
}
 
enum  {
  kEventMouseDown = 1 , kEventMouseUp = 2 , kEventMouseMoved = 5 , kEventMouseDragged = 6 ,
  kEventMouseWheelMoved = 10
}
 
enum  { kEventMouseButtonPrimary = 1 , kEventMouseButtonSecondary = 2 , kEventMouseButtonTertiary = 3 }
 
enum  { kEventMouseWheelAxisX = 0 , kEventMouseWheelAxisY = 1 }
 
enum  {
  kEventTextInputUpdateActiveInputArea = 1 , kEventTextInputUnicodeForKeyEvent = 2 , kEventTextInputOffsetToPos = 3 , kEventTextInputPosToOffset = 4 ,
  kEventTextInputShowHideBottomWindow = 5 , kEventTextInputGetSelectedText = 6
}
 
enum  {
  kEventRawKeyDown = 1 , kEventRawKeyRepeat = 2 , kEventRawKeyUp = 3 , kEventRawKeyModifiersChanged = 4 ,
  kEventHotKeyPressed = 5 , kEventHotKeyReleased = 6
}
 
enum  { kEventKeyModifierNumLockBit = 16 , kEventKeyModifierFnBit = 17 }
 
enum  { kEventKeyModifierNumLockMask = 1L << kEventKeyModifierNumLockBit , kEventKeyModifierFnMask = 1L << kEventKeyModifierFnBit }
 
enum  {
  kEventAppActivated = 1 , kEventAppDeactivated = 2 , kEventAppQuit = 3 , kEventAppLaunchNotification = 4 ,
  kEventAppLaunched = 5 , kEventAppTerminated = 6 , kEventAppFrontSwitched = 7 , kEventAppGetDockTileMenu = 20
}
 
enum  { kEventAppleEvent = 1 }
 
enum  { kEventWindowUpdate = 1 , kEventWindowDrawContent = 2 }
 
enum  { kEventWindowActivated = 5 , kEventWindowDeactivated = 6 , kEventWindowGetClickActivation = 7 }
 
enum  {
  kEventWindowShowing = 22 , kEventWindowHiding = 23 , kEventWindowShown = 24 , kEventWindowHidden = 25 ,
  kEventWindowBoundsChanging = 26 , kEventWindowBoundsChanged = 27 , kEventWindowResizeStarted = 28 , kEventWindowResizeCompleted = 29 ,
  kEventWindowDragStarted = 30 , kEventWindowDragCompleted = 31
}
 
enum  { kWindowBoundsChangeUserDrag = (1 << 0) , kWindowBoundsChangeUserResize = (1 << 1) , kWindowBoundsChangeSizeChanged = (1 << 2) , kWindowBoundsChangeOriginChanged = (1 << 3) }
 
enum  {
  kEventWindowClickDragRgn = 32 , kEventWindowClickResizeRgn = 33 , kEventWindowClickCollapseRgn = 34 , kEventWindowClickCloseRgn = 35 ,
  kEventWindowClickZoomRgn = 36 , kEventWindowClickContentRgn = 37 , kEventWindowClickProxyIconRgn = 38 , kEventWindowClickToolbarButtonRgn = 41 ,
  kEventWindowClickStructureRgn = 42
}
 
enum  { kEventWindowCursorChange = 40 }
 
enum  {
  kEventWindowCollapse = 66 , kEventWindowCollapsed = 67 , kEventWindowCollapseAll = 68 , kEventWindowExpand = 69 ,
  kEventWindowExpanded = 70 , kEventWindowExpandAll = 71 , kEventWindowClose = 72 , kEventWindowClosed = 73 ,
  kEventWindowCloseAll = 74 , kEventWindowZoom = 75 , kEventWindowZoomed = 76 , kEventWindowZoomAll = 77 ,
  kEventWindowContextualMenuSelect = 78 , kEventWindowPathSelect = 79 , kEventWindowGetIdealSize = 80 , kEventWindowGetMinimumSize = 81 ,
  kEventWindowGetMaximumSize = 82 , kEventWindowConstrain = 83 , kEventWindowHandleContentClick = 85 , kEventWindowProxyBeginDrag = 128 ,
  kEventWindowProxyEndDrag = 129 , kEventWindowToolbarSwitchMode = 150
}
 
enum  { kEventWindowFocusAcquired = 200 , kEventWindowFocusRelinquish = 201 }
 
enum  {
  kEventWindowDrawFrame = 1000 , kEventWindowDrawPart = 1001 , kEventWindowGetRegion = 1002 , kEventWindowHitTest = 1003 ,
  kEventWindowInit = 1004 , kEventWindowDispose = 1005 , kEventWindowDragHilite = 1006 , kEventWindowModified = 1007 ,
  kEventWindowSetupProxyDragImage = 1008 , kEventWindowStateChanged = 1009 , kEventWindowMeasureTitle = 1010 , kEventWindowDrawGrowBox = 1011 ,
  kEventWindowGetGrowImageRegion = 1012 , kEventWindowPaint = 1013
}
 
enum  {
  kEventMenuBeginTracking = 1 , kEventMenuEndTracking = 2 , kEventMenuChangeTrackingMode = 3 , kEventMenuOpening = 4 ,
  kEventMenuClosed = 5 , kEventMenuTargetItem = 6 , kEventMenuMatchKey = 7 , kEventMenuEnableItems = 8 ,
  kEventMenuPopulate = 9 , kEventMenuMeasureItemWidth = 100 , kEventMenuMeasureItemHeight = 101 , kEventMenuDrawItem = 102 ,
  kEventMenuDrawItemContent = 103 , kEventMenuDispose = 1001
}
 
enum  {
  kMenuContextMenuBar = 1 << 0 , kMenuContextPullDown = 1 << 8 , kMenuContextPopUp = 1 << 9 , kMenuContextSubmenu = 1 << 10 ,
  kMenuContextMenuBarTracking = 1 << 16 , kMenuContextPopUpTracking = 1 << 17 , kMenuContextKeyMatching = 1 << 18 , kMenuContextMenuEnabling = 1 << 19
}
 
enum  { kEventProcessCommand = 1 , kEventCommandProcess = 1 , kEventCommandUpdateStatus = 2 }
 
enum  {
  kHICommandOK = FOUR_CHAR_CODE('ok ') , kHICommandCancel = FOUR_CHAR_CODE('not!') , kHICommandQuit = FOUR_CHAR_CODE('quit') , kHICommandUndo = FOUR_CHAR_CODE('undo') ,
  kHICommandRedo = FOUR_CHAR_CODE('redo') , kHICommandCut = FOUR_CHAR_CODE('cut ') , kHICommandCopy = FOUR_CHAR_CODE('copy') , kHICommandPaste = FOUR_CHAR_CODE('past') ,
  kHICommandClear = FOUR_CHAR_CODE('clea') , kHICommandSelectAll = FOUR_CHAR_CODE('sall') , kHICommandHide = FOUR_CHAR_CODE('hide') , kHICommandHideOthers = FOUR_CHAR_CODE('hido') ,
  kHICommandShowAll = FOUR_CHAR_CODE('shal') , kHICommandPreferences = FOUR_CHAR_CODE('pref') , kHICommandZoomWindow = FOUR_CHAR_CODE('zoom') , kHICommandMinimizeWindow = FOUR_CHAR_CODE('mini') ,
  kHICommandMinimizeAll = FOUR_CHAR_CODE('mina') , kHICommandMaximizeWindow = FOUR_CHAR_CODE('maxi') , kHICommandMaximizeAll = FOUR_CHAR_CODE('maxa') , kHICommandArrangeInFront = FOUR_CHAR_CODE('frnt') ,
  kHICommandBringAllToFront = FOUR_CHAR_CODE('bfrt') , kHICommandWindowListSeparator = FOUR_CHAR_CODE('wldv') , kHICommandWindowListTerminator = FOUR_CHAR_CODE('wlst') , kHICommandSelectWindow = FOUR_CHAR_CODE('swin') ,
  kHICommandAbout = FOUR_CHAR_CODE('abou') , kHICommandNew = FOUR_CHAR_CODE('new ') , kHICommandOpen = FOUR_CHAR_CODE('open') , kHICommandClose = FOUR_CHAR_CODE('clos') ,
  kHICommandSave = FOUR_CHAR_CODE('save') , kHICommandSaveAs = FOUR_CHAR_CODE('svas') , kHICommandRevert = FOUR_CHAR_CODE('rvrt') , kHICommandPrint = FOUR_CHAR_CODE('prnt') ,
  kHICommandPageSetup = FOUR_CHAR_CODE('page') , kHICommandAppHelp = FOUR_CHAR_CODE('ahlp')
}
 
enum  { kHICommandFromMenu = (1L << 0) }
 
enum  {
  kEventControlInitialize = 1000 , kEventControlDispose = 1001 , kEventControlGetOptimalBounds = 1003 , kEventControlDefInitialize = kEventControlInitialize ,
  kEventControlDefDispose = kEventControlDispose , kEventControlHit = 1 , kEventControlSimulateHit = 2 , kEventControlHitTest = 3 ,
  kEventControlDraw = 4 , kEventControlApplyBackground = 5 , kEventControlApplyTextColor = 6 , kEventControlSetFocusPart = 7 ,
  kEventControlGetFocusPart = 8 , kEventControlActivate = 9 , kEventControlDeactivate = 10 , kEventControlSetCursor = 11 ,
  kEventControlContextualMenuClick = 12 , kEventControlClick = 13 , kEventControlTrack = 51 , kEventControlGetScrollToHereStartPoint = 52 ,
  kEventControlGetIndicatorDragConstraint = 53 , kEventControlIndicatorMoved = 54 , kEventControlGhostingFinished = 55 , kEventControlGetActionProcPart = 56 ,
  kEventControlGetPartRegion = 101 , kEventControlGetPartBounds = 102 , kEventControlSetData = 103 , kEventControlGetData = 104 ,
  kEventControlValueFieldChanged = 151 , kEventControlAddedSubControl = 152 , kEventControlRemovingSubControl = 153 , kEventControlBoundsChanged = 154 ,
  kEventControlOwningWindowChanged = 159 , kEventControlArbitraryMessage = 201
}
 
enum  { kControlBoundsChangeSizeChanged = (1 << 2) , kControlBoundsChangePositionChanged = (1 << 3) }
 
enum  { kEventTabletPoint = 1 , kEventTabletProximity = 2 , kEventTabletPointer }
 
enum  { kEventVolumeMounted = 1 , kEventVolumeUnmounted = 2 }
 
enum  { typeFSVolumeRefNum = FOUR_CHAR_CODE('voln') }
 
enum  { kEventAppearanceScrollBarVariantChanged = 1 }
 
enum  { kEventServiceCopy = 1 , kEventServicePaste = 2 , kEventServiceGetTypes = 3 , kEventServicePerform = 4 }
 
enum  { kEventParamDirectObject }
 
enum  {
  kEventParamWindowRef = FOUR_CHAR_CODE('wind') , kEventParamGrafPort = FOUR_CHAR_CODE('graf') , kEventParamDragRef = FOUR_CHAR_CODE('drag') , kEventParamMenuRef = FOUR_CHAR_CODE('menu') ,
  kEventParamEventRef = FOUR_CHAR_CODE('evnt') , kEventParamControlRef = FOUR_CHAR_CODE('ctrl') , kEventParamRgnHandle = FOUR_CHAR_CODE('rgnh') , kEventParamEnabled = FOUR_CHAR_CODE('enab') ,
  kEventParamDimensions = FOUR_CHAR_CODE('dims') , kEventParamAvailableBounds = FOUR_CHAR_CODE('avlb') , kEventParamAEEventID = keyAEEventID , kEventParamAEEventClass = keyAEEventClass ,
  kEventParamCGContextRef = FOUR_CHAR_CODE('cntx') , kEventParamDeviceDepth = FOUR_CHAR_CODE('devd') , kEventParamDeviceColor = FOUR_CHAR_CODE('devc') , typeWindowRef = FOUR_CHAR_CODE('wind') ,
  typeGrafPtr = FOUR_CHAR_CODE('graf') , typeGWorldPtr = FOUR_CHAR_CODE('gwld') , typeDragRef = FOUR_CHAR_CODE('drag') , typeMenuRef = FOUR_CHAR_CODE('menu') ,
  typeControlRef = FOUR_CHAR_CODE('ctrl') , typeCollection = FOUR_CHAR_CODE('cltn') , typeQDRgnHandle = FOUR_CHAR_CODE('rgnh') , typeOSStatus = FOUR_CHAR_CODE('osst') ,
  typeCFStringRef = FOUR_CHAR_CODE('cfst') , typeCGContextRef = FOUR_CHAR_CODE('cntx') , typeHIPoint = FOUR_CHAR_CODE('hipt')
}
 
enum  {
  kEventParamMouseLocation = FOUR_CHAR_CODE('mloc') , kEventParamMouseButton = FOUR_CHAR_CODE('mbtn') , kEventParamClickCount = FOUR_CHAR_CODE('ccnt') , kEventParamMouseWheelAxis = FOUR_CHAR_CODE('mwax') ,
  kEventParamMouseWheelDelta = FOUR_CHAR_CODE('mwdl') , kEventParamMouseDelta = FOUR_CHAR_CODE('mdta') , kEventParamMouseChord = FOUR_CHAR_CODE('chor') , kEventParamTabletEventType = FOUR_CHAR_CODE('tblt') ,
  typeMouseButton = FOUR_CHAR_CODE('mbtn') , typeMouseWheelAxis = FOUR_CHAR_CODE('mwax')
}
 
enum  {
  kEventParamKeyCode = FOUR_CHAR_CODE('kcod') , kEventParamKeyMacCharCodes = FOUR_CHAR_CODE('kchr') , kEventParamKeyModifiers = FOUR_CHAR_CODE('kmod') , kEventParamKeyUnicodes = FOUR_CHAR_CODE('kuni') ,
  kEventParamKeyboardType = FOUR_CHAR_CODE('kbdt') , typeEventHotKeyID = FOUR_CHAR_CODE('hkid')
}
 
enum  {
  kEventParamTextInputSendRefCon , kEventParamTextInputSendComponentInstance , kEventParamTextInputSendSLRec , kEventParamTextInputReplySLRec ,
  kEventParamTextInputSendText , kEventParamTextInputReplyText , kEventParamTextInputSendUpdateRng , kEventParamTextInputSendHiliteRng ,
  kEventParamTextInputSendClauseRng , kEventParamTextInputSendPinRng = FOUR_CHAR_CODE('tspn') , kEventParamTextInputSendFixLen , kEventParamTextInputSendLeadingEdge ,
  kEventParamTextInputReplyLeadingEdge , kEventParamTextInputSendTextOffset , kEventParamTextInputReplyTextOffset , kEventParamTextInputReplyRegionClass ,
  kEventParamTextInputSendCurrentPoint , kEventParamTextInputSendDraggingMode , kEventParamTextInputReplyPoint = FOUR_CHAR_CODE('trpt') , kEventParamTextInputReplyFont ,
  kEventParamTextInputReplyFMFont = FOUR_CHAR_CODE('trfm') , kEventParamTextInputReplyPointSize = FOUR_CHAR_CODE('trpz') , kEventParamTextInputReplyLineHeight , kEventParamTextInputReplyLineAscent ,
  kEventParamTextInputReplyTextAngle = FOUR_CHAR_CODE('trta') , kEventParamTextInputSendShowHide = FOUR_CHAR_CODE('tssh') , kEventParamTextInputReplyShowHide , kEventParamTextInputSendKeyboardEvent ,
  kEventParamTextInputSendTextServiceEncoding , kEventParamTextInputSendTextServiceMacEncoding
}
 
enum  { kEventParamHICommand = FOUR_CHAR_CODE('hcmd') , typeHICommand = FOUR_CHAR_CODE('hcmd') }
 
enum  {
  kEventParamWindowFeatures = FOUR_CHAR_CODE('wftr') , kEventParamWindowDefPart = FOUR_CHAR_CODE('wdpc') , kEventParamCurrentBounds = FOUR_CHAR_CODE('crct') , kEventParamOriginalBounds = FOUR_CHAR_CODE('orct') ,
  kEventParamPreviousBounds = FOUR_CHAR_CODE('prct') , kEventParamClickActivation , kEventParamWindowRegionCode , kEventParamWindowDragHiliteFlag = FOUR_CHAR_CODE('wdhf') ,
  kEventParamWindowModifiedFlag = FOUR_CHAR_CODE('wmff') , kEventParamWindowProxyGWorldPtr = FOUR_CHAR_CODE('wpgw') , kEventParamWindowProxyImageRgn = FOUR_CHAR_CODE('wpir') , kEventParamWindowProxyOutlineRgn ,
  kEventParamWindowStateChangedFlags = FOUR_CHAR_CODE('wscf') , kEventParamWindowTitleFullWidth = FOUR_CHAR_CODE('wtfw') , kEventParamWindowTitleTextWidth = FOUR_CHAR_CODE('wttw') , kEventParamWindowGrowRect = FOUR_CHAR_CODE('grct') ,
  kEventParamAttributes = FOUR_CHAR_CODE('attr') , typeWindowRegionCode = FOUR_CHAR_CODE('wshp') , typeWindowDefPartCode = FOUR_CHAR_CODE('wdpt') , typeClickActivationResult = FOUR_CHAR_CODE('clac')
}
 
enum  {
  kEventParamControlPart = FOUR_CHAR_CODE('cprt') , kEventParamInitCollection = FOUR_CHAR_CODE('icol') , kEventParamControlMessage = FOUR_CHAR_CODE('cmsg') , kEventParamControlParam = FOUR_CHAR_CODE('cprm') ,
  kEventParamControlResult = FOUR_CHAR_CODE('crsl') , kEventParamControlRegion = FOUR_CHAR_CODE('crgn') , kEventParamControlAction = FOUR_CHAR_CODE('caup') , kEventParamControlIndicatorDragConstraint ,
  kEventParamControlIndicatorRegion , kEventParamControlIsGhosting = FOUR_CHAR_CODE('cgst') , kEventParamControlIndicatorOffset = FOUR_CHAR_CODE('ciof') , kEventParamControlClickActivationResult ,
  kEventParamControlSubControl = FOUR_CHAR_CODE('csub') , kEventParamControlOptimalBounds = FOUR_CHAR_CODE('cobn') , kEventParamControlOptimalBaselineOffset , kEventParamControlDataTag = FOUR_CHAR_CODE('cdtg') ,
  kEventParamControlDataBuffer = FOUR_CHAR_CODE('cdbf') , kEventParamControlDataBufferSize , kEventParamControlDrawDepth = FOUR_CHAR_CODE('cddp') , kEventParamControlDrawInColor = FOUR_CHAR_CODE('cdic') ,
  kEventParamControlFeatures = FOUR_CHAR_CODE('cftr') , kEventParamControlPartBounds = FOUR_CHAR_CODE('cpbd') , kEventParamControlOriginalOwningWindow , kEventParamControlCurrentOwningWindow ,
  typeControlActionUPP = FOUR_CHAR_CODE('caup') , typeIndicatorDragConstraint , typeControlPartCode = FOUR_CHAR_CODE('cprt')
}
 
enum  {
  kEventParamCurrentMenuTrackingMode , kEventParamNewMenuTrackingMode , kEventParamMenuFirstOpen = FOUR_CHAR_CODE('1sto') , kEventParamMenuItemIndex = FOUR_CHAR_CODE('item') ,
  kEventParamMenuCommand = FOUR_CHAR_CODE('mcmd') , kEventParamEnableMenuForKeyEvent = FOUR_CHAR_CODE('fork') , kEventParamMenuEventOptions , kEventParamMenuContext = FOUR_CHAR_CODE('mctx') ,
  kEventParamMenuItemBounds = FOUR_CHAR_CODE('mitb') , kEventParamMenuMarkBounds = FOUR_CHAR_CODE('mmkb') , kEventParamMenuIconBounds = FOUR_CHAR_CODE('micb') , kEventParamMenuTextBounds = FOUR_CHAR_CODE('mtxb') ,
  kEventParamMenuTextBaseline = FOUR_CHAR_CODE('mtbl') , kEventParamMenuCommandKeyBounds = FOUR_CHAR_CODE('mcmb') , kEventParamMenuVirtualTop = FOUR_CHAR_CODE('mvrt') , kEventParamMenuVirtualBottom = FOUR_CHAR_CODE('mvrb') ,
  kEventParamMenuDrawState = FOUR_CHAR_CODE('mdrs') , kEventParamMenuItemType = FOUR_CHAR_CODE('mitp') , kEventParamMenuItemWidth = FOUR_CHAR_CODE('mitw') , kEventParamMenuItemHeight = FOUR_CHAR_CODE('mith') ,
  typeMenuItemIndex = FOUR_CHAR_CODE('midx') , typeMenuCommand = FOUR_CHAR_CODE('mcmd') , typeMenuTrackingMode = FOUR_CHAR_CODE('mtmd') , typeMenuEventOptions = FOUR_CHAR_CODE('meop') ,
  typeThemeMenuState = FOUR_CHAR_CODE('tmns') , typeThemeMenuItemType = FOUR_CHAR_CODE('tmit')
}
 
enum  { kEventParamProcessID = FOUR_CHAR_CODE('psn ') , kEventParamLaunchRefCon = FOUR_CHAR_CODE('lref') , kEventParamLaunchErr = FOUR_CHAR_CODE('err ') }
 
enum  {
  kEventParamTabletPointRec = FOUR_CHAR_CODE('tbrc') , kEventParamTabletProximityRec , typeTabletPointRec = FOUR_CHAR_CODE('tbrc') , typeTabletProximityRec ,
  kEventParamTabletPointerRec , typeTabletPointerRec
}
 
enum  { kEventParamNewScrollBarVariant = FOUR_CHAR_CODE('nsbv') }
 
enum  {
  kEventParamScrapRef = FOUR_CHAR_CODE('scrp') , kEventParamServiceCopyTypes , kEventParamServicePasteTypes , kEventParamServiceMessageName ,
  kEventParamServiceUserData = FOUR_CHAR_CODE('svud') , typeScrapRef = FOUR_CHAR_CODE('scrp') , typeCFMutableArrayRef = FOUR_CHAR_CODE('cfma')
}
 
enum  { uppEventHandlerProcInfo = 0x00000FF0 }
 
enum  { kUserFocusAuto = -1 }
 
enum  { kMouseTrackingMousePressed = kMouseTrackingMouseDown , kMouseTrackingMouseReleased = kMouseTrackingMouseUp , kMouseTrackingMouseMoved = kMouseTrackingMouseDragged }
 

Functions

EventLoopRef GetCurrentEventLoop (void)
 
EventLoopRef GetMainEventLoop (void)
 
OSStatus RunCurrentEventLoop (EventTimeout inTimeout)
 
OSStatus QuitEventLoop (EventLoopRef inEventLoop)
 
CFTypeRef GetCFRunLoopFromEventLoop (EventLoopRef inEventLoop)
 
OSStatus ReceiveNextEvent (UInt32 inNumTypes, const EventTypeSpec *inList, EventTimeout inTimeout, Boolean inPullEvent, EventRef *outEvent)
 
OSStatus MacCreateEvent (CFAllocatorRef inAllocator, UInt32 inClassID, UInt32 kind, EventTime when, EventAttributes flags, EventRef *outEvent)
 
EventRef CopyEvent (EventRef inOther)
 
EventRef RetainEvent (EventRef inEvent)
 
UInt32 GetEventRetainCount (EventRef inEvent)
 
void ReleaseEvent (EventRef inEvent)
 
OSStatus SetEventParameter (EventRef inEvent, EventParamName inName, EventParamType inType, UInt32 inSize, const void *inDataPtr)
 
OSStatus GetEventParameter (EventRef inEvent, EventParamName inName, EventParamType inDesiredType, EventParamType *outActualType, UInt32 inBufferSize, UInt32 *outActualSize, void *outData)
 
UInt32 GetEventClass (EventRef inEvent)
 
UInt32 GetEventKind (EventRef inEvent)
 
EventTime GetEventTime (EventRef inEvent)
 
OSStatus SetEventTime (EventRef inEvent, EventTime inTime)
 
EventQueueRef GetCurrentEventQueue (void)
 
EventQueueRef GetMainEventQueue (void)
 
typedef CALLBACK_API (Boolean, EventComparatorProcPtr)(EventRef inEvent
 
typedef STACK_UPP_TYPE (EventComparatorProcPtr) EventComparatorUPP
 
EventComparatorUPP NewEventComparatorUPP (EventComparatorProcPtr userRoutine)
 
void DisposeEventComparatorUPP (EventComparatorUPP userUPP)
 
Boolean InvokeEventComparatorUPP (EventRef inEvent, void *inCompareData, EventComparatorUPP userUPP)
 
OSStatus PostEventToQueue (EventQueueRef inQueue, EventRef inEvent, EventPriority inPriority)
 
OSStatus FlushEventsMatchingListFromQueue (EventQueueRef inQueue, UInt32 inNumTypes, const EventTypeSpec *inList)
 
OSStatus FlushSpecificEventsFromQueue (EventQueueRef inQueue, EventComparatorUPP inComparator, void *inCompareData)
 
OSStatus FlushEventQueue (EventQueueRef inQueue)
 
EventRef FindSpecificEventInQueue (EventQueueRef inQueue, EventComparatorUPP inComparator, void *inCompareData)
 
UInt32 GetNumEventsInQueue (EventQueueRef inQueue)
 
OSStatus RemoveEventFromQueue (EventQueueRef inQueue, EventRef inEvent)
 
Boolean IsEventInQueue (EventQueueRef inQueue, EventRef inEvent)
 
EventTime GetCurrentEventTime (void)
 
Boolean IsUserCancelEventRef (EventRef event)
 
OSStatus TrackMouseLocation (GrafPtr inPort, Point *outPt, MouseTrackingResult *outResult)
 
OSStatus TrackMouseLocationWithOptions (GrafPtr inPort, OptionBits inOptions, EventTimeout inTimeout, Point *outPt, UInt32 *outModifiers, MouseTrackingResult *outResult)
 
OSStatus TrackMouseRegion (GrafPtr inPort, RgnHandle inRegion, Boolean *ioWasInRgn, MouseTrackingResult *outResult)
 
Boolean ConvertEventRefToEventRecord (EventRef inEvent, EventRecord *outEvent)
 
Boolean IsEventInMask (EventRef inEvent, EventMask inMask)
 
EventTime GetLastUserEventTime (void)
 
Boolean IsMouseCoalescingEnabled (void)
 
OSStatus SetMouseCoalescingEnabled (Boolean inNewState, Boolean *outOldState)
 
typedef CALLBACK_API (void, EventLoopTimerProcPtr)(EventLoopTimerRef inTimer
 
typedef STACK_UPP_TYPE (EventLoopTimerProcPtr) EventLoopTimerUPP
 
EventLoopTimerUPP NewEventLoopTimerUPP (EventLoopTimerProcPtr userRoutine)
 
void DisposeEventLoopTimerUPP (EventLoopTimerUPP userUPP)
 
void InvokeEventLoopTimerUPP (EventLoopTimerRef inTimer, void *inUserData, EventLoopTimerUPP userUPP)
 
OSStatus InstallEventLoopTimer (EventLoopRef inEventLoop, EventTimerInterval inFireDelay, EventTimerInterval inInterval, EventLoopTimerUPP inTimerProc, void *inTimerData, EventLoopTimerRef *outTimer)
 
OSStatus RemoveEventLoopTimer (EventLoopTimerRef inTimer)
 
OSStatus SetEventLoopTimerNextFireTime (EventLoopTimerRef inTimer, EventTimerInterval inNextFire)
 
CFStringRef CreateTypeStringWithOSType (OSType inType)
 
typedef CALLBACK_API (OSStatus, EventHandlerProcPtr)(EventHandlerCallRef inHandlerCallRef
 
typedef STACK_UPP_TYPE (EventHandlerProcPtr) EventHandlerUPP
 
EventHandlerUPP NewEventHandlerUPP (EventHandlerProcPtr userRoutine)
 
void DisposeEventHandlerUPP (EventHandlerUPP userUPP)
 
OSStatus InvokeEventHandlerUPP (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData, EventHandlerUPP userUPP)
 
EventTargetRef GetWindowEventTarget (WindowRef inWindow)
 
EventTargetRef GetControlEventTarget (ControlRef inControl)
 
EventTargetRef GetMenuEventTarget (MenuRef inMenu)
 
EventTargetRef GetApplicationEventTarget (void)
 
EventTargetRef GetUserFocusEventTarget (void)
 
EventTargetRef GetEventDispatcherTarget (void)
 
OSStatus InstallEventHandler (EventTargetRef inTarget, EventHandlerUPP inHandler, UInt32 inNumTypes, const EventTypeSpec *inList, void *inUserData, EventHandlerRef *outRef)
 
OSStatus InstallStandardEventHandler (EventTargetRef inTarget)
 
OSStatus RemoveEventHandler (EventHandlerRef inHandlerRef)
 
OSStatus AddEventTypesToHandler (EventHandlerRef inHandlerRef, UInt32 inNumTypes, const EventTypeSpec *inList)
 
OSStatus RemoveEventTypesFromHandler (EventHandlerRef inHandlerRef, UInt32 inNumTypes, const EventTypeSpec *inList)
 
OSStatus CallNextEventHandler (EventHandlerCallRef inCallRef, EventRef inEvent)
 
OSStatus SendEventToEventTarget (EventRef inEvent, EventTargetRef inTarget)
 
OSStatus RegisterToolboxObjectClass (CFStringRef inClassID, ToolboxObjectClassRef inBaseClass, UInt32 inNumEvents, const EventTypeSpec *inEventList, EventHandlerUPP inEventHandler, void *inEventHandlerData, ToolboxObjectClassRef *outClassRef)
 
OSStatus UnregisterToolboxObjectClass (ToolboxObjectClassRef inClassRef)
 
OSStatus ProcessHICommand (const HICommand *inCommand)
 
void RunApplicationEventLoop (void)
 
void QuitApplicationEventLoop (void)
 
OSStatus RunAppModalLoopForWindow (WindowRef inWindow)
 
OSStatus QuitAppModalLoopForWindow (WindowRef inWindow)
 
OSStatus BeginAppModalStateForWindow (WindowRef inWindow)
 
OSStatus EndAppModalStateForWindow (WindowRef inWindow)
 
OSStatus SetUserFocusWindow (WindowRef inWindow)
 
WindowRef GetUserFocusWindow (void)
 
OSStatus SetWindowDefaultButton (WindowRef inWindow, ControlRef inControl)
 
OSStatus SetWindowCancelButton (WindowRef inWindow, ControlRef inControl)
 
OSStatus GetWindowDefaultButton (WindowRef inWindow, ControlRef *outControl)
 
OSStatus GetWindowCancelButton (WindowRef inWindow, ControlRef *outControl)
 
OSStatus RegisterEventHotKey (UInt32 inHotKeyCode, UInt32 inHotKeyModifiers, EventHotKeyID inHotKeyID, EventTargetRef inTarget, OptionBits inOptions, EventHotKeyRef *outRef)
 
OSStatus UnregisterEventHotKey (EventHotKeyRef inHotKey)
 

Detailed Description

Carbon Event Manager.

Introduced In: CarbonLib 1.5
Avaliable From: Universal Interfaces 3.4.1
Copyright: � 1999-2001 by Apple Computer, Inc., all rights reserved.

For bug reports, consult the following page on the World Wide Web:

http://developer.apple.com/bugreporter/

Macro Definition Documentation

◆ DEFINE_ONE_SHOT_HANDLER_GETTER

#define DEFINE_ONE_SHOT_HANDLER_GETTER (   x)
Value:
EventHandlerUPP Get##x##UPP() { \
static EventHandlerUPP sHandler = NULL; \
if (sHandler == NULL) \
sHandler = NewEventHandlerUPP(x); \
\
return sHandler; \
}
EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr userRoutine)
if(HiWord(mr)==FILE_MENU)
Close a desk accessory.
Definition: Devices.h:1342
#define NULL
Definition: MacTypes.h:61
x
Definition: ToolUtils.h:163

You can use the following macro in your code to allow you to set up an event handler lazily. You pass the name of your event handler in. You should use this with caution on Mac OS 9 systems since it could cause heap fragmentation.

◆ InvokeEventComparatorUPP

#define InvokeEventComparatorUPP (   inEvent,
  inCompareData,
  userUPP 
)
Value:
(Boolean) CALL_TWO_PARAMETER_UPP((userUPP), uppEventComparatorProcInfo, \
(inEvent), (inCompareData))
unsigned char Boolean
Definition: MacTypes.h:318

◆ InvokeEventHandlerUPP

#define InvokeEventHandlerUPP (   inHandlerCallRef,
  inEvent,
  inUserData,
  userUPP 
)
Value:
(OSStatus) \
CALL_THREE_PARAMETER_UPP((userUPP), uppEventHandlerProcInfo, \
(inHandlerCallRef), (inEvent), (inUserData))

◆ InvokeEventLoopTimerUPP

#define InvokeEventLoopTimerUPP (   inTimer,
  inUserData,
  userUPP 
)
Value:
CALL_TWO_PARAMETER_UPP((userUPP), uppEventLoopTimerProcInfo, (inTimer), \
(inUserData))

◆ NewEventComparatorUPP

#define NewEventComparatorUPP (   userRoutine)
Value:
(EventComparatorUPP) \
NewRoutineDescriptor((ProcPtr)(userRoutine), uppEventComparatorProcInfo, \
GetCurrentArchitecture())
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)

◆ NewEventHandlerUPP

#define NewEventHandlerUPP (   userRoutine)
Value:
(EventHandlerUPP) \
NewRoutineDescriptor((ProcPtr)(userRoutine), uppEventHandlerProcInfo, \
GetCurrentArchitecture())

◆ NewEventLoopTimerUPP

#define NewEventLoopTimerUPP (   userRoutine)
Value:
(EventLoopTimerUPP) \
NewRoutineDescriptor((ProcPtr)(userRoutine), uppEventLoopTimerProcInfo, \
GetCurrentArchitecture())

Typedef Documentation

◆ EventLoopRef

typedef struct OpaqueEventLoopRef* EventLoopRef

EventLoopRef

Discussion: An EventLoopRef represents an 'event loop', which is the conceptual entity that you 'run' to fetch events from hardware and other sources and also fires timers that might be installed with InstallEventLoopTimer. The term 'run' is a bit of a misnomer, as the event loop's goal is to stay as blocked as possible to minimize CPU usage for the current application. The event loop is run implicitly thru APIs like ReceiveNextEvent, RunApplicationEventLoop, or even WaitNextEvent. It can also be run explicitly thru a call to RunCurrentEventLoop. Each preemptive thread can have an event loop. Cooperative threads share the main thread's event loop.

◆ EventLoopTimerRef

typedef struct OpaqueEventLoopTimerRef* EventLoopTimerRef

EventLoopTimerRef

Discussion: An EventLoopTimerRef represents what we term a 'timer'. A timer is a function that is called either once or at regular intervals. It executes at task level and should not be confused with Time Manager Tasks or any other interrupt-level callback. This means you can call Toolbox routines, allocate memory and draw. When a timer 'fires', it calls a callback that you specify when the timer is installed. Timers in general have two uses - as a timeout mechanism and as a periodic task. An everyday example of using a timer for a timeout might be a light that goes out if no motion is detected in a room for 5 minutes. For this, you might install a timer which will fire in 5 minutes. If motion is detected, you would reset the timer fire time and let the clock start over. If no motion is detected for the full 5 minutes, the timer will fire and you could power off the light. A periodic timer is one that fires at regular intervals (say every second or so). You might use such a timer to blink the insertion point in your editor, etc. One advantage of timers is that you can install the timer right from the code that wants the time. For example, the standard Toolbox Edit Text control can install a timer to blink the cursor when it's active, meaning that IdleControls is a no-op for that control and doesn't need to be called. When the control is inactive, it removes its timer and doesn't waste CPU time in that state. NOTE: Currently, if you do decide to draw when your timer is called, be sure to save and restore the current port so that calling your timer doesn't inadvertently change the port out from under someone.

◆ EventMouseButton

typedef UInt16 EventMouseButton

Parameters for mouse events:

kEventMouseDown --> kEventParamMouseLocation typeHIPoint --> kEventParamKeyModifiers typeUInt32 --> kEventParamMouseButton typeMouseButton --> kEventParamClickCount typeUInt32 --> kEventParamMouseChord typeUInt32 (Mac OS X only) --> kEventParamTabletEventType typeUInt32 (Mac OS X 10.1, CarbonLib 1.5, and later) --> kEventParamTabletPointRec typeTabletPointRec (if kEventParamTabletEventType is kEventTabletPoint) --> kEventParamTabletProximityRec typeTabletProximityRec (if kEventParamTabletEventType is kEventTabletProximity)

kEventMouseUp --> kEventParamMouseLocation typeHIPoint --> kEventParamKeyModifiers typeUInt32 --> kEventParamMouseButton typeMouseButton --> kEventParamClickCount typeUInt32 --> kEventParamMouseChord typeUInt32 (Mac OS X only) --> kEventParamTabletEventType typeUInt32 (Mac OS X 10.1, CarbonLib 1.5, and later) --> kEventParamTabletPointRec typeTabletPointRec (if kEventParamTabletEventType is kEventTabletPoint) --> kEventParamTabletProximityRec typeTabletProximityRec (if kEventParamTabletEventType is kEventTabletProximity)

kEventMouseMoved --> kEventParamMouseLocation typeHIPoint --> kEventParamMouseDelta typeHIPoint (Mac OS X only) --> kEventParamKeyModifiers typeUInt32 --> kEventParamTabletEventType typeUInt32 (Mac OS X 10.1, CarbonLib 1.5, and later) --> kEventParamTabletPointRec typeTabletPointRec (if kEventParamTabletEventType is kEventTabletPoint) --> kEventParamTabletProximityRec typeTabletProximityRec (if kEventParamTabletEventType is kEventTabletProximity)

kEventMouseDragged --> kEventParamMouseLocation typeHIPoint --> kEventParamMouseDelta typeHIPoint (Mac OS X only) --> kEventParamKeyModifiers typeUInt32 --> kEventParamMouseButton typeMouseButton --> kEventParamMouseChord typeUInt32 (Mac OS X only) --> kEventParamTabletEventType typeUInt32 (Mac OS X 10.1, CarbonLib 1.5, and later) --> kEventParamTabletPointRec typeTabletPointRec (if kEventParamTabletEventType is kEventTabletPoint) --> kEventParamTabletProximityRec typeTabletProximityRec (if kEventParamTabletEventType is kEventTabletProximity)

kEventMouseWheelMoved --> kEventParamMouseLocation typeHIPoint --> kEventParamKeyModifiers typeUInt32 --> kEventParamMouseWheelAxis typeMouseWheelAxis --> kEventParamMouseWheelDelta typeLongInteger EventMouseButton

◆ EventMouseWheelAxis

typedef UInt16 EventMouseWheelAxis

EventMouseWheelAxis

◆ EventPriority

typedef SInt16 EventPriority

EventPriority

Discussion: These values define the relative priority of an event, and are used when posting events with PostEventToQueue. In general events are pulled from the queue in order of first posted to last posted. These priorities are a way to alter that when posting events. You can post a standard priority event and then a high priority event and the high priority event will be pulled from the queue first.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Discussion: The following are all errors which can be returned from the routines contained in this file.

Enumerator
eventAlreadyPostedErr 

This is returned from PostEventToQueue if the event in question is already in the queue you are posting it to (or any other queue).

eventTargetBusyErr 

You are attemtping to modify a target that is currently in use, such as when dispatching.

eventClassInvalidErr 

This is obsolete and will be removed.

eventClassIncorrectErr 

This is obsolete and will be removed.

eventHandlerAlreadyInstalledErr 

Returned from InstallEventHandler if the handler proc you pass is already installed for a given event type you are trying to register.

eventInternalErr 

A generic error.

eventKindIncorrectErr 

This is obsolete and will be removed.

eventParameterNotFoundErr 

The piece of data you are requesting from an event is not present.

eventNotHandledErr 

This is what you should return from an event handler when your handler has received an event it doesn't currently want to (or isn't able to) handle. If you handle an event, you should return noErr from your event handler.

eventLoopTimedOutErr 

The event loop has timed out. This can be returned from calls to ReceiveNextEvent or RunCurrentEventLoop.

eventLoopQuitErr 

The event loop was quit, probably by a call to QuitEventLoop. This can be returned from ReceiveNextEvent or RunCurrentEventLoop.

eventNotInQueueErr 

Returned from RemoveEventFromQueue when trying to remove an event that's not in any queue.

◆ anonymous enum

anonymous enum
Enumerator
kEventPriorityLow 

Lowest priority. Currently only window update events are posted at this priority.

kEventPriorityStandard 

Normal priority of events. Most events are standard priority.

kEventPriorityHigh 

Highest priority.

◆ anonymous enum

anonymous enum

Discussion: These are returned from calls to TrackMouseLocation and TrackMouseRegion. Those routines are designed as replacements to calls such as StillDown and WaitMouseUp. The advantage over those routines is that TrackMouseLocation and TrackMouseRegion will block if the user is not moving the mouse, whereas mouse tracking loops based on StillDown and WaitMouseUp will spin, chewing up valuable CPU time that could be better spent elsewhere. It is highly recommended that any tracking loops in your application stop using StillDown and WaitMouseUp and start using TrackMouseLocation/Region. See the notes on those routines for more information.

◆ anonymous enum

anonymous enum

Discussion: Event classes

Enumerator
kEventClassMouse 

Events related to the mouse (mouse down/up/moved).

kEventClassKeyboard 

Events related to the keyboard.

kEventClassTextInput 

Events related to text input (by keyboard, or by input method).

kEventClassApplication 

Application-level events (launch, quit, etc.).

kEventClassAppleEvent 

Apple Events.

kEventClassMenu 

Menu-related events.

kEventClassWindow 

Window-related events.

kEventClassControl 

Control-related events.

kEventClassCommand 

Command events (HICommands).

kEventClassTablet 

Events related to tablets.

kEventClassVolume 

Events related to File Manager volumes.

kEventClassAppearance 

Events related to the Appearance Manager.

kEventClassService 

Events related to the Services Manager.

◆ anonymous enum

anonymous enum

Discussion: Mouse events (kEventClassMouse)

Enumerator
kEventMouseDown 

A mouse button was pressed.

kEventMouseUp 

A mouse button was released.

kEventMouseMoved 

The mouse was moved.

kEventMouseDragged 

The mouse was moved, and a button was down.

kEventMouseWheelMoved 

The mouse wheel was moved. (Mac OS X only)

◆ anonymous enum

anonymous enum
Enumerator
kEventMouseButtonPrimary 

Only button for a one-button mouse (usually left button for multi-button mouse)

kEventMouseButtonSecondary 

Usually right button for a multi-button mouse

kEventMouseButtonTertiary 

Usually middle button for a three-button mouse

◆ anonymous enum

anonymous enum
Enumerator
kEventMouseWheelAxisX 

The X axis (left or right)

kEventMouseWheelAxisY 

The Y axis (up or down)

◆ anonymous enum

anonymous enum

Summary: Text input events (kEventClassTextInput)

Discussion: The following TextInput events reimplement the AppleEvents defined in Inside Mac Text - Text Services Manager, and provide the benefits of Carbon Event targeting, dispatching and propagation to applications that have formerly handled the TSM suite of AppleEvents. TextInput handlers may be installed on controls, windows, or the application event target (equivalent to AppleEvent-based handling). In all cases, if a given TextInput handler is not installed, TSM will convert that TextInput to an AppleEvent and redispatch via AESend to the current process, making adoption as gradual as is desired.

Enumerator
kEventTextInputUpdateActiveInputArea 

Tells the application/text engine to initiate/terminate or manage the content of inline input session.

kEventTextInputUnicodeForKeyEvent 

Unicode text resulting from a key event originated by TSM (not by an input method). A client need not be fully TSM-aware to process or receive this event, which has become the standard way of getting Unicode text from key events. You can also get Mac encoding characters from the raw keyboard event contained in this event. If no UnicodeForKeyEvent handler is installed, and no kUnicodeNotFromInputMethod AppleEvent handler is installed (or the application has not created a Unicode TSMDocument), the Mac encoding charCodes (if these can be converted from the Unicodes) are provided to WaitNextEvent.

kEventTextInputOffsetToPos 

Convert from inline session text offset to global QD Point. This event is typically be produced by an Input Method so that it can best position a palette "near" the text being operated on by the user.

kEventTextInputPosToOffset 

Convert from global QD point to inline session text offset. This event is typically produced by an input method to perform proper cursor management as the cursor moves over various subranges, or clauses of text (or the boundaries between these) in the inline input session.

kEventTextInputShowHideBottomWindow 

Show/Hide the bottom line input window. This event is produced by Input Methods to control the Text Services Manager bottom-line input window, and is not normally handled by an application.

kEventTextInputGetSelectedText 

Get the text selected (or character before/after insertion point based on leadingEdge parameter) from the application's text engine.

◆ anonymous enum

anonymous enum

Parameters for TextInput events:

kEventTextInputUpdateActiveInputArea Required parameters: --> kEventParamTextInputSendComponentInstance typeComponentInstance --> kEventParamTextInputSendRefCon typeLongInteger --> kEventParamTextInputSendSLRec typeIntlWritingCode --> kEventParamTextInputSendFixLen typeLongInteger --> kEventParamTextInputSendText typeUnicodeText, typeChar (data type depends on TSMDocument type created via NewTSMDocument... typeChar for kTextService document, typeUnicodeText for kUnicodeDocument)

 Optional parameters:
 -->     kEventParamTextInputSendUpdateRng typeTextRangeArray
 -->     kEventParamTextInputSendHiliteRng typeTextRangeArray
 -->     kEventParamTextInputSendClauseRng typeOffsetArray
 -->     kEventParamTextInputSendPinRng typeTextRange
 -->     kEventParamTextInputSendPinRng typeTextRange
 -->     kEventParamTextInputSendTextServiceEncoding         typeUInt32
 -->     kEventParamTextInputSendTextServiceMacEncoding      typeUInt32

kEventTextInputUnicodeForKeyEvent Required parameters: --> kEventParamTextInputSendComponentInstance typeComponentInstance --> kEventParamTextInputSendRefCon typeLongInteger --> kEventParamTextInputSendSLRec typeIntlWritingCode --> kEventParamTextInputSendText typeUnicodeText --> kEventParamTextInputSendKeyboardEvent typeEventRef (This parameter is the original raw keyboard event that produced the text. It enables access to kEventParamKeyModifiers and kEventParamKeyCode parameters. You can also extract from this event either Unicodes or Mac encoding characters as follows: kEventParamKeyUnicodes typeUnicodeText kEventParamKeyMacCharCodes typeChar (if available) The kEventParamKeyUnicodes parameter of the raw keyboard event is identical to the TextInput event's kEventParamTextInputSendText parameter. Note that when contents of TSM's bottom-line input window (i.e. during typing Chinese, Korean, or Japanese) are confirmed, the raw keyboard event's keyCode and modifiers are set to default values.)

kEventTextInputOffsetToPos Required parameters: --> kEventParamTextInputSendComponentInstance typeComponentInstance --> kEventParamTextInputSendRefCon typeLongInteger --> kEventParamTextInputSendTextOffset typeLongInteger <– kEventParamTextInputReplyPoint typeQDPoint

Optional parameters: --> kEventParamTextInputSendSLRec typeIntlWritingCode --> kEventParamTextInputSendLeadingEdge typeBoolean <– kEventParamTextInputReplySLRec typeIntlWritingCode <– kEventParamTextInputReplyFont typeLongInteger <– kEventParamTextInputReplyFMFont typeUInt32 <– kEventParamTextInputReplyPointSize typeFixed <– kEventParamTextInputReplyLineHeight typeShortInteger <– kEventParamTextInputReplyLineAscent typeShortInteger <– kEventParamTextInputReplyTextAngle typeFixed

kEventTextInputPosToOffset Required parameters: --> kEventParamTextInputSendComponentInstance typeComponentInstance --> kEventParamTextInputSendRefCon typeLongInteger --> kEventParamTextInputSendCurrentPoint typeQDPoint <– kEventParamTextInputReplyRegionClass typeLongInteger <– kEventParamTextInputReplyTextOffset typeLongInteger (required if the position is inside the document's body)

 Optional parameters:
 -->     kEventParamTextInputSendDraggingMode                typeBoolean
 <--     kEventParamTextInputReplyLeadingEdge                typeBoolean
 <--     kEventParamTextInputReplySLRec typeIntlWritingCode

kEventTextInputShowHideBottomWindow Required parameters: --> kEventParamTextInputSendComponentInstance typeComponentInstance --> kEventParamTextInputSendRefCon typeLongInteger

Optional parameters: --> kEventParamTextInputSendShowHide typeBoolean <– kEventParamTextInputReplyShowHide typeBoolean

kEventTextInputGetSelectedText Required parameters: --> kEventParamTextInputSendComponentInstance typeComponentInstance --> kEventParamTextInputSendRefCon typeLongInteger

Optional parameters: --> kEventParamTextInputSendLeadingEdge typeBoolean --> kEventParamTextInputSendTextServiceEncoding typeUInt32 --> kEventParamTextInputSendTextServiceMacEncoding typeUInt32 <– kEventParamTextInputReplyText typeUnicodeText, typeChar (data type depends on TSMDocument. See kEventTextInputUpdateActiveInputArea Notes) <– kEventParamTextInputReplySLRec typeIntlWritingCode Summary: Keyboard events (kEventClassKeyboard)

Discussion: These events are the lowest-level keyboard events.

Enumerator
kEventRawKeyDown 

A key was pressed.

kEventRawKeyRepeat 

Sent periodically as a key is held down by the user.

kEventRawKeyUp 

A key was released.

kEventRawKeyModifiersChanged 

The keyboard modifiers (bucky bits) have changed.

kEventHotKeyPressed 

A registered Hot Key was pressed.

kEventHotKeyReleased 

A registered Hot Key was released (this is only sent on Mac OS X).

◆ anonymous enum

anonymous enum

Summary: Key modifier change event bits and masks

Discussion: From bit 8, cmdKeyBit, to bit 15, rightControlKeyBit, are compatible with Event Manager modifiers.

Enumerator
kEventKeyModifierNumLockBit 

The Num Lock state bit (Mac OS X only).

kEventKeyModifierFnBit 

The Fn key state bit (Mac OS X only).

◆ anonymous enum

anonymous enum

Parameters for keyboard events:

kEventRawKeyDown --> kEventParamKeyMacCharCodes typeChar --> kEventParamKeyCode typeUInt32 --> kEventParamKeyModifiers typeUInt32 --> kEventParamKeyboardType typeUInt32

kEventRawKeyRepeat --> kEventParamKeyMacCharCodes typeChar --> kEventParamKeyCode typeUInt32 --> kEventParamKeyModifiers typeUInt32 --> kEventParamKeyboardType typeUInt32

kEventRawKeyUp --> kEventParamKeyMacCharCodes typeChar --> kEventParamKeyCode typeUInt32 --> kEventParamKeyModifiers typeUInt32 --> kEventParamKeyboardType typeUInt32

kEventRawKeyModifiersChanged --> kEventParamKeyModifiers typeUInt32

kEventHotKeyPressed --> kEventParamDirectObject typeEventHotKeyID

kEventHotKeyReleased --> kEventParamDirectObject typeEventHotKeyID Summary: Application events (kEventClassApplication)

Enumerator
kEventAppActivated 

The current app has been activated (resume event). May optionally contain a kEventParamWindowRef parameter if a click on an application window was the cause of the app activation.

kEventAppDeactivated 

The current app has just been deactivated (suspend event).

kEventAppQuit 

Request to quit. Sent by QuitApplicationEventLoop to the application target. In response, the event handler installed by RunApplicationEventLoop will cause RunApplicationEventLoop to exit. Most applications will not need to handle this event; instead, an application should install an AppleEvent handler for the kAEQuitApplication event handler if it needs to check for unsaved documents or do other cleanup before quitting.

kEventAppLaunchNotification 

An async launch request response. This event is received when you use LaunchServices to launch a process asynchronously. It is only received on Mac OS X.

kEventAppLaunched 

Another app was launched. Available on Mac OS X and CarbonLib 1.3.1 and later.

kEventAppTerminated 

Another app terminated. Available on Mac OS X and CarbonLib 1.3.1 and later.

kEventAppFrontSwitched 

The front (active) application has changed. Available on Mac OS X and CarbonLib 1.3.1 and later.

kEventAppGetDockTileMenu 

A request for a menu to be displayed by the application's dock tile. The default handler will return the menu, if any, that was provided by the SetApplicationDockTileMenu API. The sender of this event will release the menu after the Dock has displayed it, so if you return a permanently allocated MenuRef, you should call RetainMenu on it before returning from your event handler. For most applications, it will be easier to use the SetApplicationDockTileMenu API directly rather than installing a handler for this event. Available after Mac OS X 10.0.x.

◆ anonymous enum

anonymous enum

Parameters for application events:

kEventAppActivated --> kEventParamWindowRef typeWindowRef

kEventAppDeactivated (no parameters)

kEventAppQuit (no parameters)

kEventAppLaunchNotification --> kEventParamProcessID typeProcessSerialNumber --> kEventParamLaunchRefCon typeUInt32 --> kEventParamLaunchErr typeOSStatus

kEventAppLaunched --> kEventParamProcessID typeProcessSerialNumber

kEventAppTerminated --> kEventParamProcessID typeProcessSerialNumber

kEventAppFrontSwitched --> kEventParamProcessID typeProcessSerialNumber

kEventAppGetDockTileMenu <– kEventParamMenuRef typeMenuRef Summary: Apple events (kEventClassAppleEvent)

Enumerator
kEventAppleEvent 

Sent when a high-level event is received. The default handler will call AEProcessAppleEvent.

◆ anonymous enum

anonymous enum

Parameters for Apple events:

kEventAppleEvent --> kEventParamAEEventClass typeType // the eventClass of the Apple event --> kEventParamAEEventID typeType // the eventID of the Apple event Summary: Window refresh events (kEventClassWindow)

Discussion: Events related to drawing a window's content.

Enumerator
kEventWindowUpdate 

Low-level update event. Sent to any window that needs updating regardless of whether the window has the standard handler installed. You must call BeginUpdate, call SetPort, draw your window content, and then call EndUpdate.

kEventWindowDrawContent 

Only sent to windows with the standard handler installed. BeginUpdate, SetPort, and EndUpdate are called for you; all you do is draw. No, really.

◆ anonymous enum

anonymous enum

Parameters for window refresh events:

kEventWindowUpdate --> kEventParamDirectObject typeWindowRef

kEventWindowDrawContent --> kEventParamDirectObject typeWindowRef Summary: Window activation events (kEventClassWindow)

Discussion: Events related to activating and deactivating a window.

Enumerator
kEventWindowActivated 

The window is active now. Sent to any window that is activated, regardless of whether the window has the standard handler installed.

kEventWindowDeactivated 

The window is inactive now. Sent to any window that is deactivated, regardless of whether the window has the standard handler installed.

kEventWindowGetClickActivation 

Sent when a click occurs in a background window. Only sent to windows with the standard handler installed. The default behavior is to bring the window forward and eat the click. You have the option of overriding the behavior to support click-thru or select-and-click.

◆ anonymous enum

anonymous enum

Parameters for window activation events:

kEventWindowActivated --> kEventParamDirectObject typeWindowRef

kEventWindowDeactivated --> kEventParamDirectObject typeWindowRef

kEventWindowGetClickActivation --> kEventParamDirectObject typeWindowRef --> kEventParamMouseLocation typeQDPoint --> kEventParamKeyModifiers typeUInt32 --> kEventParamWindowDefPart typeWindowDefPartCode --> kEventParamControlRef typeControlRef (only present if the click was on a control) <– kEventParamClickActivation typeClickActivationResult Summary: Window state change events (kEventClassWindow)

Discussion: Events that notify of a change in the window's state. These events are sent to all windows, regardless of whether the window has the standard handler installed.

Enumerator
kEventWindowShowing 

A window is being shown. This is sent inside ShowHide.

kEventWindowHiding 

A window is being hidden. This is sent inside ShowHide.

kEventWindowShown 

Indicates that the window has been shown.

kEventWindowHidden 

Indicates that the window has been hidden.

kEventWindowBoundsChanging 

Sent during DragWindow or ResizeWindow, before the window is actually moved or resized. Alter the current bounds (kEventParamCurrentBounds) in the event to change the eventual location of the window. You may change the size, origin, or both of the window's bounds. Do not, however, call SizeWindow or SetWindowBounds yourself from inside a handler for this event. In Mac OS X 10.1 and later, kEventWindowBoundsChanging is sent before all changes to a window's bounds, regardless of whether the change is initiated by the user or by a direct call to a Window Manager API. Applications may intercept the event and modify the bounds. When the event is sent because of a direct call to the Window Manager, the kWindowBoundsChangeUserDrag/Resize attribute bits will not be set.

kEventWindowBoundsChanged 

Indicates that the window has been moved or resized (or both). Do not call SizeWindow or SetWindowBounds from inside a handler for this event; if you need to enforce a certain window bounds, install a kEventWindowBoundsChanging handler instead.

kEventWindowResizeStarted 

Indicates that the user has just started to resize a window.

kEventWindowResizeCompleted 

Indicates that the user has just finished resizing a window.

kEventWindowDragStarted 

Indicates that the user has just started to drag a window.

kEventWindowDragCompleted 

Indicates that the user has just finished dragging a window.

◆ anonymous enum

anonymous enum

Summary: Window bounds change event attributes

Discussion: When the toolbox sends out a kEventWindowBoundsChanging or kEventWindowBoundsChanged event, it also sends along a parameter containing attributes of the event. These attributes can be used to determine what aspect of the window changed (origin, size, or both), and whether or not some user action is driving the change (drag or resize).

Enumerator
kWindowBoundsChangeUserDrag 

The bounds is changing because the user is dragging the window around.

kWindowBoundsChangeUserResize 

The bounds is changing because the user is resizing the window.

kWindowBoundsChangeSizeChanged 

The dimensions of the window (width and height) are changing.

kWindowBoundsChangeOriginChanged 

The top left corner (origin) is changing.

◆ anonymous enum

anonymous enum

Parameters for window state change events:

kEventWindowShowing --> kEventParamDirectObject typeWindowRef

kEventWindowHiding --> kEventParamDirectObject typeWindowRef

kEventWindowShown --> kEventParamDirectObject typeWindowRef

kEventWindowHidden --> kEventParamDirectObject typeWindowRef

kEventWindowBoundsChanging --> kEventParamDirectObject typeWindowRef --> kEventParamAttributes typeUInt32 --> kEventParamOriginalBounds typeQDRectangle --> kEventParamPreviousBounds typeQDRectangle <-> kEventParamCurrentBounds typeQDRectangle

kEventWindowBoundsChanged --> kEventParamDirectObject typeWindowRef --> kEventParamAttributes typeUInt32 --> kEventParamOriginalBounds typeQDRectangle --> kEventParamPreviousBounds typeQDRectangle --> kEventParamCurrentBounds typeQDRectangle

kEventWindowResizeStarted --> kEventParamDirectObject typeWindowRef

kEventWindowResizeCompleted --> kEventParamDirectObject typeWindowRef

kEventWindowDragStarted --> kEventParamDirectObject typeWindowRef

kEventWindowDragCompleted --> kEventParamDirectObject typeWindowRef Summary: Window click events (kEventClassWindow)

Discussion: Low-level events which generate higher-level �action� events. These events are only generated for windows with the standard window handler installed. Most clients should allow the standard handler to implement these events. Window click events are generated from lower-level kEventMouseDown events by copying the mouse event and changing the class and kind, so window click events will have all of the parameters of the mouse down event, in addition to those parameters documented here that are specific to the window events.

Enumerator
kEventWindowClickDragRgn 

Sent when the mouse is down in the drag region. The standard handler calls DragWindow.

kEventWindowClickResizeRgn 

Sent when the mouse is down in the resize area. The standard handler calls ResizeWindow.

kEventWindowClickCollapseRgn 

Sent when the mouse is down in the collapse widget. The standard handler calls CollapseWindow, and then generates kEventWindowExpand or kEventWindowCollapse (whichever is the opposite of the window�s original collapse state).

kEventWindowClickCloseRgn 

Sent when the mouse is down in the close widget. The standard handler calls TrackGoAway, and then generates kEventWindowClose.

kEventWindowClickZoomRgn 

Sent when the mouse is down in the zoom widget. The standard handler calls TrackBox, and then generates kEventWindowZoom.

kEventWindowClickContentRgn 

Sent when the mouse is down in the content region. The standard handler checks for contextual menu clicks and clicks on controls, and sends kEventWindowContextualMenuSelect, kEventControlClick, and kEventWindowHandleContentClick events as appropriate.

kEventWindowClickProxyIconRgn 

Sent when the mouse is down in the proxy icon. The standard handler handles proxy icon dragging, and generates proxy icon events.

kEventWindowClickToolbarButtonRgn 

Sent when the mouse is down in the toolbar button. The standard handler calls TrackBox, and then generates kEventWindowToolbarSwitchMode. (Mac OS X only)

kEventWindowClickStructureRgn 

Sent when the mouse is down in some part of the window structure other than the window widgets, drag region, or resize region.

◆ anonymous enum

anonymous enum

Summary: Window cursor change events (kEventClassWindow)

Enumerator
kEventWindowCursorChange 

Sent when the mouse is moving over the content region. Available in Mac OS X and in CarbonLib 1.5 and later. This event is used to manage ownership of the cursor. You should only change the cursor if you receive this event; otherwise, someone else needed to adjust the cursor and handled the event (e.g., a TSM Input Method when the mouse is over an inline input region). This event is only sent to the window itself; it is not propagated to controls in the window.

◆ anonymous enum

anonymous enum

Parameters for window cursor change events:

kEventWindowCursorChange --> kEventParamDirectObject typeWindowRef --> kEventParamMouseLocation typeQDPoint --> kEventParamKeyModifiers typeUInt32 Summary: Window action events

Discussion: Events which indicate that certain changes have been made to the window. These events have greater semantic meaning than the low-level window click events and are usually prefered for overriding.

Enumerator
kEventWindowCollapse 

If the window is not collapsed, this event is sent by the standard window handler after it has received kEventWindowClickCollapseRgn and received true from a call to TrackBox. Standard window handler calls CollapseWindow and then sends kEventWindowCollapsed if no error is received from CollapseWindow.

kEventWindowCollapsed 

Notification that the object has successfully collapsed.

kEventWindowCollapseAll 

Sent by the standard window handler (when the option key is down) after it has received kEventWindowClickCollapseRgn and then received true from a call to TrackBox. The standard window handler's response is to send each window of the same class as the clicked window a kEventWindowCollapse event.

kEventWindowExpand 

If the window is collapsed, this event is sent by the standard window handler after it has received kEventWindowClickCollapseRgn and received true from a call to TrackBox. The standard window handler's response is to call CollapseWindow, then send kEventWindowExpanded. Note that you will not receive this event before a window is expanded from the dock, since minimized windows in the dock don't uses collapse boxes to unminimize.

kEventWindowExpanded 

Notification that the window has successfully expanded.

kEventWindowExpandAll 

Sent by the standard window handler (when the option key is down) after it has received kEventWindowClickCollapseRgn and then received true from a call to TrackBox. The standard window handler's response is to send each window of the same class as the clicked window a kEventWindowExpand event.

kEventWindowClose 

Sent by the standard window handler after it has received kEventWindowClickCloseRgn and successfully called TrackBox. Your application might intercept this event to check if the document is dirty, and display a Save/Don'tSave/Cancel alert.

kEventWindowClosed 

Dispatched by DisposeWindow before the object is disposed.

kEventWindowCloseAll 

Sent by the standard window handler (when the option key is down) after it has received kEventWindowClickCloseRgn and received true from a call to TrackGoAway. The standard window handler's response is to send each window with the same class as the clicked window a kEventWindowClose event.

kEventWindowZoom 

Sent by the standard window handler upon receiving kEventWindowClickZoomRgn and then receiving true from a call to TrackBox. The standard window handler's response is to zoom the window using ZoomWindowIdeal. Upon successful zoom, kEventWindowZoomed is sent.

kEventWindowZoomed 

Notification that the window has been successfully zoomed.

kEventWindowZoomAll 

Sent by the standard window handler (when the option key is down) after it has received kEventObjectClickZoomRgn and received true from a call to TrackBox. The standard window handler's response is to send each window with the same class as the clicked window a kEventObjectZoom event and then to reposition all zoomed windows using the kWindowCascadeOnParentWindowScreen positioning method.

kEventWindowContextualMenuSelect 

Sent when either the right mouse button is pressed, or the control key is held down and the left mouse button is pressed, or the left mouse button is held down for more than 1/4th of a second (and nothing else is handling the generated mouse tracking events). The standard window handler ignores this event.

kEventWindowPathSelect 

Sent when IsWindowPathSelectClick would return true. Set the MenuRef in the event if you wish to customize the menu passed to WindowPathSelect.

kEventWindowGetIdealSize 

Sent by the standard window handler to determine the standard state for zooming.

kEventWindowGetMinimumSize 

Sent by the standard window handler to determine the minimum size of the window (used during window resizing).

kEventWindowGetMaximumSize 

Sent by the standard window handler to determine the maximum size of the window (used during window resizing).

kEventWindowConstrain 

Sent by the Window Manager to warn of a change in the available window positioning bounds on the window (i.e., screen resolution or Dock size change). Available only in Mac OS X. In Mac OS 10.0.x, the standard window handler always constrains the window to the rect returned by GetAvailableWindowPositioningBounds for the window's device. In Mac OS 10.1 and later, event handlers may change the rect in the kEventParamAvailableBounds parameter, and the standard window handler will constrain the window to that rectangle. In Mac OS X after 10.1, this event may optionally contain a kEventParamAttributes parameter; if present, this parameter should be formed from constants in the WindowConstrainOptions enumeration. The standard window handler will pass these attributes to ConstrainWindowToScreen. If this event parameter is not present, the standard window handler passes kWindowConstrainMoveRegardlessOfFit to ConstrainWindowToScreen in 10.0.x, and kWindowConstrainMoveRegardlessOfFit | kWindowConstrainAllowPartial in Mac OS 10.1 and later. In Mac OS X after 10.1, this event may optionally contain a kEventParamWindowRegionCode parameter; if present, this parameter should be a WindowRegionCode. The standard window handler will pass this code to ConstrainWindowToScreen. If this event parameter is not present, the standard window handler passes kWindowDragRgn to ContrainWindowToScreen. In Mac OS X after 10.1, this event may optionally contain a kEventParamRgnHandle parameter; if present, this parameter is a RgnHandle containing the GrayRgn before a GDevice configuration change. An event handler may compare this region with the current GrayRgn to more intelligently determine whether the window should be constrained to current GrayRgn. The standard window handler in Mac OS X after 10.1 will not constrain windows that were not onscreen before the device configuration change.

kEventWindowHandleContentClick 

Sent by the standard window handler in response to kEventWindowClickContentRgn when a mouse click is in the content region but is not a contextual menu invocation or a click on a control. Available starting with Mac OS X and CarbonLib 1.3.1.

kEventWindowProxyBeginDrag 

Sent before a proxy icon drag; you can attach data to the DragRef in the event.

kEventWindowProxyEndDrag 

Sent after the proxy icon drag is complete, whether successful or not.

kEventWindowToolbarSwitchMode 

Sent by the standard window handler in response to kEventWindowClickToolbarButtonRgn and then receiving true from a call to TrackBox. You actually DO NOT need to use the standard window event handler to receive this event. Any window with the toolbar button will receive this event if the toolbar button is clicked. The Toolbox does not track the state of the toolbar. We only report that the button was clicked. The application should react accordingly. (Mac OS X only)

◆ anonymous enum

anonymous enum

Parameters for window action events:

kEventWindowCollapse --> kEventParamDirectObject typeWindowRef

kEventWindowCollapsed --> kEventParamDirectObject typeWindowRef

kEventWindowCollapseAll --> kEventParamDirectObject typeWindowRef

kEventWindowExpand --> kEventParamDirectObject typeWindowRef

kEventWindowExpanded --> kEventParamDirectObject typeWindowRef

kEventWindowExpandAll --> kEventParamDirectObject typeWindowRef

kEventWindowClose --> kEventParamDirectObject typeWindowRef

kEventWindowClosed --> kEventParamDirectObject typeWindowRef

kEventWindowCloseAll --> kEventParamDirectObject typeWindowRef

kEventWindowZoom --> kEventParamDirectObject typeWindowRef

kEventWindowZoomed --> kEventParamDirectObject typeWindowRef

kEventWindowZoomAll --> kEventParamDirectObject typeWindowRef

kEventWindowContextualMenuSelect --> kEventParamDirectObject typeWindowRef

kEventWindowPathSelect --> kEventParamDirectObject typeWindowRef

kEventWindowGetIdealSize --> kEventParamDirectObject typeWindowRef <– kEventParamDimensions typeQDPoint

kEventWindowGetMinimumSize --> kEventParamDirectObject typeWindowRef <– kEventParamDimensions typeQDPoint

kEventWindowGetMaximumSize --> kEventParamDirectObject typeWindowRef <– kEventParamDimensions typeQDPoint

kEventWindowConstrain --> kEventParamDirectObject typeWindowRef --> kEventParamAvailableBounds typeQDRectangle --> kEventParamAttributes typeUInt32 (optional; available in Mac OS X after 10.1) --> kEventParamWindowRegionCode typeWindowRegionCode (optional; available in Mac OS X after 10.1) --> kEventParamRgnHandle typeQDRgnHandle (optional; available in Mac OS X after 10.1)

kEventWindowHandleContentClick --> kEventParamDirectObject typeWindowRef --> [other parameters from kEventMouseDown]

kEventWindowProxyBeginDrag --> kEventParamDirectObject typeWindowRef

kEventWindowProxyEndDrag --> kEventParamDirectObject typeWindowRef Summary: Window focus events (kEventClassWindow)

Discussion: Events related to focus changes between windows. These events are generated by SetUserFocusWindow; since that API is only called by default by the standard window handler, these events are normally only sent to windows with the standard handler installed.

Enumerator
kEventWindowFocusAcquired 

The user (or some other action) has caused the focus to shift to your window. In response to this, you should focus any control that might need to be focused. The standard window handler calls SetKeyboardFocus to hilite the first control in the window.

kEventWindowFocusRelinquish 

The toolbox is notifying you of a focus change. You should make sure to unhilite the focus, etc. The standard window handler clears the current keyboard focus.

◆ anonymous enum

anonymous enum

Parameters for window focus events:

kEventWindowFocusAcquire --> kEventParamDirectObject typeWindowRef

kEventWindowFocusRelinquish --> kEventParamDirectObject typeWindowRef Summary: Window definition events (kEventClassWindow)

Discussion: Events that correspond to WDEF messages. Sent to all windows, regardless of whether they have the standard window handler installed.

Enumerator
kEventWindowDrawFrame 

Sent by the Window Manager when it's time to draw a window's structure. This is the replacement to the old wDraw defProc message (though it is a special case of the 0 part code indicating to draw the entire window frame).

kEventWindowDrawPart 

Sent by the Window Manager when it's time to draw a specific part of a window's structure, such as the close box. This is typically sent during window tracking.

kEventWindowGetRegion 

Sent by the Window Manager when it needs to get a specific region from a window, or when the GetWindowRegion API is called. The region you should modify is sent in the kEventParamRgnHandle parameter.

kEventWindowHitTest 

Sent when the Window Manager needs to determine what part of a window would be 'hit' with a given mouse location in global coordinates. If you handle this event, you should set the kEventParamWindowDefPart parameter to reflect the part code hit.

kEventWindowInit 

Sent by the Window Manager when the window is being created. This is a hook to allow you to do any initialization you might need to do.

kEventWindowDispose 

Sent by the Window Manager when the window is being disposed.

kEventWindowDragHilite 

Sent by the Window Manager when it is time to draw/erase any drag hilite in the window structure. This is typically sent from within HiliteWindowFrameForDrag.

kEventWindowModified 

Sent by the Window Manager when it is time to redraw window structure to account for a change in the document modified state. This is typically sent from within SetWindowModified.

kEventWindowSetupProxyDragImage 

Sent by the Window Manager when it is time to generate a drag image for the window proxy. This is typically sent from within BeginWindowProxyDrag.

kEventWindowStateChanged 

Sent by the Window Manager when a particular window state changes. See the state-change flags in MacWindows.h.

kEventWindowMeasureTitle 

Sent when the Window Manager needs to know how much space the window's title area takes up.

kEventWindowDrawGrowBox 

This is a compatibility event harkening back to the old days before Mac OS 8. Not very useful these days. When the DrawGrowIcon API is called, this event is sent to the window to tell it to draw the grow box. This is only really needed for windows that do not have the grow box integrated into the window frame. Scroll bar delimiter lines are also drawn.

kEventWindowGetGrowImageRegion 

This is a special way for a window to override the standard resize outline for windows that do not do live resizing. As the user resizes the window, this event is sent with the current size the user has chosen expressed as a rectangle. You should calculate your window outline and modify the kEventParamRgnHandle parameter to reflect your desired outline.

kEventWindowPaint 

When the Window Manager needs to paint a window (e.g, when a window is first displayed), the kEventWindowPaint event is sent to allow the window to control all aspect of painting, including the window frame. If a window does not respond to this event, the Window Manager ends up sending kEventWindowDrawFrame and then erasing the window to the window content color as usual. This is mostly used for specialty windows, such as help tags or appliance apps might have. (Mac OS X only)

◆ anonymous enum

anonymous enum

Parameters for window definition events:

kEventWindowDrawFrame --> kEventParamDirectObject typeWindowRef the window

kEventWindowDrawPart --> kEventParamDirectObject typeWindowRef the window --> kEventParamWindowDefPart typeWindowDefPartCode the part to draw

kEventWindowGetRegion --> kEventParamDirectObject typeWindowRef the window --> kEventParamWindowRegionCode typeWindowRegionCode the region to get --> kEventParamRgnHandle typeQDRgnHandle the region to munge

kEventWindowHitTest --> kEventParamDirectObject typeWindowRef the window --> kEventParamMouseLocation typeQDPoint the mouse location <– kEventParamWindowDefPart typeWindowDefPartCode the part hit

kEventWindowInit --> kEventParamDirectObject typeWindowRef the window <– kEventParamWindowFeatures typeUInt32 the window features

kEventWindowDispose --> kEventParamDirectObject typeWindowRef the window

kEventWindowDragHilite --> kEventParamDirectObject typeWindowRef the window --> kEventParamWindowDragHiliteFlag typeBoolean whether to draw (true) or erase (false) the hilite

kEventWindowModified --> kEventParamDirectObject typeWindowRef the window --> kEventParamWindowModifiedFlag typeBoolean the new modified state

kEventWindowSetupProxyDragImage --> kEventParamDirectObject typeWindowRef the window --> kEventParamWindowProxyImageRgn typeQDRgnHandle the region you modify to contain the clip region for the GWorld. --> kEventParamWindowProxyOutlineRgn typeQDRgnHandle the region you modify to contain the drag outline used when the GWorld cannot be used. <– kEventParamWindowProxyGWorldPtr typeGWorldPtr a GWorld you allocate which contains the drag image.

kEventWindowStateChanged --> kEventParamDirectObject typeWindowRef the window --> kEventParamWindowStateChangedFlags typeUInt32 the state change flags

kEventWindowMeasureTitle --> kEventParamDirectObject typeWindowRef the window <– kEventParamWindowTitleFullWidth typeSInt16 the length of the whole title area <– kEventParamWindowTitleTextWidth typeSInt16 the length just the title text

kEventWindowDrawGrowBox --> kEventParamDirectObject typeWindowRef the window

kEventWindowGetGrowImageRegion --> kEventParamDirectObject typeWindowRef the window --> kEventParamWindowGrowRect typeQDRectangle the global rect --> kEventParamRgnHandle typeQDRgnHandle the region to modify

kEventWindowPaint --> kEventParamDirectObject typeWindowRef the window Summary: Menu events (kEventClassMenu)

Enumerator
kEventMenuBeginTracking 

The user has begun tracking the menubar or a pop-up menu. The direct object parameter is a valid MenuRef if tracking a pop-up menu, or NULL if tracking the menubar. The kEventParamCurrentMenuTrackingMode parameter indicates whether the user is tracking the menus using the mouse or the keyboard. The handler may return userCanceledErr to stop menu tracking.

kEventMenuEndTracking 

The user has finished tracking the menubar or a pop-up menu.

kEventMenuChangeTrackingMode 

The user has switched from selecting a menu with the mouse to selecting with the keyboard, or from selecting with the keyboard to selecting with the mouse. Only available on post-10.0.x versions of Mac OS X.

kEventMenuOpening 

A menu is opening. This event is sent each time that the menu is opened (i.e., more than once during a given tracking session if the user opens the menu multiple times). It is sent before the menu is actually drawn, so you can update the menu contents (including making changes that will alter the menu size) and the new contents will be drawn correctly. The kEventParamMenuFirstOpen parameter indicates whether this is the first time this menu has been opened during this menu tracking session. The handler may return userCanceledErr to prevent this menu from opening (Mac OS X only).

kEventMenuClosed 

A menu has been closed. Sent after the menu is hidden.

kEventMenuTargetItem 

The mouse is moving over a particular menu item. This event is sent for both enabled and disabled items.

kEventMenuMatchKey 

A menu is about to be examined for items that match a command key event. A handler for this event may perform its own command key matching and override the Menu Manager's default matching algorithms. Returning noErr from your handler indicates that you have found a match. The handler for this event should not examine submenus of this menu for a match; a separate event will be sent for each submenu. Handlers for this event must be installed directly on the menu containing the item to be matched. To improve performance of command key matching, the Menu Manager only sends this event if the menu itself has a handler; if a handler for this event is installed on any other event target, it will not be sent the event. When called from IsMenuKeyEvent, the kEventParamEventRef parameter contains the EventRef that was passed to IsMenuKeyEvent, for your handler to examine; when called from MenuKey or MenuEvent, the EventRef parameter contains an event created from the information passed to MenuKey or MenuEvent. Note that in the MenuKey case, no virtual keycode (kEventParamKeyCode) or key modifiers (kEventParamKeyModifiers) will be available. The kEventParamMenuEventOptions parameter contains a copy of the options that were passed to IsMenuKeyEvent, or 0 if called from MenuKey or MenuEvent. The only option that your handler will need to obey is kMenuEventIncludeDisabledItems. If your handler finds a match, it should set the kEventParamMenuItemIndex parameter to contain the item index of the matching item, and return noErr. If it does not find a match, it should return menuItemNotFoundErr. Any other return value will cause the Menu Manager to use its default command key matching algorithm for this menu. This event is sent after kEventMenuEnableItems.

kEventMenuEnableItems 

A request that the items in the menu be properly enabled or disabled according to the current state of the application. This event is sent from inside MenuKey, MenuEvent, and IsMenuKeyEvent before those APIs examine the menu for an item that matches a keyboard event. It is also sent during menu tracking before a menu is first made visible; it is sent right after kEventMenuOpening, once per menu per menu tracking session. It is also sent to the top-level menus in the menubar when the application is idle after user input has occurred, to allow the menu titles to be enabled or disabled appropriately according to the current user focus. You can distinquish between all these cases by examining the contents of the kEventParamMenuContext parameter. If you install an event handler for kEventProcessCommand, you should also install a handler for either kEventMenuEnableItems or kEventCommandUpdateStatus This is necessary because the Carbon event system will attempt to match command keys against the available menus before returning the keyboard event to your application via WaitNextEvent. If you have menu command event handlers installed for your menu items, your handlers will be called without your ever receiving the keyboard event or calling MenuKey/MenuEvent/IsMenuKeyEvent yourself. Therefore, you have no opportunity to enable your menu items properly other than from a kEventMenuEnableItems or kEventCommandUpdateStatus handler. It is not necessary to handle this event if you do not install kEventProcessCommand handlers for your menu items; in that case, the command key event will be returned from WaitNextEvent or ReceiveNextEvent as normal, and you can set up your menus before calling MenuKey/MenuEvent/ IsMenuKeyEvent. The kEventParamEnableMenuForKeyEvent parameter indicates whether this menu should be enabled for key event matching (true) or because the menu itself is about to become visible (false). If true, only the item enable state, command key, command key modifiers, and (optionally) the command key glyph need to be correct. If false, the entire menu item contents must be correct. This may be useful if you have custom menu content that is expensive to prepare.

kEventMenuPopulate 

kEventMenuPopulate is intended to be handled by applications that dynamically create their menu contents just-in-time before the menu is displayed. Previously, kEventMenuOpening was recommended for this purpose. kEventMenuPopulate is now recommended because it will be sent by the Menu Manager before it searches a menu for a matching command key, to allow a handler to dynamically add menu items that may have command key equivalents to the menu; kEventMenuOpening is only sent before the menu is displayed. kEventMenuPopulate is also sent just before kEventMenuOpening as a menu is being displayed. Finally, kEventMenuPopulate is only sent once per menu tracking session for a given menu, even if that menu is closed and opened multiple times by the user; kEventMenuOpening is sent each time that the menu is displayed. You can distinguish the command-key case from the menu-being-displayed case by examining the contents of the kEventParamMenuContext parameter; the kMenuContextKeyMatching flag will be set if the event is sent during command key matching, and either the kMenuContextMenuBarTracking or kMenuContextPopUpTracking flags will be sent if the event is sent before actual display of the menu. kEventMenuPopulate is available on Mac OS X 10.1 and later, and in CarbonLib 1.5 and later.

kEventMenuMeasureItemWidth 

Sent by the standard menu definition when a menu item has the kMenuItemAttrCustomDraw attribute. Handlers for this event should be installed directly on the menu. A handler for this event may respond by providing a customized width for the menu item. If no handler is installed, the standard menu definition provides a default handler that will return the standard width for the item.

kEventMenuMeasureItemHeight 

Sent by the standard menu definition when a menu item has the kMenuItemAttrCustomDraw attribute. Handlers for this event should be installed directly on the menu. A handler for this event may respond by providing a customized height for the menu item. If no handler is installed, the standard menu definition provides a default handler that will return the standard height for the item.

kEventMenuDispose 

Sent when the menu is being destroyed.

◆ anonymous enum

anonymous enum

Discussion: Menu context flags indicate the context or usage of a menu-related Carbon event.

Enumerator
kMenuContextMenuBar 

Indicates that this menu is inserted in the menubar, or is a (directly or indirectly) a submenu of a menu that is inserted in the menubar.

kMenuContextPullDown 

Indicates that this menu is a pull-down menu inserted in the menubar.

kMenuContextPopUp 

Indicates that this menu is a popup menu being displayed by PopUpMenuSelect.

kMenuContextSubmenu 

Indicates that this menu is a submenu of some other pull-down or popup menu.

kMenuContextMenuBarTracking 

Indicates that this Carbon event has been sent during a menubar tracking session.

kMenuContextPopUpTracking 

Indicates that this Carbon event has been sent during a popup menu tracking session.

kMenuContextKeyMatching 

Indicates that this Carbon event has been sent during command key matching.

kMenuContextMenuEnabling 

Indicates that this Carbon event has been sent at idle time to update the enabled state of the menus. Available on Mac OS X 10.1 and later, and in CarbonLib 1.5 and later; on earlier releases, the kMenuContextKeyMatching flag is set when an event is sent during menu enabling.

◆ anonymous enum

anonymous enum

Parameters for menu events:

kEventMenuBeginTracking --> kEventParamDirectObject typeMenuRef --> kEventParamCurrentMenuTrackingMode typeMenuTrackingMode --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)

kEventMenuEndTracking --> kEventParamDirectObject typeMenuRef --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)

kEventMenuChangeTrackingMode --> kEventParamCurrentMenuTrackingMode typeMenuTrackingMode --> kEventParamNewMenuTrackingMode typeMenuTrackingMode --> kEventParamMenuContext typeUInt32

kEventMenuOpening --> kEventParamDirectObject typeMenuRef --> kEventParamMenuFirstOpen typeBoolean --> kEventParamMenuContext typeUInt32 (in CarbonLib 1.5 and later)

kEventMenuClosed --> kEventParamDirectObject typeMenuRef --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)

kEventMenuTargetItem --> kEventParamDirectObject typeMenuRef --> kEventParamMenuItemIndex typeMenuItemIndex --> kEventParamMenuCommand typeMenuCommand --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)

kEventMenuMatchKey --> kEventParamDirectObject typeMenuRef --> kEventParamEventRef typeEventRef --> kEventParamMenuEventOptions typeMenuEventOptions --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later) <– kEventParamMenuItemIndex typeMenuItemIndex

kEventMenuEnableItems --> kEventParamDirectObject typeMenuRef --> kEventParamEnableMenuForKeyEvent typeBoolean --> kEventParamMenuContext typeUInt32 (in CarbonLib 1.3.1 and later)

kEventMenuPopulate (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later) --> kEventParamDirectObject typeMenuRef --> kEventParamMenuContext typeUInt32

kEventMenuMeasureItemWidth (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later) --> kEventParamDirectObject typeMenuRef --> kEventParamMenuItemIndex typeMenuItemIndex <– kEventParamMenuItemWidth typeShortInteger

kEventMenuMeasureItemHeight (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later) --> kEventParamDirectObject typeMenuRef --> kEventParamMenuItemIndex typeMenuItemIndex <– kEventParamMenuItemHeight typeShortInteger

kEventMenuDrawItem (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later) --> kEventParamDirectObject typeMenuRef --> kEventParamCurrentBounds typeQDRectangle --> kEventParamMenuItemIndex typeMenuItemIndex --> kEventParamMenuItemBounds typeQDRectangle --> kEventParamMenuVirtualTop typeLongInteger --> kEventParamMenuVirtualBottom typeLongInteger --> kEventParamMenuDrawState typeThemeMenuState --> kEventParamMenuItemType typeThemeMenuItemType --> kEventParamCGContextRef typeCGContextRef <– kEventParamMenuMarkBounds typeQDRectangle (added to event by the default event handler) <– kEventParamMenuIconBounds typeQDRectangle (added to event by the default event handler) <– kEventParamMenuTextBounds typeQDRectangle (added to event by the default event handler) <– kEventParamMenuTextBaseline typeShortInteger (added to event by the default event handler) <– kEventParamMenuCommandKeyBounds typeQDRectangle (added to event by the default event handler)

kEventMenuDrawItemContent (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later) --> kEventParamDirectObject typeMenuRef --> kEventParamMenuItemIndex typeMenuItemIndex --> kEventParamMenuItemBounds typeQDRectangle --> kEventParamDeviceDepth typeShortInteger --> kEventParamDeviceColor typeBoolean --> kEventParamCGContextRef typeCGContextRef <– kEventParamMenuMarkBounds typeQDRectangle (added to event by the default event handler) <– kEventParamMenuIconBounds typeQDRectangle (added to event by the default event handler) <– kEventParamMenuTextBounds typeQDRectangle (added to event by the default event handler) <– kEventParamMenuTextBaseline typeShortInteger (added to event by the default event handler) <– kEventParamMenuCommandKeyBounds typeQDRectangle (added to event by the default event handler)

kEventMenuDispose --> kEventParamDirectObject typeMenuRef Summary: Command events (kEventClassCommand)

Enumerator
kEventCommandProcess 

A command has been invoked and the application should handle it. This event is sent when the user chooses a menu item or a control with a command is pressed. Some senders of this event will also include the modifier keys that were pressed by the user when the command was invoked, but this parameter is optional.

kEventCommandUpdateStatus 

The status of a command is in question. When you receive this event, you should update the necessary UI elements in your application to reflect the current status of the command. For example, if the command has the kHICommandFromMenu bit set), you should update the menu item state, text, etc. to reflect the current reality in your application.

◆ anonymous enum

anonymous enum

Parameters for command events:

kEventCommandProcess --> kEventParamDirectObject typeHICommand --> kEventParamKeyModifiers typeUInt32 (optional)

kEventCommandUpdateStatus --> kEventParamDirectObject typeHICommand --> kEventParamMenuContext typeUInt32 Summary: Common command IDs

Enumerator
kHICommandOK 

The OK button in a dialog or alert.

kHICommandCancel 

The Cancel button in a dialog or alert.

kHICommandQuit 

The application should quit.

kHICommandUndo 

The last editing operation should be undone.

kHICommandRedo 

The last editing operation should be redone.

kHICommandCut 

The selected items should be cut.

kHICommandCopy 

The selected items should be copied.

kHICommandPaste 

The contents of the clipboard should be pasted.

kHICommandClear 

The selected items should be deleted.

kHICommandSelectAll 

All items in the active window should be selected.

kHICommandHide 

The application should be hidden. The Menu Manager will respond to this command automatically; your application does not need to handle it.

kHICommandHideOthers 

Other applications should be hidden. The Menu Manager will respond to this command automatically; your application does not need to handle it.

kHICommandShowAll 

All applications should become visible. The Menu Manager will respond to this command automatically; your application does not need to handle it.

kHICommandPreferences 

The Preferences menu item has been selected.

kHICommandZoomWindow 

The active window should be zoomed in or out. The Window Manager will respond to this event automatically; your application does not need to handle it, but you may want to install a Carbon event handler for kEventWindowGetIdealSize to return the ideal size for your document windows.

kHICommandMinimizeWindow 

The active window should be minimized. The Window Manager will respond to this event automatically; your application does not need to handle it.

kHICommandMinimizeAll 

All windows of the same class as the active window that have collapse boxes should be minimized. The Window Manager will respond to this event automatically; your application does not need to handle it.

kHICommandMaximizeWindow 

The active window should be maximized. Only sent on Mac OS 9. The Window Manager will respond to this event automatically; your application does not need to handle it.

kHICommandMaximizeAll 

All windows of the same class as the active window that have collapse boxes should be maximized. The Window Manager will respond to this event automatically; your application does not need to handle it.

kHICommandArrangeInFront 

All document-class windows should be arranged in a stack. The Window Manager will respond to this event automatically; your application does not need to handle it.

kHICommandBringAllToFront 

All windows of this application should be brought in front of windows from other applications. Only sent on Mac OS X. The Window Manager will respond to this event automatically; your application does not need to handle it.

kHICommandWindowListSeparator 

This command ID is used as a placeholder to mark the separator item dividing the Zoom/Minimize/Maximize/Arrange menu items in the standard Window menu from the menu items listing the visible windows. If you need to add your own menu items to the standard Window menu before the window list section, you can look for the menu item with this command ID using GetIndMenuItemWithCommandID, and insert your menu items before the item with this ID.

kHICommandWindowListTerminator 

This command ID is used as a placeholder to mark the end of the window list section of the standard Window menu. If you need to add your own menu items to the standard Window menu after the window list section, you can look for the menu item with this command ID using GetIndMenuItemWithCommandID, and insert your items after the item with this ID.

kHICommandSelectWindow 

A window in the standard Window menu has been selected and should be activated. The Window Manager will respond to this event automatically; your application does not need to handle it.

kHICommandAbout 

The About menu item has been selected.

kHICommandNew 

A new document or item should be created.

kHICommandOpen 

The user wants to open an existing document.

kHICommandClose 

The active window should be closed.

kHICommandSave 

The active document should be saved.

kHICommandSaveAs 

The user wants to save the active document under a new name.

kHICommandRevert 

The contents of the active document should be reverted to the last saved version.

kHICommandPrint 

The active window should be printed.

kHICommandPageSetup 

The user wants to configure the current page margins, formatting, and print options.

kHICommandAppHelp 

The application's help book should be displayed. Used by the Help Manager when it adds the "<AppName> Help" menu item to the Help menu. The Help Manager will respond to this event automatically; your application does not need to handle it.

◆ anonymous enum

anonymous enum

Summary: Control events (kEventClassControl)

Enumerator
kEventControlInitialize 

Allows the control to initialize private data.

kEventControlDispose 

Allows the control to dispose of private data.

kEventControlGetOptimalBounds 

Allows the control to report its best size and its text baseline based on its current settings. You should set the kEventParamControlOptimalBounds parameter to an appropriate rectangle. You should also set the kEventParamControlOptimalBaselineOffset parameter to be the offset from the top of your optimal bounds of a text baseline, if any. (Mac OS X only)

kEventControlHit 

Sent by TrackControl and HandleControlClick after handling a click in a control.

kEventControlSimulateHit 

Sent when your control should simulate a click in response to some other action, such as a return key for a default button. (Mac OS X only)

kEventControlHitTest 

Sent when someone wants to find out what part of your control is at a given point in local coordinates. You should set the kEventParamControlPart parameter to the appropriate part. (Mac OS X only)

kEventControlDraw 

Sent when your control should draw itself. The event can optionally contain a port in which to draw and a part to constrain drawing to. (Mac OS X only)

kEventControlApplyBackground 

Sent when your control should apply its background color/pattern to the port specified so the subcontrol can properly erase. The port is optional; if it does not exist you should apply the background to the current port. (Mac OS X only)

kEventControlApplyTextColor 

Sent when your control should apply a color/pattern to the specified port and context so a subcontrol can draw text which looks appropriate for your control's background. The port is optional; if it does not exist, you should apply the text color to the current port. The context context is also optional. (Mac OS X only)

kEventControlSetFocusPart 

Sent when your control is gaining, losing, or changing the focus. Set the kEventParamControlPart param to the resulting focused part. (Mac OS X only)

kEventControlGetFocusPart 

Sent when your the Control Manager wants to know what part of your control is currently focused. Set the kEventParamControlPart param to your currently focused part. (Mac OS X only)

kEventControlActivate 

Sent when your control becomes active as a result of a call to ActivateControl. (Mac OS X only)

kEventControlDeactivate 

Sent when your control becomes inactive as a result of a call to DeactivateControl. (Mac OS X only)

kEventControlSetCursor 

Sent when your control is asked to change the cursor as a result of a call to HandleControlSetCursor. (Mac OS X only)

kEventControlContextualMenuClick 

Sent when your control is asked to display a contextual menu as a result of a call to HandleControlContextualMenuClick. (Mac OS X only)

kEventControlClick 

A mouse down occurred in a control. The standard window handler sets the keyboard focus to the control if it takes focus on clicks, and calls HandleControlClick. Available on Mac OS X and CarbonLib 1.3.1 and later.

kEventControlTrack 

Sent to allow your control to completely replace the normal tracking that is part of a call to TrackControl or HandleControlClick. Set the kEventParamControlPart to the part hit during tracking. (Mac OS X only)

kEventControlGetScrollToHereStartPoint 

Sent so your control can support Scroll To Here behavior during tracking. Set the kEventParamMouseLocation parameter to the mouse location in local coordinates which represents where a click would have needed to be to cause your indicator to be dragged to the incoming mouse location. (Mac OS X only)

kEventControlGetIndicatorDragConstraint 

Sent so your control can constrain the movement of its indicator during tracking. Set the kEventParamControlIndicatorDragConstraint parameter to the appropriate constraint. (Mac OS X only)

kEventControlIndicatorMoved 

Sent during live-tracking of the indicator so your control can update its value based on the new indicator position. During non-live tracking, this event lets you redraw the indicator ghost at the appropriate place. (Mac OS X only)

kEventControlGhostingFinished 

Sent at the end of non-live indicator tracking so your control can update its value based on the final ghost location. (Mac OS X only)

kEventControlGetActionProcPart 

Sent during tracking so your control can alter the part that is passed to its action proc based on modifier keys, etc. Set the kEventParamControlPart to the part you want to have sent. (Mac OS X only)

kEventControlGetPartRegion 

Sent when a client wants to get a particular region of your control. See the GetControlRegion API. The kEventParamControlRegion contains a region for you to modify. (Mac OS X only)

kEventControlGetPartBounds 

Sent when a client wants to get a particular rectangle of your control when it may be more efficient than asking for a region. Set the kEventParamControlPartBounds parameter to the appropriate rectangle. (Mac OS X only)

kEventControlSetData 

Sent when a client wants to change an arbitrary setting of your control. See the SetControlData API. (Mac OS X only)

kEventControlGetData 

Sent when a client wants to get an arbitrary setting of your control. See the GetControlData API. (Mac OS X only)

kEventControlValueFieldChanged 

Sent when your control's value, min, max, or view size has changed. Useful so other entities can watch for your control's value to change. (Mac OS X only)

kEventControlAddedSubControl 

Sent when a control was embedded within your control. (Mac OS X only)

kEventControlRemovingSubControl 

Sent when one of your child controls will be removed from your control. (Mac OS X only)

kEventControlBoundsChanged 

Sent when one your control's bounding rectangle has changed. (Mac OS X only)

kEventControlOwningWindowChanged 

Sent when one your control's owning window has changed. Useful to udpate any dependencies that your control has on its owning window. (Mac OS X only)

kEventControlArbitraryMessage 

Sent when someone is trying to send an old-style CDEF message to your control. (Mac OS X only)

◆ anonymous enum

anonymous enum

Summary: Control bounds change event attributes

Discussion: When the toolbox sends out a kEventControlBoundsChanged event, it also sends along a parameter containing attributes of the event. These attributes can be used to determine what aspect of the control changed (position, size, or both).

Enumerator
kControlBoundsChangeSizeChanged 

The dimensions of the control (width and height) changed.

kControlBoundsChangePositionChanged 

The top left corner (position) changed.

◆ anonymous enum

anonymous enum

Parameters for control events:

kEventControlInitialize --> kEventParamDirectObject typeControlRef --> kEventParamInitCollection typeCollection <– kEventParamControlFeatures typeUInt32

kEventControlDispose --> kEventParamDirectObject typeControlRef

kEventControlGetOptimalBounds Required parameters: --> kEventParamDirectObject typeControlRef <– kEventParamControlOptimalBounds typeQDRectangle

Optional parameters: <– kEventParamControlOptimalBaselineOffset typeShortInteger (optional)

kEventControlHit --> kEventParamDirectObject typeControlRef --> kEventParamControlPart typeControlPartCode --> kEventParamKeyModifiers typeUInt32

kEventControlSimulateHit --> kEventParamDirectObject typeControlRef

kEventControlHitTest --> kEventParamDirectObject typeControlRef --> kEventParamMouseLocation typeQDPoint <– kEventParamControlPart typeControlPartCode

kEventControlDraw Required parameters: --> kEventParamDirectObject typeControlRef

Optional parameters: --> kEventParamControlPart typeControlPartCode (draw the entire control if kEventParamControlPart is not present) --> kEventParamGrafPort typeGrafPtr (draw into the current port if kEventParamGrafPort is not present)

kEventControlApplyBackground Required parameters: --> kEventParamDirectObject typeControlRef --> kEventParamControlSubControl typeControlRef --> kEventParamControlDrawDepth typeShortInteger --> kEventParamControlDrawInColor typeBoolean

Optional parameters: --> kEventParamGrafPort typeGrafPtr (apply to the current port if kEventParamGrafPort is not present)

kEventControlApplyTextColor Required parameters: --> kEventParamDirectObject typeControlRef --> kEventParamControlSubControl typeControlRef --> kEventParamControlDrawDepth typeShortInteger --> kEventParamControlDrawInColor typeBoolean

Optional parameters: --> kEventParamCGContextRef typeCGContextRef --> kEventParamGrafPort typeGrafPtr (apply to the current port if kEventParamGrafPort is not present)

kEventControlSetFocusPart --> kEventParamDirectObject typeControlRef <-> kEventParamControlPart typeControlPartCode

kEventControlGetFocusPart --> kEventParamDirectObject typeControlRef <– kEventParamControlPart typeControlPartCode

kEventControlActivate --> kEventParamDirectObject typeControlRef

kEventControlDeactivate --> kEventParamDirectObject typeControlRef

kEventControlSetCursor --> kEventParamDirectObject typeControlRef --> kEventParamMouseLocation typeQDPoint --> kEventParamKeyModifiers typeUInt32

kEventControlContextualMenuClick --> kEventParamDirectObject typeControlRef --> kEventParamMouseLocation typeQDPoint

kEventControlClick --> kEventParamDirectObject typeControlRef --> [other parameters from kEventMouseDown]

kEventControlTrack --> kEventParamDirectObject typeControlRef --> kEventParamMouseLocation typeQDPoint <-> kEventParamKeyModifiers typeUInt32 --> kEventParamControlAction typeControlActionUPP <– kEventParamControlPart typeControlPartCode

kEventControlGetScrollToHereStartPoint --> kEventParamDirectObject typeControlRef <-> kEventParamMouseLocation typeQDPoint --> kEventParamKeyModifiers typeUInt32

kEventControlGetIndicatorDragConstraint --> kEventParamDirectObject typeControlRef --> kEventParamMouseLocation typeQDPoint --> kEventParamKeyModifiers typeUInt32 <– kEventParamControlIndicatorDragConstraint typeIndicatorDragConstraint

kEventControlIndicatorMoved --> kEventParamDirectObject typeControlRef --> kEventParamControlIndicatorRegion typeQDRgnHandle --> kEventParamControlIsGhosting typeBoolean

kEventControlGhostingFinished --> kEventParamDirectObject typeControlRef --> kEventParamControlIndicatorOffset typeQDPoint

kEventControlGetActionProcPart --> kEventParamDirectObject typeControlRef --> kEventParamKeyModifiers typeUInt32 <-> kEventParamControlPart typeControlPartCode

kEventControlGetPartRegion --> kEventParamDirectObject typeControlRef --> kEventParamControlPart typeControlPartCode --> kEventParamControlRegion typeQDRgnHandle

kEventControlGetPartBounds --> kEventParamDirectObject typeControlRef --> kEventParamControlPart typeControlPartCode <– kEventParamControlPartBounds typeQDRectangle

kEventControlSetData --> kEventParamDirectObject typeControlRef --> kEventParamControlPart typeControlPartCode --> kEventParamControlDataTag typeEnumeration --> kEventParamControlDataBuffer typePtr --> kEventParamControlDataBufferSize typeLongInteger

kEventControlGetData --> kEventParamDirectObject typeControlRef --> kEventParamControlPart typeControlPartCode --> kEventParamControlDataTag typeEnumeration --> kEventParamControlDataBuffer typePtr <-> kEventParamControlDataBufferSize typeLongInteger

kEventControlValueFieldChanged --> kEventParamDirectObject typeControlRef

kEventControlAddedSubControl --> kEventParamDirectObject typeControlRef --> kEventParamControlSubControl typeControlRef

kEventControlRemovingSubControl --> kEventParamDirectObject typeControlRef --> kEventParamControlSubControl typeControlRef

kEventControlBoundsChanged --> kEventParamDirectObject typeControlRef --> kEventParamAttributes typeUInt32 --> kEventParamOriginalBounds typeQDRectangle --> kEventParamPreviousBounds typeQDRectangle --> kEventParamCurrentBounds typeQDRectangle

kEventControlOwningWindowChanged --> kEventParamDirectObject typeControlRef --> kEventParamAttributes typeUInt32 --> kEventParamControlOriginalOwningWindow typeWindowRef --> kEventParamControlCurrentOwningWindow typeWindowRef

kEventControlArbitraryMessage --> kEventParamDirectObject typeControlRef --> kEventParamControlMessage typeShortInteger --> kEventParamControlParam typeLongInteger <– kEventParamControlResult typeLongInteger Summary: Tablet events (kEventClassTablet)

Enumerator
kEventTabletPoint 

Indicates that the pen has moved on or near a tablet. Same as deprecated kEventTabletPointer. Available in Mac OS X only.

kEventTabletProximity 

Indicates that the pen has entered or exited proximity of a tablet. Available in Mac OS X only.

◆ anonymous enum

anonymous enum

Summary: Volume events (kEventClassVolume)

Enumerator
kEventVolumeMounted 

A new volume has been mounted (or new media inserted). Available on Mac OS X and CarbonLib 1.3.1 and later.

kEventVolumeUnmounted 

An existing volume has been unmounted (or media ejected). Available on Mac OS X and CarbonLib 1.3.1 and later.

◆ anonymous enum

anonymous enum

Parameters for volume events:

kEventVolumeMounted --> kEventParamDirectObject typeFSVolumeRefNum

kEventVolumeUnmounted --> kEventParamDirectObject typeFSVolumeRefNum

◆ anonymous enum

anonymous enum

Discussion: Appearance events (kEventClassAppearance)

Enumerator
kEventAppearanceScrollBarVariantChanged 

The scroll bar variant has changed. Available on Mac OS X 10.1 and later.

◆ anonymous enum

anonymous enum

Parameters for appearance events:

kEventAppearanceScrollBarVariantChanged --> kEventParamNewScrollBarVariant typeShortInteger Summary: Services events (kEventClassService)

Discussion: Services are a feature by which applications can communicate with one another to request and provide services. This communication happens through the Scrap Manager. When an event is sent that requires communication for processing or servicing a request, you will need to use the scrap that is given in the kEventParamScrapRef parameter of the event in order to communicate. When your app requests a service, it is usually acting on data that is currently selected or in focus. Therefore all of the Services events are sent to the UserFocus event target. Service events are available on Mac OS X 10.1 and later.

Enumerator
kEventServiceCopy 

The user has invoked a service that requires the application to update the given scrap in the kEventParamScrapRef parameter with appropriate data from the focus.

kEventServicePaste 

The user has invoked a service that requires the application to update the current focus with data from the scrap that is given in the kEventParamScrapRef parameter.

kEventServiceGetTypes 

The Services Manager needs to know what types of data the application can copy and paste to and from the scrap in order to update the Services menu to enable items that the user can select. This event sends two CFMutableArrayRefs for the application to add the types to: the kEventParamServiceCopyTypes and the kEventParamServicePasteTypes parameters. The types that are added are CFStringRefs. There is a convenience function, CreateTypeStringWithOSType(), which takes an OSType and will create a CFStringRef that you can add to the array(s).

kEventServicePerform 

If the application is a service provider, this event will get sent when a Service is requested of the app. The scrap that should be used to send and receive data from the requester is provided in the kEventParamScrapRef parameter. The kEventParamServiceMessageName parameter contains a CFStringRef that indicates which advertised service was invoked.

Function Documentation

◆ AddEventTypesToHandler()

OSStatus AddEventTypesToHandler ( EventHandlerRef  inHandlerRef,
UInt32  inNumTypes,
const EventTypeSpec inList 
)

AddEventTypesToHandler()

Discussion: Adds additional events to an event handler that has already been installed.

Parameters:

inHandlerRef: The event handler to add the additional events to.

inNumTypes: The number of events to add.

inList: A pointer to an array of EventTypeSpec entries.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ BeginAppModalStateForWindow()

OSStatus BeginAppModalStateForWindow ( WindowRef  inWindow)

BeginAppModalStateForWindow()

Discussion: This routine is a lower level routine than RunAppModalLoopForWindow. It can be used if you wish to enter an app modal state for a window, but need to control the event loop yourself for whatever reason. In most cases, you would use RunAppModalLoopForWindow. Once you begin your app modal state, the menu bar will disable and prepare for the modal situation. The window must be visible when calling BeginAppModalStateForWindow; otherwise, windowWrongStateErr is returned. In Mac OS 10.0.x and CarbonLib 1.3.1, BeginAppModalStateForWindow can only be called on a window once; future calls will return an error. This bug is fixed in Mac OS 10.1 and CarbonLib 1.4.

Parameters:

inWindow: The window you wish to behave modally.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ CALLBACK_API() [1/3]

typedef CALLBACK_API ( Boolean  ,
EventComparatorProcPtr   
)

EventComparatorProcPtr

Discussion: Type of a callback function used by queue searches.

Parameters:

inEvent: The event to compare.

inCompareData: The data used to compare the event.

Result: A boolean value indicating whether the event matches (true) or not (false).

◆ CALLBACK_API() [2/3]

typedef CALLBACK_API ( OSStatus  ,
EventHandlerProcPtr   
)

EventHandlerProcPtr

Discussion: Callback for receiving events sent to a target this callback is installed on.

Parameters:

inHandlerCallRef: A reference to the current handler call chain. This is sent to your handler so that you can call CallNextEventHandler if you need to.

inEvent: The Event.

inUserData: The app-specified data you passed in a call to InstallEventHandler.

Result: An operating system result code. Returning noErr indicates you handled the event. Returning eventNotHandledErr indicates you did not handle the event and perhaps the toolbox should take other action.

◆ CALLBACK_API() [3/3]

typedef CALLBACK_API ( void  ,
EventLoopTimerProcPtr   
)

EventLoopTimerProcPtr

Discussion: Called when a timer fires.

Parameters:

inTimer: The timer that fired.

inUserData: The data passed into InstallEventLoopTimer.

◆ CallNextEventHandler()

OSStatus CallNextEventHandler ( EventHandlerCallRef  inCallRef,
EventRef  inEvent 
)

CallNextEventHandler()

Discussion: Calls thru to the event handlers below you in the event handler stack of the target to which your handler is bound. You might use this to call thru to the default toolbox handling in order to post-process the event. You can only call this routine from within an event handler.

Parameters:

inCallRef: The event handler call ref passed into your event handler.

inEvent: The event to pass thru.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ ConvertEventRefToEventRecord()

Boolean ConvertEventRefToEventRecord ( EventRef  inEvent,
EventRecord outEvent 
)

ConvertEventRefToEventRecord()

Discussion: This is a convenience routine to help you if there are places in your application where you need an EventRecord and all you have is an EventRef. If the event can be converted, outEvent is filled in and the function returns true. If not, false is returned and outEvent will contain a nullEvent.

Parameters:

inEvent: The EventRef to convert into an EventRecord.

outEvent: The EventRecord to fill out.

Result: A boolean indicating if the conversion was successful (true) or not (false).

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ CopyEvent()

EventRef CopyEvent ( EventRef  inOther)

CopyEvent()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ CreateTypeStringWithOSType()

CFStringRef CreateTypeStringWithOSType ( OSType  inType)

Parameters for service events:

kEventServiceCopy --> kEventParamScrapRef typeScrapRef

kEventServicePaste --> kEventParamScrapRef typeScrapRef

kEventServiceGetTypes --> kEventParamServiceCopyTypes typeCFMutableArrayRef of CFStringRefs --> kEventParamServicePasteTypes typeCFMutableArrayRef of CFStringRefs

kEventServicePerform --> kEventParamScrapRef typeScrapRef --> kEventParamServiceMessageName typeCFStringRef --> kEventParamServiceUserData typeCFStringRef CreateTypeStringWithOSType()

Discussion: This routine is used to convert an OSType to a CFStringRef that Services will understand.

Parameters:

inType: The OSType that needs to be converted to a CFString.

Result: A CFStringRef that contains the string that corresponds to the given OSType. This follows CoreFoundation semantics in that it will return NULL for failure, and because it is a "Create" function you will need to CFRelease() this string when it is no longer needed.

Availability:

Non-Carbon CFM: not available
Carbon Lib: not available in CarbonLib 1.x, is available on Mac OS
X version 10.1 and later
Mac OS X: in version 10.1 and later

◆ DisposeEventComparatorUPP()

void DisposeEventComparatorUPP ( EventComparatorUPP  userUPP)

DisposeEventComparatorUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ DisposeEventHandlerUPP()

void DisposeEventHandlerUPP ( EventHandlerUPP  userUPP)

DisposeEventHandlerUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ DisposeEventLoopTimerUPP()

void DisposeEventLoopTimerUPP ( EventLoopTimerUPP  userUPP)

DisposeEventLoopTimerUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ EndAppModalStateForWindow()

OSStatus EndAppModalStateForWindow ( WindowRef  inWindow)

EndAppModalStateForWindow()

Discussion: This routine ends an app modal state started with BeginAppModalStateForWindow.

Parameters:

inWindow: The window you wish to stop acting as app modal.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ FindSpecificEventInQueue()

EventRef FindSpecificEventInQueue ( EventQueueRef  inQueue,
EventComparatorUPP  inComparator,
void *  inCompareData 
)

FindSpecificEventInQueue()

Discussion: Returns the first event that matches a comparator function, or NULL if no events match.

Parameters:

inQueue: The event queue to search.

inComparator: The comparison function to invoke for each event in the queue.

inCompareData: The data you wish to pass to your comparison function.

Result: An event reference.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ FlushEventQueue()

OSStatus FlushEventQueue ( EventQueueRef  inQueue)

FlushEventQueue()

Discussion: Flushes all events from an event queue.

Parameters:

inQueue: The event queue to flush.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ FlushEventsMatchingListFromQueue()

OSStatus FlushEventsMatchingListFromQueue ( EventQueueRef  inQueue,
UInt32  inNumTypes,
const EventTypeSpec inList 
)

FlushEventsMatchingListFromQueue()

Discussion: Flushes events matching a specified list of classes and kinds from an event queue.

Parameters:

inQueue: The event queue to flush events from.

inNumTypes: The number of event kinds to flush.

inList: The list of event classes and kinds to flush from the queue.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ FlushSpecificEventsFromQueue()

OSStatus FlushSpecificEventsFromQueue ( EventQueueRef  inQueue,
EventComparatorUPP  inComparator,
void *  inCompareData 
)

FlushSpecificEventsFromQueue()

Discussion: Flushes events that match a comparator function.

Parameters:

inQueue: The event queue to flush events from.

inComparator: The comparison function to invoke for each event in the queue.

inCompareData: The data you wish to pass to your comparison function.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetApplicationEventTarget()

EventTargetRef GetApplicationEventTarget ( void  )

GetApplicationEventTarget()

Discussion: Returns the EventTargetRef for the application. Once you obtain this reference, you can send events to the target and install event handler on it.

Result: An EventTargetRef.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetCFRunLoopFromEventLoop()

CFTypeRef GetCFRunLoopFromEventLoop ( EventLoopRef  inEventLoop)

GetCFRunLoopFromEventLoop()

Discussion: Returns the corresponding CFRunLoopRef for the given EventLoop. This is not necessarily a one-to-one mapping, hence the need for this function. In Carbon, all cooperative threads use the same run loop under the covers, so using CFRunLoopGetCurrent might yield the wrong result. In general, you would only need to use this function if you wished to add your own sources to the run loop. If you don't know what I'm talking about, then you probably don't need to use this.

Parameters:

inEventLoop: The event loop to get the CFRunLoop for.

Result: The CFRunLoopRef for inEventLoop.

Availability:

Non-Carbon CFM: not available
Carbon Lib: not available in CarbonLib 1.x, is available on Mac OS
X version 10.1 and later
Mac OS X: in version 10.1 and later

◆ GetControlEventTarget()

EventTargetRef GetControlEventTarget ( ControlRef  inControl)

GetControlEventTarget()

Discussion: Returns the EventTargetRef for the specified control. Once you obtain this reference, you can send events to the target and install event handler on it.

Parameters:

inControl: The control to return the target for.

Result: An EventTargetRef.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetCurrentEventLoop()

EventLoopRef GetCurrentEventLoop ( void  )

GetCurrentEventLoop()

Discussion: Returns the current event loop for the current thread. If the current thread is a cooperative thread, the main event loop is returned.

Result: An event loop reference.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetCurrentEventQueue()

EventQueueRef GetCurrentEventQueue ( void  )

GetCurrentEventQueue()

Discussion: Returns the current event queue for the current thread. If the current thread is a cooperative thread, the main event queue is returned.

Result: An event queue reference.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetCurrentEventTime()

EventTime GetCurrentEventTime ( void  )

GetCurrentEventTime()

Discussion: Returns the current time since last system startup in seconds.

Result: EventTime.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetEventClass()

UInt32 GetEventClass ( EventRef  inEvent)

GetEventClass()

Discussion: Returns the class of the given event, such as mouse, keyboard, etc.

Parameters:

inEvent: The event in question.

Result: The class ID of the event.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetEventDispatcherTarget()

EventTargetRef GetEventDispatcherTarget ( void  )

GetEventDispatcherTarget()

Discussion: Returns the EventTargetRef for the standard toolbox dispatcher. You typically would never need to use this, but there are some exotic apps that need to pick events off the event queue and call the dispatcher themselves. This allows you to do just that instead of calling RunApplicationEventLoop to handle it all.

Result: An EventTargetRef.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ GetEventKind()

UInt32 GetEventKind ( EventRef  inEvent)

GetEventKind()

Discussion: Returns the kind of the given event (mousedown, etc.). Event kinds overlap between event classes, e.g. kEventMouseDown and kEventAppActivated have the same value (1). The combination of class and kind is what determines an event signature.

Parameters:

inEvent: The event in question.

Result: The kind of the event.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetEventParameter()

OSStatus GetEventParameter ( EventRef  inEvent,
EventParamName  inName,
EventParamType  inDesiredType,
EventParamType *  outActualType,
UInt32  inBufferSize,
UInt32 *  outActualSize,
void *  outData 
)

GetEventParameter()

Discussion: Gets a piece of data from the given event, if it exists.

Parameters:

inEvent: The event to get the parameter from.

inName: The symbolic name of the parameter.

inDesiredType: The desired type of the parameter. At present we do not support coercion, so this parameter must be the actual type of data stored in the event, or an error will be returned.

outActualType: The actual type of the parameter, can be NULL if you are not interested in receiving this information.

inBufferSize: The size of the output buffer specified by ioBuffer.

outActualSize: The actual size of the data, or NULL if you don't want this information.

outData: The pointer to the buffer which will receive the parameter data.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetEventRetainCount()

UInt32 GetEventRetainCount ( EventRef  inEvent)

GetEventRetainCount()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetEventTime()

EventTime GetEventTime ( EventRef  inEvent)

GetEventTime()

Discussion: Returns the time the event specified occurred, specified in EventTime, which is a floating point number representing seconds since the last system startup.

Parameters:

inEvent: The event in question.

Result: The time the event occurred.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetLastUserEventTime()

EventTime GetLastUserEventTime ( void  )

GetLastUserEventTime()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetMainEventLoop()

EventLoopRef GetMainEventLoop ( void  )

GetMainEventLoop()

Discussion: Returns the event loop object for the main application thread.

Result: An event loop reference.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetMainEventQueue()

EventQueueRef GetMainEventQueue ( void  )

GetMainEventQueue()

Discussion: Returns the event queue object for the main application thread.

Result: An event queue reference.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetMenuEventTarget()

EventTargetRef GetMenuEventTarget ( MenuRef  inMenu)

GetMenuEventTarget()

Discussion: Returns the EventTargetRef for the specified menu. Once you obtain this reference, you can send events to the target and install event handler on it.

Parameters:

inMenu: The menu to return the target for.

Result: An EventTargetRef.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetNumEventsInQueue()

UInt32 GetNumEventsInQueue ( EventQueueRef  inQueue)

GetNumEventsInQueue()

Discussion: Returns the number of events in an event queue.

Parameters:

inQueue: The event queue to query.

Result: The number of items in the queue.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetUserFocusEventTarget()

EventTargetRef GetUserFocusEventTarget ( void  )

GetUserFocusEventTarget()

Discussion: Returns the EventTargetRef for the current user focus at the time of the call. Keyboard events are always sent to this target.

Result: An EventTargetRef.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetUserFocusWindow()

WindowRef GetUserFocusWindow ( void  )

GetUserFocusWindow()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetWindowCancelButton()

OSStatus GetWindowCancelButton ( WindowRef  inWindow,
ControlRef outControl 
)

GetWindowCancelButton()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetWindowDefaultButton()

OSStatus GetWindowDefaultButton ( WindowRef  inWindow,
ControlRef outControl 
)

GetWindowDefaultButton()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ GetWindowEventTarget()

EventTargetRef GetWindowEventTarget ( WindowRef  inWindow)

GetWindowEventTarget()

Discussion: Returns the EventTargetRef for the specified window. Once you obtain this reference, you can send events to the target and install an event handler on it.

Parameters:

inWindow: The window to return the target for.

Result: An EventTargetRef.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ InstallEventHandler()

OSStatus InstallEventHandler ( EventTargetRef  inTarget,
EventHandlerUPP  inHandler,
UInt32  inNumTypes,
const EventTypeSpec inList,
void *  inUserData,
EventHandlerRef *  outRef 
)

InstallEventHandler()

Discussion: Installs an event handler on a specified target. Your handler proc will be called with the events you registered with when an event of the corresponding type and class are send to the target you are installing your handler on.

Parameters:

inTarget: The target to register your handler with.

inHandler: A pointer to your handler function.

inNumTypes: The number of events you are registering for.

inList: A pointer to an array of EventTypeSpec entries representing the events you are interested in.

inUserData: The value passed in this parameter is passed on to your event handler proc when it is called.

outRef: Receives an EventHandlerRef, which you can use later to remove the handler. You can pass null if you don't want the reference

  • when the target is disposed, the handler will be disposed as well.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ InstallEventLoopTimer()

OSStatus InstallEventLoopTimer ( EventLoopRef  inEventLoop,
EventTimerInterval  inFireDelay,
EventTimerInterval  inInterval,
EventLoopTimerUPP  inTimerProc,
void *  inTimerData,
EventLoopTimerRef outTimer 
)

InstallEventLoopTimer()

Discussion: Installs a timer onto the event loop specified. The timer can either fire once or repeatedly at a specified interval depending on the parameters passed to this function.

Parameters:

inEventLoop: The event loop to add the timer.

inFireDelay: The delay before first firing this timer (can be 0, to request that the timer be fired as soon as control returns to your event loop). In Mac OS X and CarbonLib 1.5 and later, you may pass kEventDurationForever to stop the timer from firing at all until SetEventLoopTimerNextFireTime is used to start it; in earlier CarbonLibs, to achieve the same effect, just pass zero and then immediately call SetEventLoopTimerNextFireTime( timer, kEventDurationForever ) before returning control to your event loop.

inInterval: The timer interval (pass 0 for a one-shot timer, which executes once but does not repeat). In Mac OS X and CarbonLib 1.5 and later, you may also pass kEventDurationForever to create a one-shot timer.

inTimerProc: The routine to call when the timer fires.

inTimerData: Data to pass to the timer proc when called.

outTimer: A reference to the newly installed timer.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ InstallStandardEventHandler()

OSStatus InstallStandardEventHandler ( EventTargetRef  inTarget)

InstallStandardEventHandler()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ InvokeEventComparatorUPP()

Boolean InvokeEventComparatorUPP ( EventRef  inEvent,
void *  inCompareData,
EventComparatorUPP  userUPP 
)

InvokeEventComparatorUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ InvokeEventHandlerUPP()

OSStatus InvokeEventHandlerUPP ( EventHandlerCallRef  inHandlerCallRef,
EventRef  inEvent,
void *  inUserData,
EventHandlerUPP  userUPP 
)

InvokeEventHandlerUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ InvokeEventLoopTimerUPP()

void InvokeEventLoopTimerUPP ( EventLoopTimerRef  inTimer,
void *  inUserData,
EventLoopTimerUPP  userUPP 
)

InvokeEventLoopTimerUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ IsEventInMask()

Boolean IsEventInMask ( EventRef  inEvent,
EventMask  inMask 
)

IsEventInMask()

Discussion: This is a companion function for ConvertEventRefToEventRecord, and is provided as a convenience routine to help you if there are places in your application where you want to check an EventRef to see if it matches a classic EventMask bitfield. If the event matches, the function returns true.

Parameters:

inEvent: The EventRef to convert into an EventRecord.

inMask: The mask to consider.

Result: A boolean indicating if the event was considered to be in the mask provided.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ IsEventInQueue()

Boolean IsEventInQueue ( EventQueueRef  inQueue,
EventRef  inEvent 
)

IsEventInQueue()

Discussion: Returns true if the specified event is posted to a queue.

Parameters:

inQueue: The queue to check.

inEvent: The event in question.

Result: A boolean value.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ IsMouseCoalescingEnabled()

Boolean IsMouseCoalescingEnabled ( void  )

IsMouseCoalescingEnabled()

Discussion: Returns true if mouse coalescing is current enabled. When enabled, we coalesce mouse moved and mouse dragged events. By default, coalescing is on, but you can use SetMouseCoalescingEnabled to disable it if you want finer-grained mouse movement events, which is useful for drawing with tablets.

Result: A boolean indicating if coalescing is enabled.

Availability:

Non-Carbon CFM: not available
Carbon Lib: not available in CarbonLib 1.x, is available on Mac OS
X version 10.1 and later
Mac OS X: in version 10.1 and later

◆ IsUserCancelEventRef()

Boolean IsUserCancelEventRef ( EventRef  event)

IsUserCancelEventRef()

Discussion: Tests the event given to see whether the event represents a 'user cancel' event. Currently this is defined to be either the escape key being pressed, or command-period being pressed.

Result: A boolean value indicating whether the event is a user cancel event.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ MacCreateEvent()

OSStatus MacCreateEvent ( CFAllocatorRef  inAllocator,
UInt32  inClassID,
UInt32  kind,
EventTime  when,
EventAttributes  flags,
EventRef outEvent 
)

[Mac]CreateEvent()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ NewEventComparatorUPP()

EventComparatorUPP NewEventComparatorUPP ( EventComparatorProcPtr  userRoutine)

NewEventComparatorUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ NewEventHandlerUPP()

EventHandlerUPP NewEventHandlerUPP ( EventHandlerProcPtr  userRoutine)

NewEventHandlerUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ NewEventLoopTimerUPP()

EventLoopTimerUPP NewEventLoopTimerUPP ( EventLoopTimerProcPtr  userRoutine)

NewEventLoopTimerUPP()

Availability:

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ PostEventToQueue()

OSStatus PostEventToQueue ( EventQueueRef  inQueue,
EventRef  inEvent,
EventPriority  inPriority 
)

PostEventToQueue()

Discussion: Posts an event to the queue specified. This automatically wakes up the event loop of the thread the queue belongs to. After posting the event, you should release the event. The event queue retains it.

Parameters:

inQueue: The event queue to post the event onto.

inEvent: The event to post.

inPriority: The priority of the event.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ ProcessHICommand()

OSStatus ProcessHICommand ( const HICommand inCommand)

ProcessHICommand()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ QuitApplicationEventLoop()

void QuitApplicationEventLoop ( void  )

QuitApplicationEventLoop()

Discussion: This routine is used to quit the RunApplicationEventLoop function. Typically, your application doesn't need to call this. If your application has the Quit menu item tagged with the kHICommandQuit Menu Command ID, the toolbox will automatically call this for your application, automatically terminating your event loop. If your application wants to do pre-processing before the event loop exits, it should intercept either the kHICommandQuit menu command, or the kEventApplicationQuit event.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ QuitAppModalLoopForWindow()

OSStatus QuitAppModalLoopForWindow ( WindowRef  inWindow)

QuitAppModalLoopForWindow()

Discussion: This routine is used to quit a currently running call to RunAppModalLoopForWindow, i.e. it terminates a modal loop. Typically this would be called from a handler you have installed on the modal window in question when the user clicks the appropriate button, etc.

Parameters:

inWindow: The window for which to quit the modal state.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ QuitEventLoop()

OSStatus QuitEventLoop ( EventLoopRef  inEventLoop)

QuitEventLoop()

Discussion: Causes a specific event loop to terminate. Usage of this is similar to WakeUpProcess, in that it causes the eventloop specified to return immediately (as opposed to timing out). Typically this call is used in conjunction with RunCurrentEventLoop.

Parameters:

inEventLoop: The event loop to terminate.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ ReceiveNextEvent()

OSStatus ReceiveNextEvent ( UInt32  inNumTypes,
const EventTypeSpec inList,
EventTimeout  inTimeout,
Boolean  inPullEvent,
EventRef outEvent 
)

ReceiveNextEvent()

Discussion: This routine tries to fetch the next event of a specified type. If no events in the event queue match, this routine will run the current event loop until an event that matches arrives, or the timeout expires. Except for timers firing, your application is blocked waiting for events to arrive when inside this function.

Parameters:

inNumTypes: The number of event types we are waiting for (0 if any event should cause this routine to return).

inList: The list of event types we are waiting for (pass NULL if any event should cause this routine to return).

inTimeout: The time to wait (passing kEventDurationForever is preferred).

inPullEvent: Pass true for this parameter to actually remove the next matching event from the queue.

outEvent: The next event that matches the list passed in. If inPullEvent is true, the event is owned by you, and you will need to release it when done.

Result: A result indicating whether an event was received, the timeout expired, or the current event loop was quit.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ RegisterEventHotKey()

OSStatus RegisterEventHotKey ( UInt32  inHotKeyCode,
UInt32  inHotKeyModifiers,
EventHotKeyID  inHotKeyID,
EventTargetRef  inTarget,
OptionBits  inOptions,
EventHotKeyRef *  outRef 
)

RegisterEventHotKey()

Discussion: Registers a global hot key based on the virtual key code and modifiers you pass in. Only one such combination can exist for the current application, i.e. multiple entities in the same application cannot register for the same hot key combination. The same hot key can, however, be registered by multiple applications. This means that multiple applications can potentially be notified when a particular hot key is requested. This might not necessarily be desirable, but it is how it works at present.

Parameters:

inHotKeyCode: The virtual key code of the key to watch

inHotKeyModifiers: The keyboard modifiers to look for. There must be a modifier specified, or this function will return paramErr.

inHotKeyID: The application-specified hot key ID. You will receive this in the kEventHotKeyPressed event as the direct object parameter.

inTarget: The target to notify when the hot key is pressed.

inOptions: Currently unused. Pass 0 or face the consequences.

outRef: The EventHotKeyRef that represents your new, shiny hot key. You need this if you later wish to unregister it.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ RegisterToolboxObjectClass()

OSStatus RegisterToolboxObjectClass ( CFStringRef  inClassID,
ToolboxObjectClassRef  inBaseClass,
UInt32  inNumEvents,
const EventTypeSpec inEventList,
EventHandlerUPP  inEventHandler,
void *  inEventHandlerData,
ToolboxObjectClassRef *  outClassRef 
)

RegisterToolboxObjectClass()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ ReleaseEvent()

void ReleaseEvent ( EventRef  inEvent)

ReleaseEvent()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ RemoveEventFromQueue()

OSStatus RemoveEventFromQueue ( EventQueueRef  inQueue,
EventRef  inEvent 
)

RemoveEventFromQueue()

Discussion: Removes the given event from the queue which it was posted. When you call this function, the event ownership is transferred to you, the caller, at no charge. You must release the event when you are through with it.

Parameters:

inQueue: The queue to remove the event from.

inEvent: The event to remove.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ RemoveEventHandler()

OSStatus RemoveEventHandler ( EventHandlerRef  inHandlerRef)

RemoveEventHandler()

Discussion: Removes an event handler from the target it was bound to.

Parameters:

inHandlerRef: The handler ref to remove (returned in a call to InstallEventHandler). After you call this function, the handler ref is considered to be invalid and can no longer be used.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ RemoveEventLoopTimer()

OSStatus RemoveEventLoopTimer ( EventLoopTimerRef  inTimer)

RemoveEventLoopTimer()

Discussion: Removes a timer that was previously installed by a call to InstallEventLoopTimer. You call this function when you are done using a timer.

Parameters:

inTimer: The timer to remove.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ RemoveEventTypesFromHandler()

OSStatus RemoveEventTypesFromHandler ( EventHandlerRef  inHandlerRef,
UInt32  inNumTypes,
const EventTypeSpec inList 
)

RemoveEventTypesFromHandler()

Discussion: Removes events from an event handler that has already been installed.

Parameters:

inHandlerRef: The event handler to remove the events from.

inNumTypes: The number of events to remove.

inList: A pointer to an array of EventTypeSpec entries.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ RetainEvent()

EventRef RetainEvent ( EventRef  inEvent)

RetainEvent()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ RunApplicationEventLoop()

void RunApplicationEventLoop ( void  )

RunApplicationEventLoop()

Discussion: This routine is used as the main event loop for a Carbon Event-based application. Once entered, this function waits for events to arrive and dispatches them to your event handlers automatically.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ RunAppModalLoopForWindow()

OSStatus RunAppModalLoopForWindow ( WindowRef  inWindow)

RunAppModalLoopForWindow()

Discussion: This routine is used as a replacement to ModalDialog to drive a Carbon Event-based modal dialog. Once called, this routine will not exit until QuitAppModalLoopForWindow is called. In Mac OS X 10.0.x, RunAppModalLoopForWindow will fail to re-enable the menubar before exiting if you dispose of the window during the modal loop (for example, from a Carbon event handler). You can work around this bug by retaining the window before calling RunAppModalLoopForWindow, and releasing it afterwards.

Parameters:

inWindow: The window you wish to behave modally.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ RunCurrentEventLoop()

OSStatus RunCurrentEventLoop ( EventTimeout  inTimeout)

RunCurrentEventLoop()

Discussion: This routine 'runs' the event loop, returning only if aborted or the timeout specified is reached. The event loop is mostly blocked while in this function, occasionally waking up to fire timers or pick up events. The typical use of this function is to cause the current thread to wait for some operation to complete, most likely on another thread of execution.

Parameters:

inTimeout: The time to wait until returning (can be kEventDurationForever).

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ SendEventToEventTarget()

OSStatus SendEventToEventTarget ( EventRef  inEvent,
EventTargetRef  inTarget 
)

SendEventToEventTarget()

Discussion: Sends an event to the specified event target.

Parameters:

inEvent: The event to send.

inTarget: The target to send it to.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ SetEventLoopTimerNextFireTime()

OSStatus SetEventLoopTimerNextFireTime ( EventLoopTimerRef  inTimer,
EventTimerInterval  inNextFire 
)

SetEventLoopTimerNextFireTime()

Discussion: This routine is used to 'reset' a timer. It controls the next time the timer fires. This will override any interval you might have set. For example, if you have a timer that fires every second, and you call this function setting the next time to five seconds from now, the timer will sleep for five seconds, then fire. It will then resume its one-second interval after that. It is as if you removed the timer and reinstalled it with a new first-fire delay.

Parameters:

inTimer: The timer to adjust

inNextFire: The interval from the current time to wait until firing the timer again. You may pass kEventDurationForever to stop the timer from firing at all.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ SetEventParameter()

OSStatus SetEventParameter ( EventRef  inEvent,
EventParamName  inName,
EventParamType  inType,
UInt32  inSize,
const void *  inDataPtr 
)

SetEventParameter()

Discussion: Sets a piece of data for the given event.

Parameters:

inEvent: The event to set the data for.

inName: The symbolic name of the parameter.

inType: The symbolic type of the parameter.

inSize: The size of the parameter data.

inDataPtr: The pointer to the parameter data.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ SetEventTime()

OSStatus SetEventTime ( EventRef  inEvent,
EventTime  inTime 
)

SetEventTime()

Discussion: This routine allows you to set the time of a given event, if you so desire. In general, you would never use this routine, except for those special cases where you reuse an event from time to time instead of creating a new event each time.

Parameters:

inEvent: The event in question.

inTime: The new time.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ SetMouseCoalescingEnabled()

OSStatus SetMouseCoalescingEnabled ( Boolean  inNewState,
Boolean outOldState 
)

SetMouseCoalescingEnabled()

Discussion: Allows you to set mouse move/drag event coalescing on or off. By default, coalescing is on, but you can use this function to disable it if you want finer-grained mouse movement events, which is useful for drawing with tablets.

Parameters:

inNewState: A boolean indicating if coalescing should be enabled (true) or disabled (false).

outOldState: A boolean which receives the prior state of mouse coalescing for restoration later. You can pass NULL for this parameter if you don't care.

Result: An operating system status result.

Availability:

Non-Carbon CFM: not available
Carbon Lib: not available in CarbonLib 1.x, is available on Mac OS
X version 10.1 and later
Mac OS X: in version 10.1 and later

◆ SetUserFocusWindow()

OSStatus SetUserFocusWindow ( WindowRef  inWindow)

SetUserFocusWindow()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ SetWindowCancelButton()

OSStatus SetWindowCancelButton ( WindowRef  inWindow,
ControlRef  inControl 
)

SetWindowCancelButton()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ SetWindowDefaultButton()

OSStatus SetWindowDefaultButton ( WindowRef  inWindow,
ControlRef  inControl 
)

SetWindowDefaultButton()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ TrackMouseLocation()

OSStatus TrackMouseLocation ( GrafPtr  inPort,
Point outPt,
MouseTrackingResult *  outResult 
)

TrackMouseLocation()

Discussion: Once entered, this routine waits for certain mouse events (move, mouse down, mouse up). When one of these events occurs, the function returns and tells the caller what happened and where the mouse is currently located. While there is no activity, the current event loop is run, effectively blocking the current thread (save for any timers that fire). This helps to minimize CPU usage when there is nothing going on.

Parameters:

inPort: The grafport to consider for mouse coordinates. You can pass NULL for this parameter to indicate the current port. The mouse location is returned in terms of local coordinates of this port.

outPt: On exit, this parameter receives the mouse location from the last mouse event that caused this function to exit.

outResult: On exit, this parameter receives a value representing what kind of event was received that cause the function to exit, such as kMouseTrackingMouseReleased.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ TrackMouseLocationWithOptions()

OSStatus TrackMouseLocationWithOptions ( GrafPtr  inPort,
OptionBits  inOptions,
EventTimeout  inTimeout,
Point outPt,
UInt32 *  outModifiers,
MouseTrackingResult *  outResult 
)

TrackMouseLocationWithOptions()

Discussion: Once entered, this routine waits for certain mouse events (move, mouse down, mouse up). When one of these events occurs, the function returns and tells the caller what happened and where the mouse is currently located. While there is no activity, the current event loop is run, effectively blocking the current thread (save for any timers that fire). This helps to minimize CPU usage when there is nothing going on.

Parameters:

inPort: The grafport to consider for mouse coordinates. You can pass NULL for this parameter to indicate the current port. The mouse location is returned in terms of local coordinates of this port.

inOptions: The only option supported by this routine at present is the option to have the toolbox leave mouse up events in the queue, rather than pulling them (which is the default).

inTimeout: The amount of time to wait for an event. If no events arrive within this time, kMouseTrackingTimedOut is returned in outResult.

outPt: On exit, this parameter receives the mouse location from the last mouse event that caused this function to exit. If a timeout or key modifiers changed event caused this function to exit, the current mouse position at the time is returned.

outModifiers: On exit, this parameter receives the most recent state of the keyboard modifiers.

outResult: On exit, this parameter receives a value representing what kind of event was received that cause the function to exit, such as kMouseTrackingMouseReleased.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ TrackMouseRegion()

OSStatus TrackMouseRegion ( GrafPtr  inPort,
RgnHandle  inRegion,
Boolean ioWasInRgn,
MouseTrackingResult *  outResult 
)

TrackMouseRegion()

Discussion: This routine is largely identical to TrackMouseLocation. Please read the notes on that function as well. The difference between TrackMouseLocation and TrackMouseRegion is that TrackMouseRegion only returns when the mouse enters or exits a specified region that you pass in to the function, as opposed to whenever the mouse moves (it also returns for mouse up/down events). This is useful if you don't need to know intermediate mouse events, but rather just if the mouse enters or leaves an area.

Parameters:

inPort: The grafport to consider for mouse coordinates. You can pass NULL for this parameter to indicate the current port.

inRegion: The region to consider. This should be in the coordinates of the port you passed to inPort.

ioWasInRgn: On enter, this parameter should be set to true if the mouse is currently inside the region passed in inRegion, or false if the mouse is currently outside the region. On exit, this parameter is updated to reflect the current reality, e.g. if the outResult parameter returns kMouseTrackingMouseExited, ioWasInRgn will be set to false when this function exits. Because it is updated from within, you should only need to set this yourself before the first call to this function in your tracking loop.

outResult: On exit, this parameter receives a value representing what kind of event was received that cause the function to exit, such as kMouseTrackingMouseEntered.

Result: An operating system result code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ UnregisterEventHotKey()

OSStatus UnregisterEventHotKey ( EventHotKeyRef  inHotKey)

UnregisterEventHotKey()

Discussion: Unregisters a global hot key that was previously registered with the RegisterEventHotKey API. You do not need to unregister a hot key when your application terminates, the system will take care of that for you. This would be used if the user changes a hot key for something in your application - you would unregister the previous key and register your new key.

Parameters:

inHotKey: The EventHotKeyRef to unregister.

Result: An operating system status code.

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ UnregisterToolboxObjectClass()

OSStatus UnregisterToolboxObjectClass ( ToolboxObjectClassRef  inClassRef)

UnregisterToolboxObjectClass()

Availability:

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later