TweetFollow Us on Twitter

MACINTOSH C CARBON
MACINTOSH C CARBON: A Hobbyist's Guide To Programming the Macintosh in C
Version 1.0
2001 K. J. Bricknell
Go to Contents Go to Program Listing

CHAPTER 17

THE CARBON EVENT MODEL

Overview

The Carbon Event Model

The Carbon event model, which was introduced with Carbon as an alternative to what is now termed the Classic event model, reduces the amount of events-related code required by an application and, in addition, facilitates a more efficient allocation of processing time on the preemptive multitasking Mac OS X. Indeed, the Carbon event model is the underlying event model on Mac OS X, the Classic event model being constructed on top of this model and emulated by the Carbon Event Manager.

Event Handling Basics

As will by now be apparent, applications using the Classic event model spend a large amount of time in the WaitNextEvent loop handling such user-interface events as mouse-downs and key-downs. In the Carbon event model, this continual and inefficient "polling" for events is avoided, events being dispatched directly to Toolbox objects.

Standard Event Handlers

These dispatched events may be handled automatically by standard event handlers provided by the Carbon Event Manager if you so specify. The provision of standard event handlers greatly simplifies the programming task. As an example, and as will be seen in the demonstration program CarbonEvents1, your application requires no code at all to handle basic window dragging, resizing, zooming, activation, and deactivation operations.

Standard event handlers are provided for each type of event target (windows, menus, controls, and the application itself).

Overriding and Complementing the Standard Handlers

At the same time, you can override or complement the default behavior provided by the standard event handlers by writing your own handlers and installing them on the relevant objects. Your application's event handler will override the standard event handler if it returns noErr, which defeats the event being passed to the standard handler. Your application's event handler will complement the standard event handler if it returns eventNotHandledErr, which causes the event to be further propagated to the standard event handler following handling by your application's event handler. (Event handlers are installed on a stack, the most recently installed on top. The most recently installed handler is called first.)

The Basic Approach

The basic approach to using the Carbon event model API is thus to install the relevant standard event handlers first and then register the types of events your application wishes to receive in order to override or complement the actions of the standard handlers.

Event Propagation Order

Events are propagated in a particular order, that order depending on the type of event. For example, control-related events are sent first to the control, then to the owning window, and then to the application. This means that you can install a handler for the control on either the control, the owning window (as in the demonstration program CarbonEvents1), or the application.

As another example, menu-related events are sent first to the menu, then to the user focus target (that is, the object with current keyboard focus, which can be either a window or a control), then to the application.

RunApplicationEventLoop

At the point where a Classic event model version of your application would call WaitNextEvent, your Carbon event model application calls the Carbon Event Manager function RunApplicationEventLoop. RunApplicationEventLoop:

  • Moves events from lower-level OS queues into the Carbon queue.
  • Dispatches those events from the Carbon queue to the standard event handlers and, for events types that your application has registered, to your application's event handlers.

When an event occurs that requires your program's attention, the Carbon Event Manager calls the handler for that event type. On return from the handler, your program is suspended until the next event requiring its attention is received. Thus your program only uses processor time when processing an event, other programs and processes running in the meantime.

Event Timers

The Carbon Event Manager supports the installation of timers, which can be set to fire either once or repeatedly, and which may be used to trigger calls to a specified function at a specified elapsed time or at specified intervals.

Event Reference, Class, and Type

Event Reference

The event reference is the core Carbon Event Manager data structure:

     typedef struct OpaqueEventRef *EventRef;

Event Class and Type

As was stated at Chapter 2, the Classic event model is limited to a maximum of 16 event types. By contrast, the Carbon event model can accommodate an unlimited number of event types. Event types are grouped by event class.

Typical event classes, as represented by constants in CarbonEvents.h, are as follows:

     kEventClassApplication
     kEventClassWindow
     kEventClassControl
     kEventClassMenu

Each event class comprises a number of event types. For example, some of the many event types pertaining to the kEventClassWindow event class, as represented by constants in CarbonEvents.h, are as follows:

     kEventWindowDrawContent
     kEventWindowActivated
     kEventWindowClickDragRgn
     kEventWindowGetIdealSize

