home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
source
/
macify13.shr
/
macify.hqx
/
Source
/
U
/
EventsMacify.c
< prev
next >
Wrap
Text File
|
1991-03-15
|
4KB
|
114 lines
/* EventsMacify Additional event handler routines
File name: EventsMacify.c
Function: This module contains the extra event handler routines
These routines allow us to override events in the main loop,
and to handle unique events.
/* History: 3/15/91 Original by Prototyper 3.0 */
#include "PCommonMacify.h" /* Common */
#include "Common_Macify.h" /* Common */
#include "PUtils_Macify.h" /* General Utilities */
#include "Utils_Macify.h" /* General Utilities */
#include "EventsMacify.h" /* This file */
/* ======================================================= */
/* Routine: HandleKey */
/* Purpose: Allow us to filter key strokes and special key combinations. */
/* Return TRUE if we let the main loop handle the key stroke, return */
/* FALSE if we handle it and want the main loop to ignore it. */
Boolean HandleKey(myevent)
EventRecord *myevent;
{
short charCode; /* Key code */
char ch; /* Key pressed in Ascii */
Boolean CmdKeyPressed; /* Command key pressed */
Boolean OptionKeyPressed; /* Option key pressed */
Boolean ShiftKeyPressed; /* Shift key pressed */
Boolean theHandleKey; /* value to return */
theHandleKey = TRUE; /* Let the main loop handle it */
charCode = myevent->message & charCodeMask; /* Get the character */
ch = (char)charCode; /* Change it to ASCII */
CmdKeyPressed = ((myevent->modifiers & cmdKey) != 0); /* See if Command key is down */
OptionKeyPressed = ((myevent->modifiers & optionKey) != 0);/* See if Option key is down */
ShiftKeyPressed = ((myevent->modifiers & shiftKey) != 0);/* See if Shift key is down */
return(theHandleKey); /* Return if we let main routine handle it */
}
/* ======================================================= */
/* Routine: HandleDisk */
/* Purpose: Allow us to handle disk inserted events specially. */
/* Return TRUE if we let the main loop handle the key stroke, return */
/* FALSE if we handle it and want the main loop to ignore it. */
Boolean HandleDisk(myevent)
EventRecord *myevent;
{
Boolean theHandleDisk; /* value to return */
theHandleDisk = TRUE; /* Let the main loop handle it */
return(theHandleDisk); /* Return if we let main routine handle it */
}
/* ======================================================= */
/* Routine: ApplLoop_Macify */
/* Purpose: At the top of the main loop, called each time thru the main */
/* loop. This is very often if WNE was false. If WNE was true then */
/* how often this routine is called depends on the setting of SleepValue */
/* in the ApplInit routine. */
void ApplLoop_Macify()
{
}
/* ======================================================= */
/* Routine: ApplEvent_Macify */
/* Purpose: Allow us to filter all events before the main loop handles them. */
/* Set DoIt to TRUE to let the main loop handle the event. Set DoIt to */
/* FALSE if we handle it and want the main loop to ignore it. */
void ApplEvent_Macify(DoIt, myEvent)
Boolean *DoIt;
EventRecord *myEvent;
{
*DoIt = TRUE; /* Let the main loop handle it */
if (myEvent->what == app4Evt) /* Handle a Suspend or Resume event*/
{
*DoIt = FALSE; /* Tell the main loop to skip it*/
}
else if (myEvent->what == 0) /* Handle a NULL event*/
{
*DoIt = FALSE; /* Tell the main loop to skip it*/
}
}
/* ======================================================= */
/* Routine: Handle_UserEvent */
/* Purpose: Handle our special user events */
void Handle_UserEvent(TheUserEvent)
UserEventRec *TheUserEvent;
{
}
/* ======================================================= */