home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-06 | 3.5 KB | 104 lines | [TEXT/CWIE] |
- // Program Author: Paul Baxter
- // pbaxter@assistivetech.com
- //
- //
- #include <Speech.h>
- #include <DeskBus.h>
- #include <Retrace.h>
-
- #include "pref.h"
- #include "globals.h"
- #include "aeevents.h"
- #include "aegetdata.h"
- #include "aesetdata.h"
- #include "command.h"
-
- static pascal short AEHandlerOAPP(AppleEvent *event, AppleEvent *reply, long refCon);
- static pascal short AEHandlerODOC(AppleEvent *event, AppleEvent *reply, long refCon);
- static pascal short AEHandlerPDOC(AppleEvent *event, AppleEvent *reply, long refCon);
- static pascal short AEHandlerQUIT(AppleEvent *event, AppleEvent *reply, long refCon);
-
- // * ****************************************************************************** *
- // * AEHandlerOAPP
- // * Handle Open Application
- // * ****************************************************************************** *
- static pascal short AEHandlerOAPP(AppleEvent *event, AppleEvent *reply, long refCon)
- {
- #pragma unused (event, reply, refCon)
- return(0);
- }
-
- // * ****************************************************************************** *
- // * AEHandlerODOC
- // * Handle Open Document
- // * ****************************************************************************** *
- pascal short AEHandlerODOC(AppleEvent *event, AppleEvent *reply, long refCon)
- {
- #pragma unused (event, reply, refCon)
- return(0);
- }
-
- // * ****************************************************************************** *
- // * AEHandlerPDOC
- // * Handle Print Document
- // * ****************************************************************************** *
- pascal short AEHandlerPDOC(AppleEvent *event, AppleEvent *reply, long refCon)
- {
- #pragma unused (event, reply, refCon)
- return(0);
- }
-
- // * ****************************************************************************** *
- // * AEHandlerQUIT
- // * Handle Quit
- // * ****************************************************************************** *
- pascal short AEHandlerQUIT(AppleEvent *event, AppleEvent *reply, long refCon)
- {
- #pragma unused (event, reply, refCon)
- ProcessCommand(CHANGEVALUE(QuitCmd, kTrueValue), nil);
- return(0);
- }
-
- // * ****************************************************************************** *
- // * InitHLEvents
- // * Init High Level Events
- // * ****************************************************************************** *
- void InitHLEvents(void)
- {
- short err=0;
-
- if (HasAppleEvents()) {
- err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
- NewAEEventHandlerProc(AEHandlerOAPP), 0, 0);
- err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
- NewAEEventHandlerProc(AEHandlerODOC), 0, 0);
- err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
- NewAEEventHandlerProc(AEHandlerPDOC), 0, 0);
- err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
- NewAEEventHandlerProc(AEHandlerQUIT), 0, 0);
- err = AEInstallEventHandler( kAECoreSuite, kAESetData,
- NewAEEventHandlerProc(DoSetData), 0, 0);
- err = AEInstallEventHandler( kAECoreSuite, kAEGetData,
- NewAEEventHandlerProc(DoGetData), 0, 0);
- }
- }
-
-
- // * ****************************************************************************** *
- // * HasAppleEvents
- // * See if we have High Level events
- // * ****************************************************************************** *
- Boolean HasAppleEvents(void)
- {
- OSErr err;
- long response;
- Boolean appleEvents = false;
-
- err = Gestalt(gestaltAppleEventsAttr, &response);
- if(!err) {
- if(response & (1L << gestaltAppleEventsPresent)) {
- appleEvents = true;
- }
- }
- return appleEvents;
- }