Given an event reference, your application can ascertain the class and type of a received event by calling GetEventClass and GetEventKind.

Standard Event Handlers

Standard Application Event Handler

The standard application event handler is installed automatically when your application calls RunApplicationEventLoop. Amongst other things, the standard application event handler handles application-activated and application-deactivated events (in Classic event model parlance, resume and suspend events).

Standard Window Event Handler

The standard window event handler handles all of the possible user inter-actions with a window (dragging, resizing, zooming, activation, deactivation, etc.). It must be explicitly installed on the target window by your application. You can cause the standard window event handler to be installed on a window as follows:

  • For a window created from a 'WIND' resource using GetNewCWindow, either set the standard handler attribute in a call to the function ChangeWindowAttributes, for example:

         ChangeWindowAttributes(windowRef,kWindowStandardHandlerAttribute,0);
    
    or call InstallStandardEventHandler, passing in an event target reference (type EventTargetRef) obtained using GetWindowEventTarget, for example:
         InstallStandardEventHandler(GetWindowEventTarget(windowRef));
    

  • For a window created using CreateNewWindow, pass kWindowStandardHandlerAttribute in the attributes parameter.

The Application's Event Handlers

Handlers are Callback Functions

The handlers provided by your application are callback functions. When called, they are passed:

  • A reference to the event handler call (type EventHandlerCallRef).
  • The event reference, from which you can extract the event class and type.
  • A pointer to user data ( assuming that you passed a pointer to that data when you installed the handler).

Installing the Application's Event Handlers

You can install handlers provided by your application using InstallEventHandler:

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

inTarget

An event target reference to the target the handler is to be registered with. Use one of the following functions to obtain this reference:

     GetApplicationEventTarget
     GetWindowEventTarget
     GetControlEventTarget
     GetMenuEventTarget
     GetUserFocusEventTarget
inHandler

A universal procedure pointer to the handler function provided by your application.

inNumTypes

The number of event types to be registered by this call to InstallEventHandler.

inList

A pointer to an array of type EventTypeSpec structures specifying the event types being registered. The EventTypeSpec structure is as follows:

     struct EventTypeSpec 
     {
       UInt32 eventClass;  // Event class
       UInt32 eventKind;   // Event type
     };
     typedef struct EventTypeSpec EventTypeSpec;

For example, if you wished to register the kEventWindowDrawContent and kEventWindowActivated event types, you would define the array as follows:

     EventTypeSpec myTypes[] = { { kEventClassWindow, kEventWindowDrawContent },
                                 { kEventClassWindow, kEventWindowActivated   } };
inUserData

Optionally, a pointer to data to be passed to your event handler when it is called.

outRef

If you will later need to remove the handler, pass a pointer to a variable of type EventHandlerRef in this parameter. On return, this variable will receive the event handler reference that will be required by your call to RemoveEventHandler.

You can also use the following macros, which are derived from the function InstallEventHandler, to install your application's handlers:

     InstallApplicationEventHandler
     InstallWindowEventHandler
     InstallControlEventHandler
     InstallMenuEventHandler

Different object of the same type do not have to have the same handler. For example, you can install separate handlers on each of two windows.

Inside The Application's Event Handlers

Getting Event Parameters

In some circumstances, in order to correctly handle a particular event type, you may need to extract specific data from the event using the function GetEventParameter. For example, on receipt of an event in the kEventClassWindow class, you will almost invariably need to call GetEventParameter to get the window reference required to facilitate the handling of certain event types in that class. Similarly, on receipt of an event of type kEventMouseDown, you might need to call GetEventParameter to obtain the mouse location.

The GetEventParameter prototype is as follows:

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

inEvent

A reference to the event.

inName

The parameter's symbolic name. Symbolic names pertaining to the various event types are listed in CarbonEvents.h immediately after the enumerations for those types. For example, the symbolic name for the mouse location is kEventParamMouseLocation.

inDesiredType

The type of data. This is listed against the parameter's symbolic name in CarbonEvents.h. For example, the type of data pertaining to the symbolic name kEventParamMouseLocation is typeQDPoint.

