TumblerSource/Tumbler_AEVT.h

//  Tumbler_AEVT.c
//
//  Apple Event Routines for the Tumbler App.  Contains AppleEvent Handlers and senders for
//  the Tumbler app.
//      
//  Author:     Nick Thompson, 11/24/94
//
//  Modification History:
//
//  11/26/94        nick        added output from symantec proto_helper app
//  11/24/94        nick        Initial Cut - factored code from Tumbler event, added
//                              Drag related events for debugging (you can't debug the 
//                              handler, but if the handler sends an event you can debug
//                              the AE handler).
//
//  Copyright © 1992-95 Apple Computer, Inc.
//
 
#ifndef _Tumbler_AEVT_H_
#define _Tumbler_AEVT_H_
 
// resource types for the appleevent error handlers
enum {
    rUserAlert = 1001,
    rFatalAlert
} ;
 
//-----------------------------------------------------------------------
// 'STR#' resource ID items
 
enum {
    rErrorStringIndex = 1000,
    rFatalErrorStringIndex
} ;
 
typedef struct _myPrivateData {
    OSType          myTypeOfData ;
    long            myDataSize ;
    DocumentPtr myDocument ;        // ideally we should store the doc in the window's refcon, this is hacky ???
    WindowPtr       myWindow ;
    Point           myLocation ;
    unsigned char   myData[] ;
} myPrivateDataRec, *myPrivateDataPtr, **myPrivateDataHdl ;
 
 
 
// fatal error codes
enum {
    eFatalNeedsAEVTMgr = 1      // This application needs AppleEvents to run
} ;
 
void            FailIfErr (OSErr  error) ;
void            AlertUser (short  error) ;
void            FatalError(short error) ;
 
void            InitAEStuff( void ) ; 
Boolean         SupportsAEVT(void) ;
 
void            DoHighLevelEvent(EventRecord *ev) ;
 
void            RegisterMyEvents(void) ;
 
// core event handlers
pascal OSErr    MyAEHandleOAPP(AppleEvent *theAppleEvent,AppleEvent *reply,long refCon) ;
pascal OSErr    MyAEHandleODOC(AppleEvent *theAppleEvent,AppleEvent *reply,long refCon) ;
pascal OSErr    MyAEHandlePDOC(AppleEvent *theAppleEvent,AppleEvent *reply,long refCon) ;
pascal OSErr    MyAEHandleQUIT(AppleEvent *theAppleEvent,AppleEvent *reply,long refCon) ;
 
// my "special" event handler(s)
pascal OSErr    MyAEHandleDragRecv(AppleEvent *theAppleEvent,AppleEvent *reply,long refCon) ;
 
// AEVT SENDERS
 
// send core events
void SendQuitApp( void ) ;
void SendOpenDoc(FSSpec *myFSSpec) ;
void SendPrintDoc(FSSpec *myFSSpec) ;
 
// send stuff for the drag receive handlers
void SendDragRecv( myPrivateDataHdl privateHdl ) ;
 
#endif