CTBUtilities.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:10k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       CTBUtilities.h
  3.  
  4.      Contains:   Communications Toolbox Utilities interfaces.
  5.  
  6.      Version:    Technology: System 7.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1988-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CTBUTILITIES__
  18. #define __CTBUTILITIES__
  19. #ifndef __CONDITIONALMACROS__
  20. #include "ConditionalMacros.h"
  21. #endif
  22. #ifndef __MACTYPES__
  23. #include "MacTypes.h"
  24. #endif
  25. #ifndef __MIXEDMODE__
  26. #include "MixedMode.h"
  27. #endif
  28. #ifndef __DIALOGS__
  29. #include "Dialogs.h"
  30. #endif
  31. #ifndef __APPLETALK__
  32. #include "AppleTalk.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. #if CALL_NOT_IN_CARBON
  51. enum {
  52.     curCTBUVersion              = 2                             /* version of Comm Toolbox Utilities*/
  53. };
  54. enum {
  55.                                                                 /*    Error codes/types    */
  56.     ctbuGenericError            = -1,
  57.     ctbuNoErr                   = 0
  58. };
  59. typedef OSErr                           CTBUErr;
  60. enum {
  61.     chooseDisaster              = -2,
  62.     chooseFailed                = -1,
  63.     chooseAborted               = 0,
  64.     chooseOKMinor               = 1,
  65.     chooseOKMajor               = 2,
  66.     chooseCancel                = 3
  67. };
  68. typedef unsigned short                  ChooseReturnCode;
  69. enum {
  70.     nlOk                        = 0,
  71.     nlCancel                    = 1,
  72.     nlEject                     = 2
  73. };
  74. typedef unsigned short                  NuLookupReturnCode;
  75. enum {
  76.     nameInclude                 = 1,
  77.     nameDisable                 = 2,
  78.     nameReject                  = 3
  79. };
  80. typedef unsigned short                  NameFilterReturnCode;
  81. enum {
  82.     zoneInclude                 = 1,
  83.     zoneDisable                 = 2,
  84.     zoneReject                  = 3
  85. };
  86. typedef unsigned short                  ZoneFilterReturnCode;
  87. enum {
  88.                                                                 /*    Values for hookProc items   */
  89.     hookOK                      = 1,
  90.     hookCancel                  = 2,
  91.     hookOutline                 = 3,
  92.     hookTitle                   = 4,
  93.     hookItemList                = 5,
  94.     hookZoneTitle               = 6,
  95.     hookZoneList                = 7,
  96.     hookLine                    = 8,
  97.     hookVersion                 = 9,
  98.     hookReserved1               = 10,
  99.     hookReserved2               = 11,
  100.     hookReserved3               = 12,
  101.     hookReserved4               = 13,                           /*    "virtual" hookProc items   */
  102.     hookNull                    = 100,
  103.     hookItemRefresh             = 101,
  104.     hookZoneRefresh             = 102,
  105.     hookEject                   = 103,
  106.     hookPreflight               = 104,
  107.     hookPostflight              = 105,
  108.     hookKeyBase                 = 1000
  109. };
  110. /*  NuLookup structures/constants   */
  111. struct NLTypeEntry {
  112.     Handle                          hIcon;
  113.     Str32                           typeStr;
  114. };
  115. typedef struct NLTypeEntry              NLTypeEntry;
  116. typedef NLTypeEntry                     NLType[4];
  117. struct NBPReply {
  118.     EntityName                      theEntity;
  119.     AddrBlock                       theAddr;
  120. };
  121. typedef struct NBPReply                 NBPReply;
  122. typedef CALLBACK_API( short , DialogHookProcPtr )(short item, DialogPtr theDialog);
  123. typedef CALLBACK_API( short , NameFilterProcPtr )(const EntityName *theEntity)/*  (22) added const */;
  124. typedef CALLBACK_API( short , ZoneFilterProcPtr )(ConstStr32Param theZone);
  125. typedef STACK_UPP_TYPE(DialogHookProcPtr)                       DialogHookUPP;
  126. typedef STACK_UPP_TYPE(NameFilterProcPtr)                       NameFilterUPP;
  127. typedef STACK_UPP_TYPE(ZoneFilterProcPtr)                       ZoneFilterUPP;
  128. #if OPAQUE_UPP_TYPES
  129. #if CALL_NOT_IN_CARBON
  130.     EXTERN_API(DialogHookUPP)
  131.     NewDialogHookUPP               (DialogHookProcPtr       userRoutine);
  132.     EXTERN_API(NameFilterUPP)
  133.     NewNameFilterUPP               (NameFilterProcPtr       userRoutine);
  134.     EXTERN_API(ZoneFilterUPP)
  135.     NewZoneFilterUPP               (ZoneFilterProcPtr       userRoutine);
  136.     EXTERN_API(void)
  137.     DisposeDialogHookUPP           (DialogHookUPP           userUPP);
  138.     EXTERN_API(void)
  139.     DisposeNameFilterUPP           (NameFilterUPP           userUPP);
  140.     EXTERN_API(void)
  141.     DisposeZoneFilterUPP           (ZoneFilterUPP           userUPP);
  142.     EXTERN_API(short)
  143.     InvokeDialogHookUPP            (short                   item,
  144.                                     DialogPtr               theDialog,
  145.                                     DialogHookUPP           userUPP);
  146.     EXTERN_API(short)
  147.     InvokeNameFilterUPP            (const EntityName *      theEntity,
  148.                                     NameFilterUPP           userUPP);
  149.     EXTERN_API(short)
  150.     InvokeZoneFilterUPP            (ConstStr32Param         theZone,
  151.                                     ZoneFilterUPP           userUPP);
  152. #endif  /* CALL_NOT_IN_CARBON */
  153. #else
  154.     enum { uppDialogHookProcInfo = 0x000003A0 };                    /* pascal 2_bytes Func(2_bytes, 4_bytes) */
  155.     enum { uppNameFilterProcInfo = 0x000000E0 };                    /* pascal 2_bytes Func(4_bytes) */
  156.     enum { uppZoneFilterProcInfo = 0x000000E0 };                    /* pascal 2_bytes Func(4_bytes) */
  157.     #define NewDialogHookUPP(userRoutine)                           (DialogHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
  158.     #define NewNameFilterUPP(userRoutine)                           (NameFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
  159.     #define NewZoneFilterUPP(userRoutine)                           (ZoneFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
  160.     #define DisposeDialogHookUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  161.     #define DisposeNameFilterUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  162.     #define DisposeZoneFilterUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  163.     #define InvokeDialogHookUPP(item, theDialog, userUPP)           (short)CALL_TWO_PARAMETER_UPP((userUPP), uppDialogHookProcInfo, (item), (theDialog))
  164.     #define InvokeNameFilterUPP(theEntity, userUPP)                 (short)CALL_ONE_PARAMETER_UPP((userUPP), uppNameFilterProcInfo, (theEntity))
  165.     #define InvokeZoneFilterUPP(theZone, userUPP)                   (short)CALL_ONE_PARAMETER_UPP((userUPP), uppZoneFilterProcInfo, (theZone))
  166. #endif
  167. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  168. #define NewDialogHookProc(userRoutine)                          NewDialogHookUPP(userRoutine)
  169. #define NewNameFilterProc(userRoutine)                          NewNameFilterUPP(userRoutine)
  170. #define NewZoneFilterProc(userRoutine)                          NewZoneFilterUPP(userRoutine)
  171. #define CallDialogHookProc(userRoutine, item, theDialog)        InvokeDialogHookUPP(item, theDialog, userRoutine)
  172. #define CallNameFilterProc(userRoutine, theEntity)              InvokeNameFilterUPP(theEntity, userRoutine)
  173. #define CallZoneFilterProc(userRoutine, theZone)                InvokeZoneFilterUPP(theZone, userRoutine)
  174. #if CALL_NOT_IN_CARBON
  175. EXTERN_API( CTBUErr )
  176. InitCTBUtilities                (void);
  177. EXTERN_API( short )
  178. CTBGetCTBVersion                (void);
  179. EXTERN_API( short )
  180. StandardNBP                     (Point                  where,
  181.                                  ConstStr255Param       prompt,
  182.                                  short                  numTypes,
  183.                                  NLType                 typeList,
  184.                                  NameFilterUPP          nameFilter,
  185.                                  ZoneFilterUPP          zoneFilter,
  186.                                  DialogHookUPP          hook,
  187.                                  NBPReply *             theReply);
  188. EXTERN_API( short )
  189. CustomNBP                       (Point                  where,
  190.                                  ConstStr255Param       prompt,
  191.                                  short                  numTypes,
  192.                                  NLType                 typeList,
  193.                                  NameFilterUPP          nameFilter,
  194.                                  ZoneFilterUPP          zoneFilter,
  195.                                  DialogHookUPP          hook,
  196.                                  long                   userData,
  197.                                  short                  dialogID,
  198.                                  ModalFilterUPP         filter,
  199.                                  NBPReply *             theReply);
  200. #endif  /* CALL_NOT_IN_CARBON */
  201. #if OLDROUTINENAMES
  202. #define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter, 
  203. hook, theReply)                                                             
  204. StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter,      
  205. hook, theReply)
  206. #define NuPLookup(where, prompt, numTypes, typeList, nameFilter,                
  207. zoneFilter, hook, userData, dialogID, filter, theReply)                     
  208. CustomNBP(where, prompt, numTypes, typeList, nameFilter,                        
  209. zoneFilter, hook, userData, dialogID, filter, theReply)
  210. #endif  /* OLDROUTINENAMES */
  211. #endif  /* CALL_NOT_IN_CARBON */
  212. #if PRAGMA_STRUCT_ALIGN
  213.     #pragma options align=reset
  214. #elif PRAGMA_STRUCT_PACKPUSH
  215.     #pragma pack(pop)
  216. #elif PRAGMA_STRUCT_PACK
  217.     #pragma pack()
  218. #endif
  219. #ifdef PRAGMA_IMPORT_OFF
  220. #pragma import off
  221. #elif PRAGMA_IMPORT
  222. #pragma import reset
  223. #endif
  224. #ifdef __cplusplus
  225. }
  226. #endif
  227. #endif /* __CTBUTILITIES__ */