outActualType

Actual type of value returned. Specify NULL if this information is not needed.

inBufferSize

The size of the output buffer.

outActualSize

Actual size of value returned.Specify NULL if this information is not needed.

outData

A pointer to the buffer which will receive the parameter data.

The types of data that can be extracted from an event depends on the type of event. The parameter symbolic names and data types listed in CarbonEvents.h together indicate the type, or types, of data obtainable from an event of a particular type.

Event Parameters and Command Events

The Carbon Event Manager can associate special command events with menu items with command IDs. You can, of course, assign your own command IDs to menu items using SetMenuItemCommandID; however, note that CarbonEvents.h defines command IDs for many common menu items, for example:

     kHICommandQuit  = FOUR_CHAR_CODE('quit')
     kHICommandUndo  = FOUR_CHAR_CODE('undo')
     kHICommandCut   = FOUR_CHAR_CODE('cut ')
     kHICommandPaste = FOUR_CHAR_CODE('past')

When a menu item with a command ID is chosen by the user, either with the mouse or using a Command-key equivalent, the Carbon Event Manager dispatches the relevant command event (class kEventClassCommand, type kEventProcessCommand).

When your application's handler receives a kEventProcessCommand event type, you pass kEventParamDirectObject in the inName parameter of your GetEventParameter call, typeHICommand in the inDesiredType parameter, and the address of a structure of type HICommand in the outData parameter. The HICommand structure is as follows:

     struct HICommand 
     {
       UInt32 attributes;
       UInt32 commandID;
       struct 
       {
         MenuRef menuRef;
         UInt16  menuItemIndex;
       } menu;
     };
     typedef struct HICommand HICommand;

Thus you will be able to extract the menu reference and menu item number, as well as the command ID of the chosen menu item (if any), from the data returned by the call to GetEventParameter.

Quit Command Handling

The Quit command event is a special case. When the Quit item is chosen, the standard application event handler calls either the default Quit Application Apple event handler or your application's Quit Application Apple event handler if it has installed its own. (When your application calls RunApplicationEventLoop, the default Quit Application Apple event handler is automatically installed if the application has not installed its own.)

Thus the only action required by your application's handler is to ensure that it returns eventNotHandledErr when it determines that the commandID field of the HICommand structure contains kHICommandQuit, thereby causing the event to be propagated to the standard application event handler and thence to the relevant Quit Application Apple event handler.

For this to work on Mac OS 8/9, your application must assign the command ID kHICommandQuit to the Quit item at program start when the application determines that it is running on Mac OS 8/9.

Setting Event Parameters

In certain circumstances, your handler will need to call SetEventParameter to set a piece of data for a given event. For example, suppose you wish to constrain window resizing to a specified minimum size and, accordingly, register for the kEventWindowGetMinimumSize event type. When this event type is received by your handler (it will be dispatched when a mouse-down occurs in the size box/resize control of a window on which your handler is installed), your handler should call SetEventParameter with kEventParamDimensions passed in the inName parameter and a pointer to a variable of type Point passed in the inDataPtr parameter. (The Point variable should contain the desired minimum window height and width.)

Converting an Event Reference to an Event Record

In certain circumstances, your handler may need to convert the event reference to a Classic event model event structure (type EventRecord) in order to be able to handle the event. You can use the function ConvertEventRefToEventRecord for that purpose.

Menu Adjustment

You can ensure that your application's menu adjustment function is called when appropriate by registering the kEventMenuEnableItems event type (kEventClassMenu event class) and calling your menu adjustment function when that event type is received. The kEventMenuEnableItems event type will be dispatched when a mouse-down occurs in the menu bar and when a menu-related Command-key equivalent is pressed.

Cursor Shape Changing

In Classic event model applications, the application's cursor shape-changing function is typically called when mouse-moved Operating System events are received. An alternative "trigger" is required when using the Carbon event model.

One approach is to install a Carbon events timer set to fire at an appropriate interval and call the cursor shape-changing function when the timer fires. However, this method is not recommended for Mac OS X because it is somewhat like polling for an event, which is more processor-intensive.

