Mac OS 9
AEInteraction.h
Go to the documentation of this file.
1 
20 #ifndef __AEINTERACTION__
21 #define __AEINTERACTION__
22 
23 #ifndef __AEDATAMODEL__
24 #include <AEDataModel.h>
25 #endif
26 
27 #ifndef __NOTIFICATION__
28 #include <Notification.h>
29 #endif
30 
31 #ifndef __EVENTS__
32 #include <Events.h>
33 #endif
34 
35 #if PRAGMA_ONCE
36 #pragma once
37 #endif
38 
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #endif
43 
44 #if PRAGMA_IMPORT
45 #pragma import on
46 #endif
47 
48 #if PRAGMA_STRUCT_ALIGN
49 #pragma options align = mac68k
50 #elif PRAGMA_STRUCT_PACKPUSH
51 #pragma pack(push, 2)
52 #elif PRAGMA_STRUCT_PACK
53 #pragma pack(2)
54 #endif
55 
56  /**************************************************************************
57  AppleEvent callbacks.
58  **************************************************************************/
59  typedef CALLBACK_API(Boolean, AEIdleProcPtr)(EventRecord *theEvent,
60  long *sleepTime,
61  RgnHandle *mouseRgn);
62  typedef CALLBACK_API(Boolean, AEFilterProcPtr)(EventRecord *theEvent,
63  long returnID,
64  long transactionID,
65  const AEAddressDesc *sender);
66  typedef STACK_UPP_TYPE(AEIdleProcPtr) AEIdleUPP;
67  typedef STACK_UPP_TYPE(AEFilterProcPtr) AEFilterUPP;
68 
69  /**************************************************************************
70  The next couple of calls are basic routines used to create, send,
71  and process AppleEvents.
72  **************************************************************************/
81  OSErr
82  AESend(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode,
83  AESendPriority sendPriority, long timeOutInTicks,
84  AEIdleUPP idleProc, /* can be NULL */
85  AEFilterUPP filterProc) /* can be NULL */;
86 
95  OSErr
96  AEProcessAppleEvent(const EventRecord *theEventRecord);
97 
112  OSErr
114 
115  /**************************************************************************
116  The following three calls are used to allow applications to behave
117  courteously when a user interaction such as a dialog box is needed.
118  **************************************************************************/
119 
120  typedef SInt8 AEInteractAllowed;
121  enum
122  {
123  kAEInteractWithSelf = 0,
124  kAEInteractWithLocal = 1,
125  kAEInteractWithAll = 2
126  };
127 
161  OSErr
162  AEGetInteractionAllowed(AEInteractAllowed *level);
163 
172  OSErr
173  AESetInteractionAllowed(AEInteractAllowed level);
174 
183  OSErr
184  AEInteractWithUser(long timeOutInTicks, NMRecPtr nmReqPtr, AEIdleUPP idleProc);
185 
186  /**************************************************************************
187  The following four calls are available for applications which need more
188  sophisticated control over when and how events are processed. Applications
189  which implement multi-session servers or which implement their own
190  internal event queueing will probably be the major clients of these
191  routines. They can be called from within a handler to prevent the AEM from
192  disposing of the AppleEvent when the handler returns. They can be used to
193  asynchronously process the event (as MacApp does).
194  **************************************************************************/
195 
230  OSErr
231  AESuspendTheCurrentEvent(const AppleEvent *theAppleEvent);
232 
246  /* Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch
247  */
248  enum
249  {
250  kAEDoNotIgnoreHandler = 0x00000000,
251  kAEIgnoreAppPhacHandler =
252  0x00000001, /* available only in vers 1.0.1 and greater */
253  kAEIgnoreAppEventHandler =
254  0x00000002, /* available only in vers 1.0.1 and greater */
255  kAEIgnoreSysPhacHandler =
256  0x00000004, /* available only in vers 1.0.1 and greater */
257  kAEIgnoreSysEventHandler =
258  0x00000008, /* available only in vers 1.0.1 and greater */
259  kAEIngoreBuiltInEventHandler =
260  0x00000010, /* available only in vers 1.0.1 and greater */
261  kAEDontDisposeOnResume =
262  (long)0x80000000 /* available only in vers 1.0.1 and greater */
263  };
264 
265  /* Constants for AEResumeTheCurrentEvent */
266  enum
267  {
268  kAENoDispatch = 0, /* dispatch parameter to AEResumeTheCurrentEvent takes a
269  pointer to a dispatch */
270  kAEUseStandardDispatch =
271  (long)0xFFFFFFFF /* table, or one of these two constants */
272  };
273 
282  OSErr
283  AEResumeTheCurrentEvent(const AppleEvent *theAppleEvent,
284  const AppleEvent *reply,
285  AEEventHandlerUPP dispatcher, /* can be NULL */
286  long handlerRefcon);
287 
317  OSErr
319 
352  OSErr
353  AESetTheCurrentEvent(const AppleEvent *theAppleEvent);
354 
355  /**************************************************************************
356  AppleEvent callbacks.
357  **************************************************************************/
366  AEIdleUPP
367  NewAEIdleUPP(AEIdleProcPtr userRoutine);
368 #if !OPAQUE_UPP_TYPES
369  enum
370  {
371  uppAEIdleProcInfo = 0x00000FD0
372  }; /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
373 #ifdef __cplusplus
374  inline AEIdleUPP NewAEIdleUPP(AEIdleProcPtr userRoutine)
375  {
376  return (AEIdleUPP)NewRoutineDescriptor(
377  (ProcPtr)(userRoutine), uppAEIdleProcInfo, GetCurrentArchitecture());
378  }
379 #else
380 #define NewAEIdleUPP(userRoutine) \
381  (AEIdleUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEIdleProcInfo, \
382  GetCurrentArchitecture())
383 #endif
384 #endif
385 
394  AEFilterUPP
395  NewAEFilterUPP(AEFilterProcPtr userRoutine);
396 #if !OPAQUE_UPP_TYPES
397  enum
398  {
399  uppAEFilterProcInfo = 0x00003FD0
400  }; /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
401 #ifdef __cplusplus
402  inline AEFilterUPP NewAEFilterUPP(AEFilterProcPtr userRoutine)
403  {
404  return (AEFilterUPP)NewRoutineDescriptor(
405  (ProcPtr)(userRoutine), uppAEFilterProcInfo, GetCurrentArchitecture());
406  }
407 #else
408 #define NewAEFilterUPP(userRoutine) \
409  (AEFilterUPP) NewRoutineDescriptor( \
410  (ProcPtr)(userRoutine), uppAEFilterProcInfo, GetCurrentArchitecture())
411 #endif
412 #endif
413 
422  void
423  DisposeAEIdleUPP(AEIdleUPP userUPP);
424 #if !OPAQUE_UPP_TYPES
425 #ifdef __cplusplus
426  inline void DisposeAEIdleUPP(AEIdleUPP userUPP)
427  {
428  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
429  }
430 #else
431 #define DisposeAEIdleUPP(userUPP) DisposeRoutineDescriptor(userUPP)
432 #endif
433 #endif
434 
443  void
444  DisposeAEFilterUPP(AEFilterUPP userUPP);
445 #if !OPAQUE_UPP_TYPES
446 #ifdef __cplusplus
447  inline void DisposeAEFilterUPP(AEFilterUPP userUPP)
448  {
449  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
450  }
451 #else
452 #define DisposeAEFilterUPP(userUPP) DisposeRoutineDescriptor(userUPP)
453 #endif
454 #endif
455 
464  Boolean
465  InvokeAEIdleUPP(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn,
466  AEIdleUPP userUPP);
467 #if !OPAQUE_UPP_TYPES
468 #ifdef __cplusplus
469  inline Boolean InvokeAEIdleUPP(EventRecord *theEvent, long *sleepTime,
470  RgnHandle *mouseRgn, AEIdleUPP userUPP)
471  {
472  return (Boolean)CALL_THREE_PARAMETER_UPP(userUPP, uppAEIdleProcInfo, theEvent,
473  sleepTime, mouseRgn);
474  }
475 #else
476 #define InvokeAEIdleUPP(theEvent, sleepTime, mouseRgn, userUPP) \
477  (Boolean) CALL_THREE_PARAMETER_UPP((userUPP), uppAEIdleProcInfo, (theEvent), \
478  (sleepTime), (mouseRgn))
479 #endif
480 #endif
481 
490  Boolean
491  InvokeAEFilterUPP(EventRecord *theEvent, long returnID, long transactionID,
492  const AEAddressDesc *sender, AEFilterUPP userUPP);
493 #if !OPAQUE_UPP_TYPES
494 #ifdef __cplusplus
496  long transactionID,
497  const AEAddressDesc *sender,
498  AEFilterUPP userUPP)
499  {
500  return (Boolean)CALL_FOUR_PARAMETER_UPP(
501  userUPP, uppAEFilterProcInfo, theEvent, returnID, transactionID, sender);
502  }
503 #else
504 #define InvokeAEFilterUPP(theEvent, returnID, transactionID, sender, userUPP) \
505  (Boolean) \
506  CALL_FOUR_PARAMETER_UPP((userUPP), uppAEFilterProcInfo, (theEvent), \
507  (returnID), (transactionID), (sender))
508 #endif
509 #endif
510 
511 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
512 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
513 #define NewAEIdleProc(userRoutine) NewAEIdleUPP(userRoutine)
514 #define NewAEFilterProc(userRoutine) NewAEFilterUPP(userRoutine)
515 #define CallAEIdleProc(userRoutine, theEvent, sleepTime, mouseRgn) \
516  InvokeAEIdleUPP(theEvent, sleepTime, mouseRgn, userRoutine)
517 #define CallAEFilterProc(userRoutine, theEvent, returnID, transactionID, \
518  sender) \
519  InvokeAEFilterUPP(theEvent, returnID, transactionID, sender, userRoutine)
520 #endif /* CALL_NOT_IN_CARBON */
521 
522 #if PRAGMA_STRUCT_ALIGN
523 #pragma options align = reset
524 #elif PRAGMA_STRUCT_PACKPUSH
525 #pragma pack(pop)
526 #elif PRAGMA_STRUCT_PACK
527 #pragma pack()
528 #endif
529 
530 #ifdef PRAGMA_IMPORT_OFF
531 #pragma import off
532 #elif PRAGMA_IMPORT
533 #pragma import reset
534 #endif
535 
536 #ifdef __cplusplus
537 }
538 #endif
539 
540 #endif /* __AEINTERACTION__ */
541 * /*/*/ * /
AppleEvent Data Model Interfaces.
void DisposeAEFilterUPP(AEFilterUPP userUPP)
Definition: AEInteraction.h:447
OSErr AEProcessAppleEvent(const EventRecord *theEventRecord)
void DisposeAEIdleUPP(AEIdleUPP userUPP)
Definition: AEInteraction.h:426
Boolean InvokeAEIdleUPP(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn, AEIdleUPP userUPP)
Definition: AEInteraction.h:469
AEFilterUPP NewAEFilterUPP(AEFilterProcPtr userRoutine)
Definition: AEInteraction.h:402
OSErr AESetTheCurrentEvent(const AppleEvent *theAppleEvent)
AESetTheCurrentEvent Specify Apple Event to be handled.
AEIdleUPP NewAEIdleUPP(AEIdleProcPtr userRoutine)
Definition: AEInteraction.h:374
Boolean InvokeAEFilterUPP(EventRecord *theEvent, long returnID, long transactionID, const AEAddressDesc *sender, AEFilterUPP userUPP)
Definition: AEInteraction.h:495
OSErr AESetInteractionAllowed(AEInteractAllowed level)
OSErr AEGetInteractionAllowed(AEInteractAllowed *level)
AEGetInteractionAllowed Get user interaction preferences.
OSErr AEGetTheCurrentEvent(AppleEvent *theAppleEvent)
AEGetTheCurrentEvent Return the Apple Event currently being handled.
OSErr AESuspendTheCurrentEvent(const AppleEvent *theAppleEvent)
AESuspendTheCurrentEvent Suspend Apple Event processing.
OSErr AEResumeTheCurrentEvent(const AppleEvent *theAppleEvent, const AppleEvent *reply, AEEventHandlerUPP dispatcher, long handlerRefcon)
OSErr AEInteractWithUser(long timeOutInTicks, NMRecPtr nmReqPtr, AEIdleUPP idleProc)
OSErr AEResetTimer(const AppleEvent *reply)
OSErr AESend(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc)
Event Manager Interfaces.
unsigned char Boolean
Definition: MacTypes.h:318
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
Notification Manager interfaces.
Definition: AEDataModel.h:175
Definition: Events.h:224
Definition: Quickdraw.h:306
Definition: Notification.h:56