home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Beta / Quicktime 2.0 Beta.iso / Programming Stuff / Interfaces / Universal Interfaces / StandardFile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-30  |  12.5 KB  |  368 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        StandardFile.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __STANDARDFILE__
  13. #define __STANDARDFILE__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. /*    #include <ConditionalMacros.h>                                */
  18. /*    #include <MixedMode.h>                                        */
  19. /*        #include <Traps.h>                                        */
  20. #endif
  21.  
  22. #ifndef __DIALOGS__
  23. #include <Dialogs.h>
  24. /*    #include <Windows.h>                                        */
  25. /*        #include <Quickdraw.h>                                    */
  26. /*            #include <QuickdrawText.h>                            */
  27. /*                #include <IntlResources.h>                        */
  28. /*        #include <Events.h>                                        */
  29. /*            #include <OSUtils.h>                                */
  30. /*        #include <Controls.h>                                    */
  31. /*            #include <Menus.h>                                    */
  32. /*    #include <TextEdit.h>                                        */
  33. #endif
  34.  
  35. #ifndef __FILES__
  36. #include <Files.h>
  37. /*    #include <SegLoad.h>                                        */
  38. #endif
  39.  
  40. enum  {
  41. /* resource IDs and item offsets of pre-7.0 dialogs */
  42.     putDlgID                    = -3999,
  43.     putSave                        = 1,
  44.     putCancel                    = 2,
  45.     putEject                    = 5,
  46.     putDrive                    = 6,
  47.     putName                        = 7,
  48.     getDlgID                    = -4000,
  49.     getOpen                        = 1,
  50.     getCancel                    = 3,
  51.     getEject                    = 5,
  52.     getDrive                    = 6,
  53.     getNmList                    = 7,
  54.     getScroll                    = 8,
  55. /* resource IDs and item offsets of 7.0 dialogs */
  56.     sfPutDialogID                = -6043,
  57.     sfGetDialogID                = -6042,
  58.     sfItemOpenButton            = 1,
  59.     sfItemCancelButton            = 2,
  60.     sfItemBalloonHelp            = 3,
  61.     sfItemVolumeUser            = 4,
  62.     sfItemEjectButton            = 5
  63. };
  64.  
  65. enum  {
  66.     sfItemDesktopButton            = 6,
  67.     sfItemFileListUser            = 7,
  68.     sfItemPopUpMenuUser            = 8,
  69.     sfItemDividerLinePict        = 9,
  70.     sfItemFileNameTextEdit        = 10,
  71.     sfItemPromptStaticText        = 11,
  72.     sfItemNewFolderUser            = 12,
  73. /* pseudo-item hits for use in DlgHook */
  74.     sfHookFirstCall                = -1,
  75.     sfHookCharOffset            = 0x1000,
  76.     sfHookNullEvent                = 100,
  77.     sfHookRebuildList            = 101,
  78.     sfHookFolderPopUp            = 102,
  79.     sfHookOpenFolder            = 103,
  80. /* the following are only in system 7.0+ */
  81.     sfHookOpenAlias                = 104,
  82.     sfHookGoToDesktop            = 105,
  83.     sfHookGoToAliasTarget        = 106,
  84.     sfHookGoToParent            = 107,
  85.     sfHookGoToNextDrive            = 108,
  86.     sfHookGoToPrevDrive            = 109,
  87.     sfHookChangeSelection        = 110
  88. };
  89.  
  90. enum  {
  91.     sfHookSetActiveOffset        = 200,
  92.     sfHookLastCall                = -2
  93. };
  94.  
  95.  
  96. /* the refcon field of the dialog record during a
  97.  modalfilter or dialoghook contains one of the following */
  98.  
  99. #define sfMainDialogRefCon 'stdf'
  100.  
  101. #define sfNewFolderDialogRefCon 'nfdr'
  102.  
  103. #define sfReplaceDialogRefCon 'rplc'
  104.  
  105. #define sfStatWarnDialogRefCon 'stat'
  106.  
  107. #define sfLockWarnDialogRefCon 'lock'
  108.  
  109. #define sfErrorDialogRefCon 'err '
  110.  
  111. #if defined(powerc) || defined (__powerc)
  112. #pragma options align=mac68k
  113. #endif
  114. struct SFReply {
  115.     Boolean                        good;
  116.     Boolean                        copy;
  117.     OSType                        fType;
  118.     short                        vRefNum;
  119.     short                        version;
  120.     Str63                        fName;
  121. };
  122. #if defined(powerc) || defined(__powerc)
  123. #pragma options align=reset
  124. #endif
  125.  
  126. typedef struct SFReply SFReply;
  127.  
  128. #if defined(powerc) || defined (__powerc)
  129. #pragma options align=mac68k
  130. #endif
  131. struct StandardFileReply {
  132.     Boolean                        sfGood;
  133.     Boolean                        sfReplacing;
  134.     OSType                        sfType;
  135.     FSSpec                        sfFile;
  136.     ScriptCode                    sfScript;
  137.     short                        sfFlags;
  138.     Boolean                        sfIsFolder;
  139.     Boolean                        sfIsVolume;
  140.     long                        sfReserved1;
  141.     short                        sfReserved2;
  142. };
  143. #if defined(powerc) || defined(__powerc)
  144. #pragma options align=reset
  145. #endif
  146.  
  147. typedef struct StandardFileReply StandardFileReply;
  148.  
  149. typedef pascal short (*DlgHookProcPtr)(short item, DialogPtr theDialog);
  150.  
  151. enum {
  152.     uppDlgHookProcInfo = kPascalStackBased
  153.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  154.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  155.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DialogPtr)))
  156. };
  157.  
  158. #if USESROUTINEDESCRIPTORS
  159. typedef UniversalProcPtr DlgHookUPP;
  160.  
  161. #define CallDlgHookProc(userRoutine, item, theDialog)        \
  162.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppDlgHookProcInfo, (item), (theDialog))
  163. #define NewDlgHookProc(userRoutine)        \
  164.         (DlgHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDlgHookProcInfo, GetCurrentISA())
  165. #else
  166. typedef DlgHookProcPtr DlgHookUPP;
  167.  
  168. #define CallDlgHookProc(userRoutine, item, theDialog)        \
  169.         (*(userRoutine))((item), (theDialog))
  170. #define NewDlgHookProc(userRoutine)        \
  171.         (DlgHookUPP)(userRoutine)
  172. #endif
  173.  
  174. typedef pascal Boolean (*FileFilterProcPtr)(ParmBlkPtr PB);
  175.  
  176. enum {
  177.     uppFileFilterProcInfo = kPascalStackBased
  178.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  179.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ParmBlkPtr)))
  180. };
  181.  
  182. #if USESROUTINEDESCRIPTORS
  183. typedef UniversalProcPtr FileFilterUPP;
  184.  
  185. #define CallFileFilterProc(userRoutine, PB)        \
  186.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileFilterProcInfo, (PB))
  187. #define NewFileFilterProc(userRoutine)        \
  188.         (FileFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileFilterProcInfo, GetCurrentISA())
  189. #else
  190. typedef FileFilterProcPtr FileFilterUPP;
  191.  
  192. #define CallFileFilterProc(userRoutine, PB)        \
  193.         (*(userRoutine))((PB))
  194. #define NewFileFilterProc(userRoutine)        \
  195.         (FileFilterUPP)(userRoutine)
  196. #endif
  197.  
  198.  
  199. /* the following also include an extra parameter of "your data pointer" */
  200.  
  201. typedef pascal short (*DlgHookYDProcPtr)(short item, DialogPtr theDialog, void *yourDataPtr);
  202.  
  203. enum {
  204.     uppDlgHookYDProcInfo = kPascalStackBased
  205.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  206.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  207.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DialogPtr)))
  208.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void*)))
  209. };
  210.  
  211. #if USESROUTINEDESCRIPTORS
  212. typedef UniversalProcPtr DlgHookYDUPP;
  213.  
  214. #define CallDlgHookYDProc(userRoutine, item, theDialog, yourDataPtr)        \
  215.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppDlgHookYDProcInfo, (item), (theDialog), (yourDataPtr))
  216. #define NewDlgHookYDProc(userRoutine)        \
  217.         (DlgHookYDUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDlgHookYDProcInfo, GetCurrentISA())
  218. #else
  219. typedef DlgHookYDProcPtr DlgHookYDUPP;
  220.  
  221. #define CallDlgHookYDProc(userRoutine, item, theDialog, yourDataPtr)        \
  222.         (*(userRoutine))((item), (theDialog), (yourDataPtr))
  223. #define NewDlgHookYDProc(userRoutine)        \
  224.         (DlgHookYDUPP)(userRoutine)
  225. #endif
  226.  
  227. typedef pascal Boolean (*ModalFilterYDProcPtr)(DialogPtr theDialog, EventRecord *theEvent, short *itemHit, void *yourDataPtr);
  228.  
  229. enum {
  230.     uppModalFilterYDProcInfo = kPascalStackBased
  231.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  232.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DialogPtr)))
  233.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EventRecord*)))
  234.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short*)))
  235.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
  236. };
  237.  
  238. #if USESROUTINEDESCRIPTORS
  239. typedef UniversalProcPtr ModalFilterYDUPP;
  240.  
  241. #define CallModalFilterYDProc(userRoutine, theDialog, theEvent, itemHit, yourDataPtr)        \
  242.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppModalFilterYDProcInfo, (theDialog), (theEvent), (itemHit), (yourDataPtr))
  243. #define NewModalFilterYDProc(userRoutine)        \
  244.         (ModalFilterYDUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppModalFilterYDProcInfo, GetCurrentISA())
  245. #else
  246. typedef ModalFilterYDProcPtr ModalFilterYDUPP;
  247.  
  248. #define CallModalFilterYDProc(userRoutine, theDialog, theEvent, itemHit, yourDataPtr)        \
  249.         (*(userRoutine))((theDialog), (theEvent), (itemHit), (yourDataPtr))
  250. #define NewModalFilterYDProc(userRoutine)        \
  251.         (ModalFilterYDUPP)(userRoutine)
  252. #endif
  253.  
  254. typedef pascal Boolean (*FileFilterYDProcPtr)(ParmBlkPtr PB, void *yourDataPtr);
  255.  
  256. enum {
  257.     uppFileFilterYDProcInfo = kPascalStackBased
  258.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  259.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ParmBlkPtr)))
  260.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  261. };
  262.  
  263. #if USESROUTINEDESCRIPTORS
  264. typedef UniversalProcPtr FileFilterYDUPP;
  265.  
  266. #define CallFileFilterYDProc(userRoutine, PB, yourDataPtr)        \
  267.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileFilterYDProcInfo, (PB), (yourDataPtr))
  268. #define NewFileFilterYDProc(userRoutine)        \
  269.         (FileFilterYDUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileFilterYDProcInfo, GetCurrentISA())
  270. #else
  271. typedef FileFilterYDProcPtr FileFilterYDUPP;
  272.  
  273. #define CallFileFilterYDProc(userRoutine, PB, yourDataPtr)        \
  274.         (*(userRoutine))((PB), (yourDataPtr))
  275. #define NewFileFilterYDProc(userRoutine)        \
  276.         (FileFilterYDUPP)(userRoutine)
  277. #endif
  278.  
  279. typedef pascal void (*ActivateYDProcPtr)(DialogPtr theDialog, short itemNo, Boolean activating, void *yourDataPtr);
  280.  
  281. enum {
  282.     uppActivateYDProcInfo = kPascalStackBased
  283.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DialogPtr)))
  284.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  285.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean)))
  286.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
  287. };
  288.  
  289. #if USESROUTINEDESCRIPTORS
  290. typedef UniversalProcPtr ActivateYDUPP;
  291.  
  292. #define CallActivateYDProc(userRoutine, theDialog, itemNo, activating, yourDataPtr)        \
  293.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppActivateYDProcInfo, (theDialog), (itemNo), (activating), (yourDataPtr))
  294. #define NewActivateYDProc(userRoutine)        \
  295.         (ActivateYDUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppActivateYDProcInfo, GetCurrentISA())
  296. #else
  297. typedef ActivateYDProcPtr ActivateYDUPP;
  298.  
  299. #define CallActivateYDProc(userRoutine, theDialog, itemNo, activating, yourDataPtr)        \
  300.         (*(userRoutine))((theDialog), (itemNo), (activating), (yourDataPtr))
  301. #define NewActivateYDProc(userRoutine)        \
  302.         (ActivateYDUPP)(userRoutine)
  303. #endif
  304.  
  305. typedef OSType SFTypeList[4];
  306.  
  307. #ifdef __cplusplus
  308. extern "C" {
  309. #endif
  310.  
  311. extern pascal void SFPutFile(Point where, ConstStr255Param prompt, ConstStr255Param origName, DlgHookUPP dlgHook, SFReply *reply)
  312.  THREEWORDINLINE(0x3F3C, 0x0001, 0xA9EA);
  313. extern pascal void SFGetFile(Point where, ConstStr255Param prompt, FileFilterUPP fileFilter, short numTypes, SFTypeList typeList, DlgHookUPP dlgHook, SFReply *reply)
  314.  THREEWORDINLINE(0x3F3C, 0x0002, 0xA9EA);
  315. extern pascal void SFPPutFile(Point where, ConstStr255Param prompt, ConstStr255Param origName, DlgHookUPP dlgHook, SFReply *reply, short dlgID, ModalFilterUPP filterProc)
  316.  THREEWORDINLINE(0x3F3C, 0x0003, 0xA9EA);
  317. extern pascal void SFPGetFile(Point where, ConstStr255Param prompt, FileFilterUPP fileFilter, short numTypes, SFTypeList typeList, DlgHookUPP dlgHook, SFReply *reply, short dlgID, ModalFilterUPP filterProc)
  318.  THREEWORDINLINE(0x3F3C, 0x0004, 0xA9EA);
  319. extern pascal void StandardPutFile(ConstStr255Param prompt, ConstStr255Param defaultName, StandardFileReply *reply)
  320.  THREEWORDINLINE(0x3F3C, 0x0005, 0xA9EA);
  321. extern pascal void StandardGetFile(FileFilterUPP fileFilter, short numTypes, SFTypeList typeList, StandardFileReply *reply)
  322.  THREEWORDINLINE(0x3F3C, 0x0006, 0xA9EA);
  323. extern pascal void CustomPutFile(ConstStr255Param prompt, ConstStr255Param defaultName, StandardFileReply *reply, short dlgID, Point where, DlgHookYDUPP dlgHook, ModalFilterYDUPP filterProc, short *activeList, ActivateYDUPP activate, void *yourDataPtr)
  324.  THREEWORDINLINE(0x3F3C, 0x0007, 0xA9EA);
  325. extern pascal void CustomGetFile(FileFilterYDUPP fileFilter, short numTypes, SFTypeList typeList, StandardFileReply *reply, short dlgID, Point where, DlgHookYDUPP dlgHook, ModalFilterYDUPP filterProc, short *activeList, ActivateYDUPP activate, void *yourDataPtr)
  326.  THREEWORDINLINE(0x3F3C, 0x0008, 0xA9EA);
  327. extern void sfpputfile(Point *where, char *prompt, char *origName, DlgHookUPP dlgHook, SFReply *reply, short dlgID, ModalFilterUPP filterProc);
  328. extern void sfgetfile(Point *where, char *prompt, FileFilterUPP fileFilter, short numTypes, SFTypeList typeList, DlgHookUPP dlgHook, SFReply *reply);
  329. extern void sfpgetfile(Point *where, char *prompt, FileFilterUPP fileFilter, short numTypes, SFTypeList typeList, DlgHookUPP dlgHook, SFReply *reply, short dlgID, ModalFilterUPP filterProc);
  330. extern void sfputfile(Point *where, char *prompt, char *origName, DlgHookUPP dlgHook, SFReply *reply);
  331.  
  332. /* 
  333.  
  334.   New StandardFile routine comments:
  335.  
  336.   activeList is pointer to array of integer (16-bits).
  337.   first integer is length of list.
  338.   following integers are possible activatable DITL items, in
  339.   the order that the tab key will cycle through.  The first
  340.   in the list is the item made active when dialog is first shown.
  341.  
  342.   activateProc is a pointer to a procedure like:
  343.  
  344.    PROCEDURE MyActivateProc(theDialog:  DialogPtr;
  345.           itemNo:  INTEGER;
  346.           activating: BOOLEAN;
  347.           yourDataPtr: Ptr);
  348.  
  349.   The activateProc is called with activating=FALSE on the itemNo
  350.   about to deactivate then with activating=TRUE on the itemNo
  351.   about to become the active item. (like activate event)
  352.  
  353.   yourDataPtr is a nice little extra that makes life easier without
  354.   globals.  CustomGetFile & CustomPPutFile when calling any of their
  355.   call back procedures, pushes the extra parameter of yourDataPtr on
  356.   the stack.
  357.  
  358.   In addition the filterProc in CustomGetFile & CustomPPutFile is called
  359.   before before SF does any mapping, instead of after.
  360. */
  361.  
  362. #ifdef __cplusplus
  363. }
  364. #endif
  365.  
  366. #endif
  367.  
  368.