The recommended approach is to register for the kEventMouseMoved event type (kEventClassMouse event class) and call the cursor shape-changing function on receipt of that event type.

Window Updating

To accommodate window content region updating (re-drawing) requirements, your application should register for the kEventWindowDrawContent event type (kEventClassWindow event class) and call its update function when that event type is received.

Note that the Window Manager sends an event of type kEventWindowUpdate to all windows that need updating, regardless of whether those windows have the standard window event handler installed or not. If the standard window event handler is installed, then when the standard handler receives the kEventWindowUpdate event, it calls BeginUpdate, sends a kEventWindowDrawContent event, and calls EndUpdate. There is thus no need for your update function to call BeginUpdate and EndUpdate when responding to kEventWindowDrawContent events.

Handler Disposal

All handlers on a target are automatically disposed of when the target is disposed of.

Sending and Explicitly Propagating Events

Sending Events

You can send an event to a specified event target using either the function SendEventToEventTarget or the following macros derived from that function:

     SendEventToApplication
     SendEventToWindow
     SendEventToControl
     SendEventToMenu
     SendEventToUserFocus

Explicitly Propagating Events

You can explicitly propagate an event up the propagation chain by calling CallNextEventHandler within your event handler. This is useful in circumstances where, for example, you wish to incorporate the standard handler's response into your own pre- or post-processing.

Event Timers

Event timers may be used for many purposes, the most common one being to trigger a call to your application's idle function, perhaps for the purpose of blinking the insertion point caret. You can use InstallEventLoopTimer to install an event timer:

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

inEventLoop

The event loop on which the timer is to be installed. Usually, this will be the event loop reference returned by a call to GetCurrentEventLoop.

inFireDelay

The required delay before the timer first fires. This can be 0.

inInterval

A value of type double specifying the interval at which the timer is required to fire. For one-shot timers, 0 should be passed in this parameter. For a timer whose purpose is to trigger calls to an idle function which blinks the insertion point caret, pass the value returned by a call to GetCaretTime converted to event time by the macro TicksToEventTime.

Note that event time is in seconds since system startup. You can use the macros TicksToEventTime and EventTimeToTicks to convert between ticks and event time.

inTimerProc

A universal procedure pointer to the function to be called when the timer fires.

inTimerData

Optionally, a pointer to data to be passed to the function called when the timer fires.

OutTimer

A reference to the newly-installed timer. Usually, this will be required only if you intend to remove the timer at some point.

Note that, depending on the parameters passed to this function, the timer can be set to fire either once or repeatedly at a specified interval.

You can remove an installed timer by calling RemoveEventLoopTimer.

Getting Event Time

Your application can determine the time an event occurred using the function GetEventTime. It can also determine the time from system startup using the function GetCurrentEventTime.

Other Aspects of the Carbon Event Model

The Carbon Event Model and Apple Events

Your application requires no code at all to ensure that, when Apple events are dispatched to it, its Apple event handlers are called.

Carbon Event Model and Control Hierarchies

When you establish an embedding hierarchy for controls, you are also establishing an event handling chain. When you click in a given control, the event is sent first to that control. If that control does not handle the event (that is, its handler returns eventNotHandledErr), the event is passed up the chain to the control that contains the first control, and so on up the chain.

Carbon Event Model and Event Filter Functions

In Classic event model applications, you must pass a universal procedure pointer to an application-defined event filter (callback) function in the modalFilter parameter of ModalDialog, and call your application's window updating function within the filter function.

Calling your window updating function from within your event filter function is not necessary in Carbon event model applications provided the application installs the standard window event handler on the relevant windows, registers for the kEventWindowDrawContent event type, and calls its window updating function when that event type is received.

Mouse Tracking

The demonstration program QuickDraw (Chapter 12) uses the Event Manager function StillDown in the doDrawWithMouse function to determine whether the mouse button has been continuously pressed since the most recent mouseDown event. The Event Manager function WaitMouseUp is often used for similar purposes.

