[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LEventDispatcher



Overview:

LEventDispatcher is a PowerPlant class that is used for handling all event processing after the application retrieves the event in the main event loop. This class is also responsible for adjusting the cursor, distributing time to idle-time processes, and initiating menu updates before displaying menus.

Methods :

The methods in this class are:

 

LEventDispatcher()  
~LEventDispatcher()  
AdjustCursor()  
ClickMenuBar()  
DispatchEvent()  
EventActivate()  
EventAutoKey()  
EventDisk()  
EventHighLevel()  
EventKeyDown()  
EventKeyUp()  
EventMouseDown()  
EventMouseUp()  
EventOS()  
EventResume()  
EventSuspend()  
EventUpdate()  
ExecuteAttachments()  
GetCurrentEventDispatcher()  
UpdateMenus()  
UseIdleTime()  
 

Data Members:

The data members in this class are:

 

sCurrentDispatcher  
mSaveDispatcher  
mMouseRgnH  
 

Operation:

Most of the time, you won't need to override any functions in this class. PowerPlant supplies default behaviors that implement much of the functionality you could hope for.

Unless you use the Mac Toolbox directly for tasks such as running a dialog box with ModelDialog(), all event processing goes through the main event loop and LEventDIspatcher, even for modal dialogs.

Source files:

(Features Classes)

LEventDispatcher.h

LEventDispatcher.cp

See also:

LAttachable

LEventDispatcher()

Purpose:

The constructor creates the object, initializing the menus so that they are unhilited, and saving a copy of the current Event Dispatcher.

Access:

Public

Prototype:

LEventDispatcher();
Parameters:

None

~LEventDispatcher()

Purpose:

The destructor destroys the object, including disposal of the mouse region, and restoring of the previous Event Dispatcher.

Access:

Virtual, Public

Prototype:

virtual ~LEventDispatcher();
Parameters:

None

AdjustCursor()

Purpose:

Adjust the shape of the cursor (mouse pointer). If the cursor is inside an active, enabled, PowerPlant window, then the window is expected to handle cursor adjustment, using

Access:

Virtual, Protected

Prototype:

virtual void AdjustCursor( 
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference tells the location of the mouse cursor.  

Return:

None

ClickMenuBar()

Purpose:

Respond to a mouse click in the menu bar.

Access:

Virtual, Protected

Prototype:

virtual void ClickMenuBar(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

DispatchEvent()

Purpose:

This method processes a Mac OS Toolbox event.

Access:

Virtual, Public

Prototype:

virtual void DispatchEvent(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventActivate()

Purpose:

Respond to an Activate (or Deactivate) event by enabling the appropriate window and updating the command status.

Access:

Virtual, Protected

Prototype:

virtual void EventActivate(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventAutoKey()

Purpose:

Respond to an auto-key event.

Access:

Virtual, Protected

Prototype:

virtual void EventAutoKey(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventDisk()

Purpose:

Respond to a Disk-inserted event.

Access:

Virtual, Protected

Prototype:

virtual void EventDisk(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventHighLevel()

Purpose:

Respond to a High Level (Apple) Event.

Access:

Virtual, Protected

Prototype:

virtual void EventHighLevel(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventKeyDown()

Purpose:

Respond to a Key Down Event.

Access:

Virtual, Protected

Prototype:

virtual void EventKeyDown(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventKeyUp()

Purpose:

Respond to a Key Up event. Note that by default, the system masks out Key Up events.

Access:

Virtual, Protected

Prototype:

virtual void EventKeyUp(
const EventRecord& inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventMouseDown()

Purpose:

Respond to a Mouse Down event.

Access:

Virtual, Protected

Prototype:

virtual void EventMouseDown(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventMouseUp()

Purpose:

Respond to a Mouse Up event.

Access:

Virtual, Protected

Prototype:

virtual void EventMouseUp(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventOS()

Purpose:

Respond to an OS event (MouseMoved, Suspend, Resume).

Access:

Virtual, Protected

Prototype:

virtual void EventOS(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventResume()

Purpose:

Respond to a Resume event.

Access:

Virtual, Protected

Prototype:

virtual void EventResume(
const EventRecord& inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventSuspend()

Purpose:

Respond to a Suspend event.

Access:

Virtual, Protected

Prototype:

virtual void EventSuspend(
const EventRecord& inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

EventUpdate()

Purpose:

Respond to an Update event.

Access:

Virtual, Protected

Prototype:

virtual void EventUpdate(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

ExecuteAttachments()

Purpose:

Tell all associated Attachments to execute themselves for the specified message.

Access:

Virtual, Public

Prototype:

virtual Boolean ExecuteAttachments(
MessageT inMessage,
void *ioParam);
Parameters:

The parameters for this method are:

 

MessageT  
inMessage  
This passed-in value indicates the message to process.  
void*  
ioParam  
This passed-in pointer is for a data block that accompanies the inMessage.  

Return:

The return value specifies whether the default Host action should be executed. The value is false if any Attachment's Execute() function returns false, otherwise it's true.

GetCurrentEventDispatcher()

Purpose:

Get a pointer to the current LEventDispatcher object so that it can be later restored.

Access:

Static, Public

Prototype:

static LEventDispatcher 
*GetCurrentEventDispatcher();
Parameters:

None

Return:

A LEventDispatcher pointer that points to the current LEventDispatcher.

Remarks:

This is a static method, and as such the same method will be called for every instance of the LEventDispatcher objects.

UpdateMenus()

Purpose:

This method handles all the menu update operations that are required for event processing.

Access:

Virtual, Public

Prototype:

virtual void UpdateMenus();
Parameters:

None

Return:

None

Remarks:

This method handles many cases, and is best understood by reading the source code.

UseIdleTime()

Purpose:

Respond to a NULL or MouseMoved Event.

Access:

Virtual, Public

Prototype:

virtual void UseIdleTime(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
This passed-in reference contains event information.  

Return:

None

Remarks:

Typically, all this method needs to do is devote time to processing idle tasks.

sCurrentDispatcher

Purpose:

This data member provides a place to store the current EventDispatcher object pointer.

Access:

Protected

Prototype:

static LEventDispatcher *sCurrentDispatcher;

mSaveDispatcher

Purpose:

This data member provides a place to store the previous EventDispatcher object pointer. From this, the former EventDispatcher can be restored later.

Access:

Protected

Prototype:

LEventDispatcher *mSaveDispatcher;

mMouseRgnH

Purpose:

This data member provides a place to store the mouse region handle.

Access:

Protected

Prototype:

RgnHandle mMouseRgnH;

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000