mirror of
https://github.com/elliotnunn/BuildCubeE.git
synced 2024-11-19 00:05:25 +00:00
260 lines
7.9 KiB
C
260 lines
7.9 KiB
C
/************************************************************
|
|
|
|
Created: Sunday, January 6, 1991 at 10:06 PM
|
|
StandardFile.h
|
|
C Interface to the Macintosh Libraries
|
|
|
|
|
|
Copyright Apple Computer, Inc. 1990
|
|
All rights reserved
|
|
|
|
************************************************************/
|
|
|
|
|
|
#ifndef __STANDARDFILE__
|
|
#define __STANDARDFILE__
|
|
|
|
#ifndef __TYPES__
|
|
#include <Types.h>
|
|
#endif
|
|
|
|
#ifndef __DIALOGS__
|
|
#include <Dialogs.h>
|
|
#endif
|
|
|
|
#ifndef __FILES__
|
|
#include <Files.h>
|
|
#endif
|
|
|
|
|
|
enum {
|
|
|
|
|
|
/* resource IDs and item offsets of pre-7.0 dialogs */
|
|
putDlgID = -3999,
|
|
putSave = 1,
|
|
putCancel = 2,
|
|
putEject = 5,
|
|
putDrive = 6,
|
|
putName = 7,
|
|
|
|
getDlgID = -4000,
|
|
getOpen = 1,
|
|
getCancel = 3,
|
|
getEject = 5,
|
|
getDrive = 6,
|
|
getNmList = 7,
|
|
getScroll = 8,
|
|
|
|
/* resource IDs and item offsets of 7.0 dialogs */
|
|
sfPutDialogID = -6043,
|
|
sfGetDialogID = -6042,
|
|
sfItemOpenButton = 1,
|
|
sfItemCancelButton = 2,
|
|
sfItemBalloonHelp = 3,
|
|
sfItemVolumeUser = 4,
|
|
sfItemEjectButton = 5
|
|
};
|
|
enum {
|
|
sfItemDesktopButton = 6,
|
|
sfItemFileListUser = 7,
|
|
sfItemPopUpMenuUser = 8,
|
|
sfItemDividerLinePict = 9,
|
|
sfItemFileNameTextEdit = 10,
|
|
sfItemPromptStaticText = 11,
|
|
sfItemNewFolderUser = 12,
|
|
|
|
|
|
/* pseudo-item hits for use in DlgHook */
|
|
sfHookFirstCall = -1,
|
|
sfHookCharOffset = 0x1000,
|
|
sfHookNullEvent = 100,
|
|
sfHookRebuildList = 101,
|
|
sfHookFolderPopUp = 102,
|
|
sfHookOpenFolder = 103,
|
|
|
|
|
|
/* the following are only in system 7.0+ */
|
|
sfHookOpenAlias = 104,
|
|
sfHookGoToDesktop = 105,
|
|
sfHookGoToAliasTarget = 106,
|
|
sfHookGoToParent = 107,
|
|
sfHookGoToNextDrive = 108,
|
|
sfHookGoToPrevDrive = 109,
|
|
sfHookChangeSelection = 110
|
|
};
|
|
enum {
|
|
sfHookSetActiveOffset = 200,
|
|
sfHookLastCall = -2
|
|
|
|
/* the refcon field of the dialog record during a
|
|
modalfilter or dialoghook contains one of the following */
|
|
|
|
#define sfMainDialogRefCon 'stdf'
|
|
#define sfNewFolderDialogRefCon 'nfdr'
|
|
#define sfReplaceDialogRefCon 'rplc'
|
|
#define sfStatWarnDialogRefCon 'stat'
|
|
#define sfLockWarnDialogRefCon 'lock'
|
|
#define sfErrorDialogRefCon 'err '
|
|
};
|
|
|
|
struct SFReply {
|
|
Boolean good;
|
|
Boolean copy;
|
|
OSType fType;
|
|
short vRefNum;
|
|
short version;
|
|
Str63 fName;
|
|
};
|
|
|
|
typedef struct SFReply SFReply;
|
|
|
|
struct StandardFileReply {
|
|
Boolean sfGood;
|
|
Boolean sfReplacing;
|
|
OSType sfType;
|
|
FSSpec sfFile;
|
|
ScriptCode sfScript;
|
|
short sfFlags;
|
|
Boolean sfIsFolder;
|
|
Boolean sfIsVolume;
|
|
long sfReserved1;
|
|
short sfReserved2;
|
|
};
|
|
|
|
typedef struct StandardFileReply StandardFileReply;
|
|
|
|
|
|
typedef pascal short (*DlgHookProcPtr)(short item, DialogPtr theDialog);
|
|
typedef pascal Boolean (*FileFilterProcPtr)(ParmBlkPtr PB);
|
|
|
|
/* the following also include an extra parameter of "your data pointer" */
|
|
typedef pascal short (*DlgHookYDProcPtr)(short item, DialogPtr theDialog, void *yourDataPtr);
|
|
typedef pascal Boolean (*ModalFilterYDProcPtr)(DialogPtr theDialog, EventRecord *theEvent, short *itemHit, void *yourDataPtr);
|
|
typedef pascal Boolean (*FileFilterYDProcPtr)(ParmBlkPtr PB, void *yourDataPtr);
|
|
typedef pascal void (*ActivateYDProcPtr)(DialogPtr theDialog, short itemNo, Boolean activating, void *yourDataPtr);
|
|
|
|
typedef OSType SFTypeList[4];
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
pascal void SFPutFile(Point where,
|
|
ConstStr255Param prompt,
|
|
ConstStr255Param origName,
|
|
DlgHookProcPtr dlgHook,
|
|
SFReply *reply)
|
|
= {0x3F3C,0x0001,0xA9EA};
|
|
|
|
pascal void SFGetFile(Point where,
|
|
ConstStr255Param prompt,
|
|
FileFilterProcPtr fileFilter,
|
|
short numTypes,
|
|
SFTypeList typeList,
|
|
DlgHookProcPtr dlgHook,
|
|
SFReply *reply)
|
|
= {0x3F3C,0x0002,0xA9EA};
|
|
|
|
pascal void SFPPutFile(Point where,
|
|
ConstStr255Param prompt,
|
|
ConstStr255Param origName,
|
|
DlgHookProcPtr dlgHook,
|
|
SFReply *reply,
|
|
short dlgID,
|
|
ModalFilterProcPtr filterProc)
|
|
= {0x3F3C,0x0003,0xA9EA};
|
|
|
|
pascal void SFPGetFile(Point where,
|
|
ConstStr255Param prompt,
|
|
FileFilterProcPtr fileFilter,
|
|
short numTypes,
|
|
SFTypeList typeList,
|
|
DlgHookProcPtr dlgHook,
|
|
SFReply *reply,
|
|
short dlgID,
|
|
ModalFilterProcPtr filterProc)
|
|
= {0x3F3C,0x0004,0xA9EA};
|
|
|
|
pascal void StandardPutFile(ConstStr255Param prompt,
|
|
ConstStr255Param defaultName,
|
|
StandardFileReply *reply)
|
|
= {0x3F3C,0x0005,0xA9EA};
|
|
|
|
pascal void StandardGetFile(FileFilterProcPtr fileFilter,
|
|
short numTypes,
|
|
SFTypeList typeList,
|
|
StandardFileReply *reply)
|
|
= {0x3F3C,0x0006,0xA9EA};
|
|
|
|
pascal void CustomPutFile(ConstStr255Param prompt,
|
|
ConstStr255Param defaultName,
|
|
StandardFileReply *reply,
|
|
short dlgID,
|
|
Point where,
|
|
DlgHookYDProcPtr dlgHook,
|
|
ModalFilterYDProcPtr filterProc,
|
|
short *activeList,
|
|
ActivateYDProcPtr activateProc,
|
|
void *yourDataPtr)
|
|
= {0x3F3C,0x0007,0xA9EA};
|
|
|
|
pascal void CustomGetFile(FileFilterYDProcPtr fileFilter,
|
|
short numTypes,
|
|
SFTypeList typeList,
|
|
StandardFileReply *reply,
|
|
short dlgID,
|
|
Point where,
|
|
DlgHookYDProcPtr dlgHook,
|
|
ModalFilterYDProcPtr filterProc,
|
|
short *activeList,
|
|
ActivateYDProcPtr activateProc,
|
|
void *yourDataPtr)
|
|
= {0x3F3C,0x0008,0xA9EA};
|
|
|
|
void sfpputfile(Point *where,char *prompt,char *origName,DlgHookProcPtr dlgHook,
|
|
SFReply *reply,short dlgID,ModalFilterProcPtr filterProc);
|
|
void sfgetfile(Point *where,char *prompt,FileFilterProcPtr fileFilter,short numTypes,
|
|
SFTypeList typeList,DlgHookProcPtr dlgHook,SFReply *reply);
|
|
void sfpgetfile(Point *where,char *prompt,FileFilterProcPtr fileFilter,
|
|
short numTypes,SFTypeList typeList,DlgHookProcPtr dlgHook,SFReply *reply,
|
|
short dlgID,ModalFilterProcPtr filterProc);
|
|
void sfputfile(Point *where,char *prompt,char *origName,DlgHookProcPtr dlgHook,
|
|
SFReply *reply);
|
|
|
|
/*
|
|
|
|
New StandardFile routine comments:
|
|
|
|
activeList is pointer to array of integer (16-bits).
|
|
first integer is length of list.
|
|
following integers are possible activatable DITL items, in
|
|
the order that the tab key will cycle through. The first
|
|
in the list is the item made active when dialog is first shown.
|
|
|
|
activateProc is a pointer to a procedure like:
|
|
|
|
PROCEDURE MyActivateProc(theDialog: DialogPtr;
|
|
itemNo: INTEGER;
|
|
activating: BOOLEAN;
|
|
yourDataPtr: Ptr);
|
|
|
|
The activateProc is called with activating=FALSE on the itemNo
|
|
about to deactivate then with activating=TRUE on the itemNo
|
|
about to become the active item. (like activate event)
|
|
|
|
yourDataPtr is a nice little extra that makes life easier without
|
|
globals. CustomGetFile & CustomPPutFile when calling any of their
|
|
call back procedures, pushes the extra parameter of yourDataPtr on
|
|
the stack.
|
|
|
|
In addition the filterProc in CustomGetFile & CustomPPutFile is called
|
|
before before SF does any mapping, instead of after.
|
|
*/
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|