For reasons of efficient use of processor cycles, TrackMouseLocation should be used in lieu of StillDown and WaitMouseUp in applications intended to run on Mac OS X. (TrackMouseLocation does not return control to your application until the mouse is moved or the mouse button is released.) When TrackMouseLocation returns, the outResult parameter contains a value representing the type of mouse activity that occurred (press, release, etc.) and the outPt parameter contains the mouse location.

The function TrackMouseRegion is similar to TrackMouseLocation except that TrackMouseRegion only returns when the mouse enters or exits a specified region.

Alternative for Delay Function on Mac OS X

Programs sometimes call the function Delay to pause program execution for the number of ticks passed in the duration parameter. On Mac OS X, if the delay is more than about two seconds, the cursor will automatically be set to the wait cursor. To avoid this, you can instead call the function RunCurrentEventLoop with the required delay in seconds (perhaps converted from ticks using the macro TicksToEventTime) passed in the inTimeout parameter.

Main Constants, Data Types, and Functions

Constants

Error Codes

eventAlreadyPostedErr           = -9860
eventClassInvalidErr            = -9862
eventClassIncorrectErr          = -9864
eventHandlerAlreadyInstalledErr = -9866
eventInternalErr                = -9868
eventKindIncorrectErr           = -9869
eventParameterNotFoundErr       = -9870
eventNotHandledErr              = -9874
eventLoopTimedOutErr            = -9875
eventLoopQuitErr                = -9876
eventNotInQueueErr              = -9877

Event Classes

kEventClassMouse                = FOUR_CHAR_CODE('mous')
kEventClassKeyboard             = FOUR_CHAR_CODE('keyb')
kEventClassTextInput            = FOUR_CHAR_CODE('text')
kEventClassApplication          = FOUR_CHAR_CODE('appl')
kEventClassMenu                 = FOUR_CHAR_CODE('menu')
kEventClassWindow               = FOUR_CHAR_CODE('wind')
kEventClassControl              = FOUR_CHAR_CODE('cntl')
kEventClassCommand              = FOUR_CHAR_CODE('cmds')

Event Types

kEventMouseDown                 = 1
kEventMouseUp                   = 2
kEventMouseMoved                = 5
kEventMouseDragged              = 6

kEventRawKeyDown                = 1
kEventRawKeyRepeat              = 2
kEventRawKeyUp                  = 3
kEventRawKeyModifiersChanged    = 4

kEventAppActivated              = 1
kEventAppDeactivated            = 2
kEventAppQuit                   = 3
kEventAppLaunchNotification     = 4

kEventMenuEnableItems           = 8

kEventWindowUpdate              = 1
kEventWindowDrawContent         = 2
kEventWindowActivated           = 5
kEventWindowDeactivated         = 6
kEventWindowGetClickActivation  = 7
kEventWindowShown               = 24
kEventWindowHidden              = 25
kEventWindowBoundsChanging      = 26
kEventWindowBoundsChanged       = 27
kEventWindowClickDragRgn        = 32
kEventWindowClickResizeRgn      = 33
kEventWindowClickCollapseRgn    = 34
kEventWindowClickCloseRgn       = 35
kEventWindowClickZoomRgn        = 36
kEventWindowClickContentRgn     = 37
kEventWindowClickProxyIconRgn   = 38

kEventControlHit

kEventProcessCommand            = 1

HI Commands

kHICommandOK                    = FOUR_CHAR_CODE('ok  ')
kHICommandQuit                  = FOUR_CHAR_CODE('quit')
kHICommandCancel                = FOUR_CHAR_CODE('not!')
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')
kHICommandPreferences           = FOUR_CHAR_CODE('pref')
kHICommandZoomWindow            = FOUR_CHAR_CODE('zoom')
kHICommandMinimizeWindow        = FOUR_CHAR_CODE('mini')
kHICommandArrangeInFront        = FOUR_CHAR_CODE('frnt')

Mouse Tracking Result

kMouseTrackingMousePressed      = 1
kMouseTrackingMouseReleased     = 2
kMouseTrackingMouseExited       = 3
kMouseTrackingMouseEntered      = 4
kMouseTrackingMouseMoved        = 5

Data Types

