In order to handle events, you need to tell the Carbon Event Manager what kinds of events you want to be notified about. You do so by specifying the class and kind of each event you want to handle. Table 2.1 through Table 2.9 list the most common event classes and kinds. After you’ve identified the event class (keyboard, mouse, and so forth) and the event kind (mouse up, mouse down, and so on) appropriate to your application’s needs, you pass these to the Carbon Event Manager when installing your event handler. See Chapter 6 for more information.
Table B-1. Event Kinds in the Application Event Class (kEventClassApplication)
Event Kind | Means |
---|---|
kEventAppActivated
| This application brought to foreground |
kEventAppDeactivated
| This application sent to background |
kEventAppFrontSwitched
| Frontmost (active) application changed |
kEventAppLaunched
| Another application started up |
kEventAppTerminated
| Another application terminated |
kEventAppQuit
| This application about to be terminated |
Table B-2. Event Kinds in the Command Event Class (kEventClassCommand)
Event Kind | Means |
---|---|
kEventCommandProcess
| Menu item chosen or a control with a command that has been pressed |
kEventCommandUpdateStatus
| Determine enabled or disabled status of command |
Table B-3. Event Kinds in the Control Event Class (kEventClassControl)
Event Kind | Means |
---|---|
kEventControlDefInitialize
| Control created |
kEventControlDefDispose
| Control to be destroyed |
kEventControlHit
| Mouse button pressed in control |
kEventControlSimulateHit
| Sent when the control should simulate a hit in response to some other action (such as when the Return key is pressed to activate a default button) |
Table B-4. Event Kinds in the Keyboard Event Class (kEventClassKeyboard)
Event Kind | Means |
---|---|
kEventRawKeyDown
| Key pressed |
kEventRawKeyRepeat
| Keystroke repeated when key held down |
kEventRawKeyUp
| Key released |
kEventRawKeyModifiersChanged
| Modifier key pressed or released |
Table B-5. Event Kinds in the Menu Event Class (kEventClassMenu)
Event Kind | Means |
---|---|
kEventMenuBeginTracking
| Mouse button pressed in menu or menu bar |
kEventMenuEndTracking
| Mouse button released after press in menu or menu bar |
kEventMenuOpening
| Menu about to be displayed |
kEventMenuClosed
| Menu has been hidden |
kEventMenuTargetItem
| Cursor dragged over menu item |
kEventMenuMatchKey
| Match menu item with command event |
kEventMenuEnableItems
| Determine enabled or disabled status of menu items |
Table B-6. Event Kinds in the Mouse Event Class (kEventClassMouse)
Event Kind | Means |
---|---|
kEventMouseDown
| Mouse button pressed |
kEventMouseUp
| Mouse button released |
kEventMouseMoved
| Mouse position changed |
kEventMouseDragged
| Mouse position changed with button held down |
kMouseWheelMoved
| The mouse scroll wheel moved |
Table B-7. Event Kinds in the Tablet Event Class (kEventClassTablet)
Event Kind | Means |
---|---|
kEventTabletPointer
| Pen has touched the tablet |
kEventTabletProximity
| Pen has entered or exited the tablet’s proximity region |
Table B-8. Event Kinds in the Text Input Event Class (kEventClassTextInput)
Event Kind | Means |
---|---|
kEventUnicodeForKeyEvent
| Text character typed from keyboard |
kEventOffsetToPos
| Map character index to screen position |
kEventPosToOffset
| Map screen position to character index |
kEventGetSelectedText
| Determine currently selected text |
kEventUpdateActiveInputArea
| Request to update the text input area |
kEventShowHideBottomWindow
| Request to show or hide a text input window |
Table B-9. Event Kinds in the Window Event Class (kEventClassWindow)
Event Kind | Means |
---|---|
kEventWindowInit
| Window created |
kEventWindowDispose
| Window to be destroyed |
kEventWindowActivated
| Window activated (brought to front) |
kEventWindowDeactivated
| Window deactivated (sent behind) |
kEventWindowShown
| Window made visible |
kEventWindowHidden
| Window made invisible |
kEventWindowDrawContent
| Draw window’s contents on screen |
kEventWindowCursorChange
| Cursor moved into content region |
kEventWindowClickContentRegion
| Mouse click in content region |
kEventWindowHandleContentClick
| Mouse click occurred in content region, but the click did not occur in a control and it is not a contextual menu click |
kEventWindowAcquired
| Keyboard focus acquired |
kEventWindowRelinquish
| Keyboard focus to be relinquished |
kEventWindowOriginChange
| Window to be moved |
kEventWindowOriginChanged
| Window moved |
kEventWindowSizeChange
| Window to be resized |
kEventWindowSizeChanged
| Window resized |
kEventWindowCollapse
| Window to be minimized |
kEventWindowCollapsed
| Window minimized |
kEventWindowCollapseAll
| All windows to be minimized |
kEventWindowExpand
| Window to be expanded |
kEventWindowExpanded
| Window expanded |
kEventWindowExpandAll
| All windows to be expanded |
kEventWindowZoom
| Window to be zoomed |
kEventWindowZoomed
| Window zoomed |
kEventWindowZoomAll
| All windows to be zoomed |
kEventWindowClose
| Window to be closed |
kEventWindowClosed
| Window closed |
kEventWindowCloseAll
| All windows to be closed |