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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       StandardFile.h
  3.  
  4.      Contains:   Standard File package Interfaces.
  5.  
  6.      Version:    Technology: System 7.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1990-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 __STANDARDFILE__
  18. #define __STANDARDFILE__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __DIALOGS__
  23. #include "Dialogs.h"
  24. #endif
  25. #ifndef __FILES__
  26. #include "Files.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. enum {
  45.                                                                 /* resource IDs of pre-7.0 get and put dialogs */
  46.     putDlgID                    = -3999,
  47.     getDlgID                    = -4000
  48. };
  49. enum {
  50.                                                                 /* item offsets of pre-7.0 get and put dialogs */
  51.     putSave                     = 1,
  52.     putCancel                   = 2,
  53.     putEject                    = 5,
  54.     putDrive                    = 6,
  55.     putName                     = 7,
  56.     getOpen                     = 1,
  57.     getCancel                   = 3,
  58.     getEject                    = 5,
  59.     getDrive                    = 6,
  60.     getNmList                   = 7,
  61.     getScroll                   = 8
  62. };
  63. enum {
  64.                                                                 /* resource IDs of 7.0 get and put dialogs */
  65.     sfPutDialogID               = -6043,
  66.     sfGetDialogID               = -6042
  67. };
  68. enum {
  69.                                                                 /* item offsets of 7.0 get and put dialogs */
  70.     sfItemOpenButton            = 1,
  71.     sfItemCancelButton          = 2,
  72.     sfItemBalloonHelp           = 3,
  73.     sfItemVolumeUser            = 4,
  74.     sfItemEjectButton           = 5,
  75.     sfItemDesktopButton         = 6,
  76.     sfItemFileListUser          = 7,
  77.     sfItemPopUpMenuUser         = 8,
  78.     sfItemDividerLinePict       = 9,
  79.     sfItemFileNameTextEdit      = 10,
  80.     sfItemPromptStaticText      = 11,
  81.     sfItemNewFolderUser         = 12
  82. };
  83. enum {
  84.                                                                 /* pseudo-item hits for use in DlgHook */
  85.     sfHookFirstCall             = -1,
  86.     sfHookCharOffset            = 0x1000,
  87.     sfHookNullEvent             = 100,
  88.     sfHookRebuildList           = 101,
  89.     sfHookFolderPopUp           = 102,
  90.     sfHookOpenFolder            = 103,                          /* the following are only in system 7.0+ */
  91.     sfHookLastCall              = -2,
  92.     sfHookOpenAlias             = 104,
  93.     sfHookGoToDesktop           = 105,
  94.     sfHookGoToAliasTarget       = 106,
  95.     sfHookGoToParent            = 107,
  96.     sfHookGoToNextDrive         = 108,
  97.     sfHookGoToPrevDrive         = 109,
  98.     sfHookChangeSelection       = 110,
  99.     sfHookSetActiveOffset       = 200
  100. };
  101. /* the refcon field of the dialog record during a
  102.  modalfilter or dialoghook contains one of the following */
  103. enum {
  104.     sfMainDialogRefCon          = FOUR_CHAR_CODE('stdf'),
  105.     sfNewFolderDialogRefCon     = FOUR_CHAR_CODE('nfdr'),
  106.     sfReplaceDialogRefCon       = FOUR_CHAR_CODE('rplc'),
  107.     sfStatWarnDialogRefCon      = FOUR_CHAR_CODE('stat'),
  108.     sfLockWarnDialogRefCon      = FOUR_CHAR_CODE('lock'),
  109.     sfErrorDialogRefCon         = FOUR_CHAR_CODE('err ')
  110. };
  111. struct SFReply {
  112.     Boolean                         good;
  113.     Boolean                         copy;
  114.     OSType                          fType;
  115.     short                           vRefNum;
  116.     short                           version;
  117.     StrFileName                     fName;                      /* a Str63 on MacOS */
  118. };
  119. typedef struct SFReply                  SFReply;
  120. struct StandardFileReply {
  121.     Boolean                         sfGood;
  122.     Boolean                         sfReplacing;
  123.     OSType                          sfType;
  124.     FSSpec                          sfFile;
  125.     ScriptCode                      sfScript;
  126.     short                           sfFlags;
  127.     Boolean                         sfIsFolder;
  128.     Boolean                         sfIsVolume;
  129.     long                            sfReserved1;
  130.     short                           sfReserved2;
  131. };
  132. typedef struct StandardFileReply        StandardFileReply;
  133. /* for CustomXXXFile, ActivationOrderListPtr parameter is a pointer to an array of item numbers */
  134. typedef const short *                   ActivationOrderListPtr;
  135. typedef CALLBACK_API( short , DlgHookProcPtr )(short item, DialogPtr theDialog);
  136. typedef CALLBACK_API( Boolean , FileFilterProcPtr )(CInfoPBPtr pb);
  137. /* the following also include an extra parameter of "your data pointer" */
  138. typedef CALLBACK_API( short , DlgHookYDProcPtr )(short item, DialogPtr theDialog, void *yourDataPtr);
  139. typedef CALLBACK_API( Boolean , ModalFilterYDProcPtr )(DialogPtr theDialog, EventRecord *theEvent, short *itemHit, void *yourDataPtr);
  140. typedef CALLBACK_API( Boolean , FileFilterYDProcPtr )(CInfoPBPtr pb, void *yourDataPtr);
  141. typedef CALLBACK_API( void , ActivateYDProcPtr )(DialogPtr theDialog, short itemNo, Boolean activating, void *yourDataPtr);
  142. typedef STACK_UPP_TYPE(DlgHookProcPtr)                          DlgHookUPP;
  143. typedef STACK_UPP_TYPE(FileFilterProcPtr)                       FileFilterUPP;
  144. typedef STACK_UPP_TYPE(DlgHookYDProcPtr)                        DlgHookYDUPP;
  145. typedef STACK_UPP_TYPE(ModalFilterYDProcPtr)                    ModalFilterYDUPP;
  146. typedef STACK_UPP_TYPE(FileFilterYDProcPtr)                     FileFilterYDUPP;
  147. typedef STACK_UPP_TYPE(ActivateYDProcPtr)                       ActivateYDUPP;
  148. #if OPAQUE_UPP_TYPES
  149. #if CALL_NOT_IN_CARBON
  150.     EXTERN_API(DlgHookUPP)
  151.     NewDlgHookUPP                  (DlgHookProcPtr          userRoutine);
  152.     EXTERN_API(FileFilterUPP)
  153.     NewFileFilterUPP               (FileFilterProcPtr       userRoutine);
  154.     EXTERN_API(DlgHookYDUPP)
  155.     NewDlgHookYDUPP                (DlgHookYDProcPtr        userRoutine);
  156.     EXTERN_API(ModalFilterYDUPP)
  157.     NewModalFilterYDUPP            (ModalFilterYDProcPtr    userRoutine);
  158.     EXTERN_API(FileFilterYDUPP)
  159.     NewFileFilterYDUPP             (FileFilterYDProcPtr     userRoutine);
  160.     EXTERN_API(ActivateYDUPP)
  161.     NewActivateYDUPP               (ActivateYDProcPtr       userRoutine);
  162.     EXTERN_API(void)
  163.     DisposeDlgHookUPP              (DlgHookUPP              userUPP);
  164.     EXTERN_API(void)
  165.     DisposeFileFilterUPP           (FileFilterUPP           userUPP);
  166.     EXTERN_API(void)
  167.     DisposeDlgHookYDUPP            (DlgHookYDUPP            userUPP);
  168.     EXTERN_API(void)
  169.     DisposeModalFilterYDUPP        (ModalFilterYDUPP        userUPP);
  170.     EXTERN_API(void)
  171.     DisposeFileFilterYDUPP         (FileFilterYDUPP         userUPP);
  172.     EXTERN_API(void)
  173.     DisposeActivateYDUPP           (ActivateYDUPP           userUPP);
  174.     EXTERN_API(short)
  175.     InvokeDlgHookUPP               (short                   item,
  176.                                     DialogPtr               theDialog,
  177.                                     DlgHookUPP              userUPP);
  178.     EXTERN_API(Boolean)
  179.     InvokeFileFilterUPP            (CInfoPBPtr              pb,
  180.                                     FileFilterUPP           userUPP);
  181.     EXTERN_API(short)
  182.     InvokeDlgHookYDUPP             (short                   item,
  183.                                     DialogPtr               theDialog,
  184.                                     void *                  yourDataPtr,
  185.                                     DlgHookYDUPP            userUPP);
  186.     EXTERN_API(Boolean)
  187.     InvokeModalFilterYDUPP         (DialogPtr               theDialog,
  188.                                     EventRecord *           theEvent,
  189.                                     short *                 itemHit,
  190.                                     void *                  yourDataPtr,
  191.                                     ModalFilterYDUPP        userUPP);
  192.     EXTERN_API(Boolean)
  193.     InvokeFileFilterYDUPP          (CInfoPBPtr              pb,
  194.                                     void *                  yourDataPtr,
  195.                                     FileFilterYDUPP         userUPP);
  196.     EXTERN_API(void)
  197.     InvokeActivateYDUPP            (DialogPtr               theDialog,
  198.                                     short                   itemNo,
  199.                                     Boolean                 activating,
  200.                                     void *                  yourDataPtr,
  201.                                     ActivateYDUPP           userUPP);
  202. #endif  /* CALL_NOT_IN_CARBON */
  203. #else
  204.     enum { uppDlgHookProcInfo = 0x000003A0 };                       /* pascal 2_bytes Func(2_bytes, 4_bytes) */
  205.     enum { uppFileFilterProcInfo = 0x000000D0 };                    /* pascal 1_byte Func(4_bytes) */
  206.     enum { uppDlgHookYDProcInfo = 0x00000FA0 };                     /* pascal 2_bytes Func(2_bytes, 4_bytes, 4_bytes) */
  207.     enum { uppModalFilterYDProcInfo = 0x00003FD0 };                 /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  208.     enum { uppFileFilterYDProcInfo = 0x000003D0 };                  /* pascal 1_byte Func(4_bytes, 4_bytes) */
  209.     enum { uppActivateYDProcInfo = 0x000036C0 };                    /* pascal no_return_value Func(4_bytes, 2_bytes, 1_byte, 4_bytes) */
  210.     #define NewDlgHookUPP(userRoutine)                              (DlgHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDlgHookProcInfo, GetCurrentArchitecture())
  211.     #define NewFileFilterUPP(userRoutine)                           (FileFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileFilterProcInfo, GetCurrentArchitecture())
  212.     #define NewDlgHookYDUPP(userRoutine)                            (DlgHookYDUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDlgHookYDProcInfo, GetCurrentArchitecture())
  213.     #define NewModalFilterYDUPP(userRoutine)                        (ModalFilterYDUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppModalFilterYDProcInfo, GetCurrentArchitecture())
  214.     #define NewFileFilterYDUPP(userRoutine)                         (FileFilterYDUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileFilterYDProcInfo, GetCurrentArchitecture())
  215.     #define NewActivateYDUPP(userRoutine)                           (ActivateYDUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppActivateYDProcInfo, GetCurrentArchitecture())
  216.     #define DisposeDlgHookUPP(userUPP)                              DisposeRoutineDescriptor(userUPP)
  217.     #define DisposeFileFilterUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  218.     #define DisposeDlgHookYDUPP(userUPP)                            DisposeRoutineDescriptor(userUPP)
  219.     #define DisposeModalFilterYDUPP(userUPP)                        DisposeRoutineDescriptor(userUPP)
  220.     #define DisposeFileFilterYDUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  221.     #define DisposeActivateYDUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  222.     #define InvokeDlgHookUPP(item, theDialog, userUPP)              (short)CALL_TWO_PARAMETER_UPP((userUPP), uppDlgHookProcInfo, (item), (theDialog))
  223.     #define InvokeFileFilterUPP(pb, userUPP)                        (Boolean)CALL_ONE_PARAMETER_UPP((userUPP), uppFileFilterProcInfo, (pb))
  224.     #define InvokeDlgHookYDUPP(item, theDialog, yourDataPtr, userUPP)  (short)CALL_THREE_PARAMETER_UPP((userUPP), uppDlgHookYDProcInfo, (item), (theDialog), (yourDataPtr))
  225.     #define InvokeModalFilterYDUPP(theDialog, theEvent, itemHit, yourDataPtr, userUPP)  (Boolean)CALL_FOUR_PARAMETER_UPP((userUPP), uppModalFilterYDProcInfo, (theDialog), (theEvent), (itemHit), (yourDataPtr))
  226.     #define InvokeFileFilterYDUPP(pb, yourDataPtr, userUPP)         (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppFileFilterYDProcInfo, (pb), (yourDataPtr))
  227.     #define InvokeActivateYDUPP(theDialog, itemNo, activating, yourDataPtr, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppActivateYDProcInfo, (theDialog), (itemNo), (activating), (yourDataPtr))
  228. #endif
  229. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  230. #define NewDlgHookProc(userRoutine)                             NewDlgHookUPP(userRoutine)
  231. #define NewFileFilterProc(userRoutine)                          NewFileFilterUPP(userRoutine)
  232. #define NewDlgHookYDProc(userRoutine)                           NewDlgHookYDUPP(userRoutine)
  233. #define NewModalFilterYDProc(userRoutine)                       NewModalFilterYDUPP(userRoutine)
  234. #define NewFileFilterYDProc(userRoutine)                        NewFileFilterYDUPP(userRoutine)
  235. #define NewActivateYDProc(userRoutine)                          NewActivateYDUPP(userRoutine)
  236. #define CallDlgHookProc(userRoutine, item, theDialog)           InvokeDlgHookUPP(item, theDialog, userRoutine)
  237. #define CallFileFilterProc(userRoutine, pb)                     InvokeFileFilterUPP(pb, userRoutine)
  238. #define CallDlgHookYDProc(userRoutine, item, theDialog, yourDataPtr) InvokeDlgHookYDUPP(item, theDialog, yourDataPtr, userRoutine)
  239. #define CallModalFilterYDProc(userRoutine, theDialog, theEvent, itemHit, yourDataPtr) InvokeModalFilterYDUPP(theDialog, theEvent, itemHit, yourDataPtr, userRoutine)
  240. #define CallFileFilterYDProc(userRoutine, pb, yourDataPtr)      InvokeFileFilterYDUPP(pb, yourDataPtr, userRoutine)
  241. #define CallActivateYDProc(userRoutine, theDialog, itemNo, activating, yourDataPtr) InvokeActivateYDUPP(theDialog, itemNo, activating, yourDataPtr, userRoutine)
  242. typedef OSType                          SFTypeList[4];
  243. /*
  244.     The GetFile "typeList" parameter type has changed from "SFTypeList" to "ConstSFTypeListPtr".
  245.     For C, this will add "const" and make it an in-only parameter.
  246.     For Pascal, this will require client code to use the @ operator, but make it easier to specify long lists.
  247.     ConstSFTypeListPtr is a pointer to an array of OSTypes.
  248. */
  249. typedef const OSType *                  ConstSFTypeListPtr;
  250. #if CALL_NOT_IN_CARBON
  251. #if CALL_NOT_IN_CARBON
  252. EXTERN_API( void )
  253. SFPutFile                       (Point                  where,
  254.                                  ConstStr255Param       prompt, /* can be NULL */
  255.                                  ConstStr255Param       origName,
  256.                                  DlgHookUPP             dlgHook, /* can be NULL */
  257.                                  SFReply *              reply)                              THREEWORDINLINE(0x3F3C, 0x0001, 0xA9EA);
  258. EXTERN_API( void )
  259. SFGetFile                       (Point                  where,
  260.                                  ConstStr255Param       prompt,
  261.                                  FileFilterUPP          fileFilter, /* can be NULL */
  262.                                  short                  numTypes,
  263.                                  ConstSFTypeListPtr     typeList, /* can be NULL */
  264.                                  DlgHookUPP             dlgHook, /* can be NULL */
  265.                                  SFReply *              reply)                              THREEWORDINLINE(0x3F3C, 0x0002, 0xA9EA);
  266. EXTERN_API( void )
  267. SFPPutFile                      (Point                  where,
  268.                                  ConstStr255Param       prompt, /* can be NULL */
  269.                                  ConstStr255Param       origName,
  270.                                  DlgHookUPP             dlgHook,
  271.                                  SFReply *              reply,
  272.                                  short                  dlgID,
  273.                                  ModalFilterUPP         filterProc) /* can be NULL */       THREEWORDINLINE(0x3F3C, 0x0003, 0xA9EA);
  274. EXTERN_API( void )
  275. SFPGetFile                      (Point                  where,
  276.                                  ConstStr255Param       prompt,
  277.                                  FileFilterUPP          fileFilter, /* can be NULL */
  278.                                  short                  numTypes,
  279.                                  ConstSFTypeListPtr     typeList, /* can be NULL */
  280.                                  DlgHookUPP             dlgHook, /* can be NULL */
  281.                                  SFReply *              reply,
  282.                                  short                  dlgID,
  283.                                  ModalFilterUPP         filterProc) /* can be NULL */       THREEWORDINLINE(0x3F3C, 0x0004, 0xA9EA);
  284. EXTERN_API( void )
  285. StandardPutFile                 (ConstStr255Param       prompt, /* can be NULL */
  286.                                  ConstStr255Param       defaultName,
  287.                                  StandardFileReply *    reply)                              THREEWORDINLINE(0x3F3C, 0x0005, 0xA9EA);
  288. EXTERN_API( void )
  289. StandardGetFile                 (FileFilterUPP          fileFilter, /* can be NULL */
  290.                                  short                  numTypes,
  291.                                  ConstSFTypeListPtr     typeList, /* can be NULL */
  292.                                  StandardFileReply *    reply)                              THREEWORDINLINE(0x3F3C, 0x0006, 0xA9EA);
  293. EXTERN_API( void )
  294. CustomPutFile                   (ConstStr255Param       prompt, /* can be NULL */
  295.                                  ConstStr255Param       defaultName,
  296.                                  StandardFileReply *    reply,
  297.                                  short                  dlgID,
  298.                                  Point                  where,
  299.                                  DlgHookYDUPP           dlgHook, /* can be NULL */
  300.                                  ModalFilterYDUPP       filterProc, /* can be NULL */
  301.                                  ActivationOrderListPtr  activeList, /* can be NULL */
  302.                                  ActivateYDUPP          activate, /* can be NULL */
  303.                                  void *                 yourDataPtr)                        THREEWORDINLINE(0x3F3C, 0x0007, 0xA9EA);
  304. EXTERN_API( void )
  305. CustomGetFile                   (FileFilterYDUPP        fileFilter, /* can be NULL */
  306.                                  short                  numTypes,
  307.                                  ConstSFTypeListPtr     typeList, /* can be NULL */
  308.                                  StandardFileReply *    reply,
  309.                                  short                  dlgID,
  310.                                  Point                  where,
  311.                                  DlgHookYDUPP           dlgHook, /* can be NULL */
  312.                                  ModalFilterYDUPP       filterProc, /* can be NULL */
  313.                                  ActivationOrderListPtr  activeList, /* can be NULL */
  314.                                  ActivateYDUPP          activate, /* can be NULL */
  315.                                  void *                 yourDataPtr)                        THREEWORDINLINE(0x3F3C, 0x0008, 0xA9EA);
  316. EXTERN_API( OSErr )
  317. StandardOpenDialog              (StandardFileReply *    reply);
  318. #endif  /* CALL_NOT_IN_CARBON */
  319. #if CALL_NOT_IN_CARBON
  320. EXTERN_API_C( void )
  321. sfpputfile                      (Point *                where,
  322.                                  const char *           prompt,
  323.                                  const char *           origName,
  324.                                  DlgHookUPP             dlgHook, /* can be NULL */
  325.                                  SFReply *              reply,
  326.                                  short                  dlgID,
  327.                                  ModalFilterUPP         filterProc) /* can be NULL */;
  328. EXTERN_API_C( void )
  329. sfgetfile                       (Point *                where,
  330.                                  const char *           prompt,
  331.                                  FileFilterUPP          fileFilter, /* can be NULL */
  332.                                  short                  numTypes,
  333.                                  ConstSFTypeListPtr     typeList, /* can be NULL */
  334.                                  DlgHookUPP             dlgHook, /* can be NULL */
  335.                                  SFReply *              reply);
  336. EXTERN_API_C( void )
  337. sfpgetfile                      (Point *                where,
  338.                                  const char *           prompt,
  339.                                  FileFilterUPP          fileFilter, /* can be NULL */
  340.                                  short                  numTypes,
  341.                                  ConstSFTypeListPtr     typeList, /* can be NULL */
  342.                                  DlgHookUPP             dlgHook, /* can be NULL */
  343.                                  SFReply *              reply,
  344.                                  short                  dlgID,
  345.                                  ModalFilterUPP         filterProc) /* can be NULL */;
  346. EXTERN_API_C( void )
  347. sfputfile                       (Point *                where,
  348.                                  const char *           prompt,
  349.                                  const char *           origName,
  350.                                  DlgHookUPP             dlgHook, /* can be NULL */
  351.                                  SFReply *              reply);
  352. #endif  /* CALL_NOT_IN_CARBON */
  353. #endif  /* CALL_NOT_IN_CARBON */
  354. #if PRAGMA_STRUCT_ALIGN
  355.     #pragma options align=reset
  356. #elif PRAGMA_STRUCT_PACKPUSH
  357.     #pragma pack(pop)
  358. #elif PRAGMA_STRUCT_PACK
  359.     #pragma pack()
  360. #endif
  361. #ifdef PRAGMA_IMPORT_OFF
  362. #pragma import off
  363. #elif PRAGMA_IMPORT
  364. #pragma import reset
  365. #endif
  366. #ifdef __cplusplus
  367. }
  368. #endif
  369. #endif /* __STANDARDFILE__ */