typedef struct OpaqueEventRef *EventRef;
typedef struct OpaqueEventHandlerRef *EventHandlerRef;
typedef struct OpaqueEventHandlerCallRef *EventHandlerCallRef;
typedef struct OpaqueEventLoopRef *EventLoopRef;
typedef double EventTime;
typedef UInt16 MouseTrackingResult;

EventTypeSpec

struct EventTypeSpec 
{
  UInt32 eventClass;
  UInt32 eventKind;
};
typedef struct EventTypeSpec EventTypeSpec;

HICommand

struct HICommand 
{
  UInt32 attributes;
  UInt32 commandID;
  struct 
  {
    MenuRef menuRef;
    UInt16  menuItemIndex;
  } menu;
};
typedef struct HICommand HICommand;

Functions and Macros

Installing and Removing Event Handlers

OSStatus   InstallStandardEventHandler(EventTargetRef inTarget);
OSStatus   InstallEventHandler(EventTargetRef inTarget,EventHandlerUPP inHandler,
                               UInt32 inNumTypes,const EventTypeSpec *inList,
                               void *inUserData,EventHandlerRef *outRef);
#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))
OSStatus   RemoveEventHandler(EventHandlerRef inHandlerRef);
OSStatus   AddEventTypesToHandler(EventHandlerRef inHandlerRef,UInt32 inNumTypes,
                                  const EventTypeSpec *inList);
OSStatus   RemoveEventTypesFromHandler(EventHandlerRef inHandlerRef, inNumTypes,
                                       const EventTypeSpec *inList);

Creating and Disposing of Event Handler UPPs

EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr userRoutine);
void            DisposeEventHandlerUPP(EventHandlerUPP userUPP);

Running and Quitting Application Event Loop

void       RunApplicationEventLoop(void);
void       QuitApplicationEventLoop(void);

Getting Event Class and Kind

UInt32     GetEventClass(EventRef inEvent);
UInt32     GetEventKind(EventRef inEvent); 

Testing for User Cancelled

Boolean    IsUserCancelEventRef(EventRef event);

Getting Data From Events

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

Converting an Event Reference to an EventRecord

Boolean    ConvertEventRefToEventRecord(EventRef inEvent,EventRecord *outEvent);

Sending Events

OSStatus   SendEventToEventTarget(EventRef inEvent,EventTargetRef inTarget);
#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())

Installing, Resetting, and Removing Timers

OSStatus   InstallEventLoopTimer(EventLoopRef inEventLoop, EventTimerInterval inFireDelay,
                                 EventTimerInterval inInterval,
                                 EventLoopTimerUPP inTimerProc,void *inTimerData,
                                 EventLoopTimerRef *outTimer);
OSStatus   SetEventLoopTimerNextFireTime(EventLoopTimerRef inTimer,
                                         EventTimerInterval inNextFire);
OSStatus   RemoveEventLoopTimer(EventLoopTimerRef inTimer); 

Calling Through to Handlers Below Current Handler

OSStatus   CallNextEventHandler(EventHandlerCallRef inCallRef,EventRef inEvent);

Getting Event and System Time

EventTime  GetEventTime(EventRef inEvent);
EventTime  GetCurrentEventTime(void);

Converting Between Ticks and EventTime

#define TicksToEventTime(t)  (EventTime) ((t) / 60.0)
#define EventTimeToTicks(t)  (UInt32)    ((t) * 60)

Mouse Tracking

OSStatus   TrackMouseLocation(GrafPtr inPort,Point *outPt,MouseTrackingResult *outResult);
OSStatus   TrackMouseRegion(GrafPtr inPort,RgnHandle inRegion,Boolean *ioWasInRgn,
           MouseTrackingResult *outResult);

Relevant Window Manager Constants and Functions

Constants

kWindowStandardHandlerAttribute = (1L << 25)

Functions

OSStatus   ChangeWindowAttributes(WindowRef window,WindowAttributes setTheseAttributes,
                                  WindowAttributes clearTheseAttributes);
 
AAPL
$102.99
Apple Inc.
+0.52
MSFT
$44.38
Microsoft Corpora
-0.50
GOOG
$532.71
Google Inc.
+6.17

MacTech Search:
Community Search:

Software Updates via MacUpdate

