sources/PickOne_event.c

/*  event.c                                                                         
 
    This contains all the code for routing and handling events.
                                                                                    
    Michael Bishop - August 21 1996                                                 
    Nick Thompson
    (c)1994-96 Apple computer Inc., All Rights Reserved                             
 
*/
 
/* --------------------------------------------------------------------
** Includes
*/
 
#include    <Devices.h>
#include    <QuickDraw.h>
 
/*  for QuickDraw 3D */
#include    "QD3D.h"
#include    "QD3DMath.h"
#include    "QD3DDrawContext.h"
#include    "QD3DShader.h"
#include    "QD3DTransform.h"
#include    "QD3DGroup.h"
 
#include    "PickOne_event.h"
#include    "PickOne_document.h"
#include    "PickOne_menu.h"
#include    "PickOne_window.h"
#include    "PickOne_main.h"
 
 
 
/*  --------------------------------------------------------------------
**  Event_HandleKeyPress
**  Handles a Key pressed
*/
void Event_HandleKeyPress(EventRecord *theEvent)
{
    char    key;
 
    key = theEvent->message & charCodeMask;
    
    /*  just check to see if we want to quit... */
    
    if ( theEvent->modifiers & cmdKey ) {       /* Command key down? */
        Menu_HandleCommand(MenuKey(key));
    } 
 
}
 
/*  --------------------------------------------------------------------
**  Event_DoOSEvent
**  Handles an OSEvent
*/
void    Event_DoOSEvent(EventRecord theEvent)
{   char    mask;
 
    mask = (theEvent.message >> 24) && 0xFF;
 
    switch(mask) {
        case mouseMovedMessage:
            break;
        case suspendResumeMessage:
            Event_DoSuspendResume(theEvent);
            break;
    }
}
 
/*  --------------------------------------------------------------------
**  Event_DoSuspendResume
**  Does nothing at the moment
*/
void    Event_DoSuspendResume(EventRecord theEvent)
{
    if((theEvent.message & resumeFlag) != 0)
    {
        gForeground = true;
        gTicks = 5;
    }
    else
    {
        gForeground = false;
        gTicks = 50;
    }
}
 
 
/*  --------------------------------------------------------------------
**  Event_DoNull
**  Do this when your app is idle
*/
void Event_DoNull(void)
{
    /*  we received a null event, rotate the cube */
    WindowPtr       theWindow;
 
    theWindow = FrontWindow() ;
    
    while( theWindow != NULL)
    {
        Document_Idle(Window_GetDocument( theWindow )) ;
                    
        theWindow = Window_GetNextWindow(theWindow);
    }
}