OmniOutliner 4.1.3 - Organize your ideas...
OmniOutliner is a flexible program for creating, collecting, and organizing information. Give your creativity a kick start by using an application that's actually designed to help you think. It's... Read more
BBEdit 11.0 - Powerful text and HTML edi...
BBEdit is the leading professional HTML and text editor for the Mac. Specifically crafted in response to the needs of Web authors and software developers, this award-winning product provides a... Read more
Apple Security Update 2014-005 - For OS...
Apple Security Update is recommended for all users and improves the security of Mac OS X. For information on the security content of this update, please visit this website: http://support.apple.com/... Read more
EyeTV 3.6.6 - Watch and record TV on you...
EyeTV brings a rich TV experience to your Mac. Watch live TV on your Mac. Pause, rewind, and record whenever you want. EyeTV gives you powerful control over what you watch and how you watch it. Put... Read more
RapidWeaver 6.0 - Create template-based...
RapidWeaver is a next-generation Web design application to help you easily create professional-looking Web sites in minutes. No knowledge of complex code is required, RapidWeaver will take care of... Read more
NTFS 12.0.39 - Provides full read and wr...
Paragon NTFS breaks down the barriers between Windows and OS X. Paragon NTFS effectively solves the communication problems between the Mac system and NTFS, providing full read and write access to... Read more
RestoreMeNot 2.0.3 - Disable window rest...
RestoreMeNot provides a simple way to disable the window restoration for individual applications so that you can fine-tune this behavior to suit your needs. Please note that RestoreMeNot is designed... Read more
Command-C 1.1.5 - Clipboard sharing tool...
Command-C is a revolutionary app which makes easy to share your clipboard between iOS and OS X using your local WiFi network, even if the app is not currently opened. Copy anything (text, pictures,... Read more
Macgo Blu-ray Player 2.10.9.1750 - Blu-r...
Macgo Mac Blu-ray Player can bring you the most unforgettable Blu-ray experience on your Mac. Overview Macgo Mac Blu-ray Player can satisfy just about every need you could possibly have in a Blu-ray... Read more
Apple iOS 8.1 - The latest version of Ap...
The latest version of iOS can be downloaded through iTunes. Apple iOS 8 comes with big updates to apps you use every day, like Messages and Photos. A whole new way to share content with your family.... Read more

Latest Forum Discussions

See All

Fighting Fantasy: Caverns of the Snow Wi...
Fighting Fantasy: Caverns of the Snow Witch 1.0 Device: iOS Universal Category: Games Price: $5.99, Version: 1.0 (iTunes) Description: Travel to Northern Allansia’s perilous Icefinger Mountains to defeat the wicked Snow Witch in this... | Read more »
Star Warfare 2: Payback Review
Star Warfare 2: Payback Review By Blake Grundman on October 22nd, 2014 Our Rating: :: ONE-TRICK PONYUniversal App - Designed for iPhone and iPad Unfortunately, it doesn’t take long for Star Warfare 2’s free-firing fun to turn into... | Read more »
TinType by Hipstamatic (Photography)
TinType by Hipstamatic 1.0 Device: iOS iPhone Category: Photography Price: $.99, Version: 1.0 (iTunes) Description: Create hauntingly beautiful, soul capturing portraits with TinType by Hipstamatic. Inspired by daguerreotypes,... | Read more »
The Latest Update for Heroes of Dragon A...
The Latest Update for Heroes of Dragon Age Introduces Daily PvE Challenges Posted by Ellis Spice on October 22nd, 2014 [ permalink ] | Read more »
Bee Brilliant Review
Bee Brilliant Review By Jennifer Allen on October 22nd, 2014 Our Rating: :: SAMEY MATCH-3Universal App - Designed for iPhone and iPad Want even more Match-3 gaming and fancy a bee based twist? Bee Brilliant is that game. Don’t... | Read more »
A New Trailer has Been Revealed for Epic...
A New Trailer has Been Revealed for Epic of Kings Posted by Jessica Fisher on October 22nd, 2014 [ permalink ] Dead Mage Inc. has released a new, action-packed trailer for the upcoming Epic of Kings. | Read more »
Find the Line Review
Find the Line Review By Campbell Bird on October 22nd, 2014 Our Rating: :: INSLIDE THE LINESUniversal App - Designed for iPhone and iPad Tease out beautiful line drawings in this unique, free-to-play puzzle game.   | Read more »
Things Get Magical in The Sims FreePlay...
Things Get Magical in The Sims FreePlay with a New Halloween Update Posted by Ellis Spice on October 22nd, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
The Silent Age Episode 2 Review
The Silent Age Episode 2 Review By Jennifer Allen on October 22nd, 2014 Our Rating: :: ROUNDING THINGS OFF NICELYUniversal App - Designed for iPhone and iPad Rounding off a great point and click adventure comes The Silent Age... | Read more »
Squawkin Review
Squawkin Review By Jennifer Allen on October 22nd, 2014 Our Rating: :: GROUP MENTALITYiPhone App - Designed for the iPhone, compatible with the iPad Offering plenty of ways to communicate, Squawkin is a little quiet for meeting new... | Read more »

Price Scanner via MacPrices.net

Save with Best Buy’s College Student Deals
Take an additional $50 off all MacBooks and iMacs at Best Buy Online with their College Students Deals Savings, valid through November 1st. Anyone with a valid .EDU email address can take advantage... Read more
iPad Air 2 & iPad mini 3 Best Tablets Yet...
The new iPads turned out to be pretty much everything I’d been hoping for and more than I’d expected.”More” particularly in terms of a drinking-from-a-firehose choice of models and configurations,... Read more
Drafts 4 Reinvents iOS Productivity App
N Richland Hills, Texas based Agile Tortoise has announced the release of Drafts 4 for iPhone and iPad. Drafts is a quick capture note taking app with flexible output actions. Drafts 4 scales from... Read more
AT&T accepting preorders for new iPads fo...
AT&T Wireless is accepting preorders for the new iPad Air 2 and iPad mini 3, cellular models, for $100 off MSRP with a 2-year service agreement: - 16GB iPad Air 2 WiFi + Cellular: $529.99 - 64GB... Read more
Apple offering refurbished Mac Pros for up to...
The Apple Store is offering Apple Certified Refurbished 2013 Mac Pros for up to $600 off the cost of new models. An Apple one-year warranty is included with each Mac Pro, and shipping is free. The... Read more
Select MacBook Airs $100 off MSRP, free shipp...
B&H Photo has 2014 a couple of MacBook Airs on sale for $100 off MSRP. Shipping is free, and B&H charges NY sales tax only. They also include free copies of Parallels Desktop and LoJack for... Read more
13-inch 2.5GHz MacBook Pro on sale for $100 o...
B&H Photo has the 13″ 2.5GHz MacBook Pro on sale for $999.99 including free shipping plus NY sales tax only. Their price is $100 off MSRP. Read more
Strong iPhone, Mac And App Store Sales Drive...
Apple on Monday announced financial results for its fiscal 2014 fourth quarter ended September 27, 2014. The Company posted quarterly revenue of $42.1 billion and quarterly net profit of $8.5 billion... Read more
Apple Posts How-To For OS X Recovery
OS X 10.7 Lion and later include OS X Recovery. This feature includes all of the tools you need to reinstall OS X, repair your disk, and even restore from a Time Machine backup. OS X Recovery... Read more
Mac OS X Versions (Builds) Supported By Vario...
Apple Support has posted a handy resource explaining which Mac OS X versions (builds) originally shipped with or are available for your computer via retail discs, downloads, or Software Update. Apple... Read more

Jobs Board

Senior Event Manager, *Apple* Retail Market...
…This senior level position is responsible for leading and imagining the Apple Retail Team's global event strategy. Delivering an overarching brand story; in-store, Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Project Manager / Business Analyst, WW *Appl...
…a senior project manager / business analyst to work within our Worldwide Apple Fulfillment Operations and the Business Process Re-engineering team. This role will work Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
Position Opening at *Apple* - Apple (United...
…customers purchase our products, you're the one who helps them get more out of their new Apple technology. Your day in the Apple Store is filled with a range of Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.