/*
 	File:		Finder.h
 
 	Contains:	Finder flags and container types.
 
 	Version:	Technology:	Mac OS 8.1
 				Release:	QuickTime 4.0
 
 	Copyright:	(c) 1990-1998 by Apple Computer, Inc., all rights reserved
 
 	Bugs?:		For bug reports, consult the following page on
 				the World Wide Web:
 
 					http://developer.apple.com/bugreporter/
 
*/
#ifndef __FINDER__
#define __FINDER__

#ifndef __MACTYPES__
#include <MacTypes.h>
#endif
#ifndef __QUICKDRAW__
#include <Quickdraw.h>
#endif
#ifndef __EVENTS__
#include <Events.h>
#endif



#if PRAGMA_ONCE
#pragma once
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if PRAGMA_IMPORT
#pragma import on
#endif

#if PRAGMA_STRUCT_ALIGN
	#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
	#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
	#pragma pack(2)
#endif

/* Creator and type of clipping files */

enum {
	kClippingCreator			= FOUR_CHAR_CODE('drag'),
	kClippingPictureType		= FOUR_CHAR_CODE('clpp'),
	kClippingTextType			= FOUR_CHAR_CODE('clpt'),
	kClippingSoundType			= FOUR_CHAR_CODE('clps'),
	kClippingUnknownType		= FOUR_CHAR_CODE('clpu')
};


/* Creator and type of Internet Location files */

enum {
	kInternetLocationCreator	= FOUR_CHAR_CODE('drag'),
	kInternetLocationHTTP		= FOUR_CHAR_CODE('ilht'),
	kInternetLocationFTP		= FOUR_CHAR_CODE('ilft'),
	kInternetLocationFile		= FOUR_CHAR_CODE('ilfi'),
	kInternetLocationMail		= FOUR_CHAR_CODE('ilma'),
	kInternetLocationNNTP		= FOUR_CHAR_CODE('ilnw'),
	kInternetLocationAFP		= FOUR_CHAR_CODE('ilaf'),
	kInternetLocationAppleTalk	= FOUR_CHAR_CODE('ilat'),
	kInternetLocationGeneric	= FOUR_CHAR_CODE('ilge')
};




enum {
	kCustomIconResource			= -16455						/* Custom icon family resource ID */
};

/* In order to specify any of the information described in the */
/* CustomBadgeResource data structure you must clear the kExtendedFlagsAreInvalid */
/* and set kExtendedFlagHasCustomBadge of the FXInfo.fdXFlags or DXInfo.frXFlags field, */
/* and add a resource of type kCustomBadgeResourceType and ID kCustomBadgeResourceID to */
/* the file or to the "Icon/n" file for a folder */

enum {
	kCustomBadgeResourceType	= FOUR_CHAR_CODE('badg'),
	kCustomBadgeResourceID		= kCustomIconResource,
	kCustomBadgeResourceVersion	= 0
};


struct CustomBadgeResource {
	SInt16 							version;					/* This is version kCustomBadgeResourceVersion*/
	SInt16 							customBadgeResourceID;		/* If not 0, the ID of a resource to use on top*/
																/* of the icon for this file or folder*/
	OSType 							customBadgeType;			/* If not 0, the type and creator of an icon*/
	OSType 							customBadgeCreator;			/* to use on top of the icon*/
	OSType 							windowBadgeType;			/* If not 0, the type and creator of an icon*/
	OSType 							windowBadgeCreator;			/* to display in the header of the window for this */
																/* file or folder*/
	OSType 							overrideType;				/* If not 0, the type and creator of an icon to*/
	OSType 							overrideCreator;			/* use INSTEAD of the icon for this file or folder*/
};
typedef struct CustomBadgeResource		CustomBadgeResource;
typedef CustomBadgeResource *			CustomBadgeResourcePtr;
typedef CustomBadgeResourcePtr *		CustomBadgeResourceHandle;
/* You can specify routing information for a file by including a 'rout' 0 
	resource in it and setting the kExtendedFlagHasRoutingInfo bit in the extended 
	Finder flags. 
	The 'rout' resource is an array of RoutingResourceEntry. Each entry is considered
	in turn. The first matching entry is used.
	If the creator and fileType match the file being dropped and targetFolder match
	the folder ID of the folder being dropped onto, then the file is rerouted 
	into the specified destination folder.
	The only target folder currently supported is the system folder, 
	kSystemFolderType = 'macs'.
*/

enum {
	kRoutingResourceType		= FOUR_CHAR_CODE('rout'),
	kRoutingResourceID			= 0
};


struct RoutingResourceEntry {
	OSType 							creator;					/* Use '****' or 0 to match any creator */
	OSType 							fileType;					/* Use '****' or 0 to match any file type */
	OSType 							targetFolder;				/* Folder ID of the folder this file was dropped onto */
	OSType 							destinationFolder;			/* Folder that the source will be routed to */
	OSType 							reserved;					/* Set to 0 */
};
typedef struct RoutingResourceEntry		RoutingResourceEntry;

typedef RoutingResourceEntry *			RoutingResourcePtr;
typedef RoutingResourcePtr *			RoutingResourceHandle;

/* Types for special container aliases */

enum {
	kContainerFolderAliasType	= FOUR_CHAR_CODE('fdrp'),		/* type for folder aliases */
	kContainerTrashAliasType	= FOUR_CHAR_CODE('trsh'),		/* type for trash folder aliases */
	kContainerHardDiskAliasType	= FOUR_CHAR_CODE('hdsk'),		/* type for hard disk aliases */
	kContainerFloppyAliasType	= FOUR_CHAR_CODE('flpy'),		/* type for floppy aliases */
	kContainerServerAliasType	= FOUR_CHAR_CODE('srvr'),		/* type for server aliases */
	kApplicationAliasType		= FOUR_CHAR_CODE('adrp'),		/* type for application aliases */
	kContainerAliasType			= FOUR_CHAR_CODE('drop'),		/* type for all other containers */
	kDesktopPrinterAliasType	= FOUR_CHAR_CODE('dtpa'),		/* type for Desktop Printer alias */
	kContainerCDROMAliasType	= FOUR_CHAR_CODE('cddr')		/* type for CD-ROM alias */
};

/* Types for Special folder aliases */

enum {
	kSystemFolderAliasType		= FOUR_CHAR_CODE('fasy'),
	kAppleMenuFolderAliasType	= FOUR_CHAR_CODE('faam'),
	kStartupFolderAliasType		= FOUR_CHAR_CODE('fast'),
	kPrintMonitorDocsFolderAliasType = FOUR_CHAR_CODE('fapn'),
	kPreferencesFolderAliasType	= FOUR_CHAR_CODE('fapf'),
	kControlPanelFolderAliasType = FOUR_CHAR_CODE('fact'),
	kExtensionFolderAliasType	= FOUR_CHAR_CODE('faex')
};

/* Types for AppleShare folder aliases */

enum {
	kExportedFolderAliasType	= FOUR_CHAR_CODE('faet'),
	kDropFolderAliasType		= FOUR_CHAR_CODE('fadr'),
	kSharedFolderAliasType		= FOUR_CHAR_CODE('fash'),
	kMountedFolderAliasType		= FOUR_CHAR_CODE('famn')
};

/* Finder flags (finderFlags, fdFlags and frFlags) */
/* Any flag reserved or not specified should be set to 0. */
/* If a flag applies to a file, but not to a folder, make sure to check */
/* that the item is not a folder by checking ((ParamBlockRec.ioFlAttrib & ioDirMask) == 0) */

enum {
	kIsOnDesk					= 0x0001,						/* Files and folders */
	kColor						= 0x000E,						/* Files and folders */
																/* bit 0x0020 was kRequireSwitchLaunch, but is now reserved for future use*/
	kIsShared					= 0x0040,						/* Files only (Applications only) */
																/* If clear, the application needs to write to */
																/* its resource fork, and therefore cannot be */
																/* shared on a server */
	kHasNoINITs					= 0x0080,						/* Files only (Extensions/Control Panels only) */
																/* This file contains no INIT resource */
	kHasBeenInited				= 0x0100,						/* Files only */
																/* Clear if the file contains desktop database */
																/* resources ('BNDL', 'FREF', 'open', 'kind'...) */
																/* that have not been added yet. Set only by the Finder */
																/* bit 0x0200 was the letter bit for AOCE, but is now reserved for future use */
	kHasCustomIcon				= 0x0400,						/* Files and folders */
	kIsStationery				= 0x0800,						/* Files only */
	kNameLocked					= 0x1000,						/* Files and folders */
	kHasBundle					= 0x2000,						/* Files only */
	kIsInvisible				= 0x4000,						/* Files and folders */
	kIsAlias					= 0x8000						/* Files only */
};

/* Obsolete. Use names defined above. */

enum {
	fOnDesk						= kIsOnDesk,
	fHasBundle					= kHasBundle,
	fInvisible					= kIsInvisible
};

/* Obsolete */

enum {
	fTrash						= -3,
	fDesktop					= -2,
	fDisk						= 0
};

#if OLDROUTINENAMES

enum {
	kIsStationary				= kIsStationery
};

#endif  /* OLDROUTINENAMES */

/* Extended flags (extendedFinderFlags, fdXFlags and frXFlags) */
/* Any flag not specified should be set to 0. */

enum {
	kExtendedFlagsAreInvalid	= 0x8000,						/* If set the other extended flags are ignored */
	kExtendedFlagHasCustomBadge	= 0x0100,						/* Set if the file or folder has a badge resource */
	kExtendedFlagHasRoutingInfo	= 0x0004						/* Set if the file contains routing info resource */
};



/* Use this creation date to indicate that a file is temporarily busy */
/* (while it is being downloaded or installed for example) */
/* This will prevent the Finder from attempting to change attributes */
/* of the file until it is fully created. */

enum {
	kMagicBusyCreationDate		= 0x4F3AFDB0
};


/*------------------------------------------------------------------------*/
/*
   The following data structures are binary compatible with FInfo, DInfo,
   FXInfo and DXInfo but represent the Mac OS 8 semantic of the fields.
   Use these data structures preferably to FInfo, etc...
*/
/*------------------------------------------------------------------------*/


struct FileInfo {
	OSType 							fileType;					/* The type of the file */
	OSType 							fileCreator;				/* The file's creator */
	UInt16 							finderFlags;				/* ex: kHasBundle, kIsInvisible... */
	Point 							location;					/* File's location in the folder */
																/* If set to {0, 0}, the Finder will place the item automatically */
	UInt16 							reserved;					/* (set to 0) */
};
typedef struct FileInfo					FileInfo;

struct FolderInfo {
	Rect 							windowBounds;				/* The position and dimension of the folder's window */
	UInt16 							finderFlags;				/* ex. kIsInvisible, kNameLocked, etc.*/
	Point 							location;					/* Folder's location in the parent folder */
																/* If set to {0, 0}, the Finder will place the item automatically */
	UInt16 							reserved;					/* (set to 0) */
};
typedef struct FolderInfo				FolderInfo;

struct ExtendedFileInfo {
	SInt16 							reserved[4];				/* Reserved (set to 0) */
	UInt16 							extendedFinderFlags;		/* Extended flags (custom badge, routing info...) */
	SInt16 							reserved2;					/* Reserved (set to 0). Comment ID if high-bit is clear */
	SInt32 							putAwayFolderID;			/* Put away folder ID */
};
typedef struct ExtendedFileInfo			ExtendedFileInfo;

struct ExtendedFolderInfo {
	Point 							scrollPosition;				/* Scroll position (for icon views) */
	SInt32 							reserved;					/* Reserved (set to 0) */
	UInt16 							extendedFinderFlags;		/* Extended flags (custom badge, routing info...) */
	SInt16 							reserved2;					/* Reserved (set to 0). Comment ID if high-bit is clear */
	SInt32 							putAwayFolderID;			/* Put away folder ID */
};
typedef struct ExtendedFolderInfo		ExtendedFolderInfo;
/*------------------------------------------------------------------------*/
/*
   The following data structures are here for compatibility.
   Use the new data structures replacing them if possible (i.e. FileInfo 
   instead of FInfo, etc...)
*/
/*------------------------------------------------------------------------*/
/* File info */
/*
     IMPORTANT:
     In MacOS 8, the fdFldr field has become reserved for the Finder.
*/

struct FInfo {
	OSType 							fdType;						/* The type of the file */
	OSType 							fdCreator;					/* The file's creator */
	UInt16 							fdFlags;					/* Flags ex. kHasBundle, kIsInvisible, etc. */
	Point 							fdLocation;					/* File's location in folder. */
																/* If set to {0, 0}, the Finder will place the item automatically */
	SInt16 							fdFldr;						/* Reserved (set to 0) */
};
typedef struct FInfo					FInfo;
/* Extended file info */
/*
     IMPORTANT:
     In MacOS 8, the fdIconID and fdComment fields were changed
     to become reserved fields for the Finder.
  	 The fdScript has become an extended flag.
*/

struct FXInfo {
	SInt16 							fdIconID;					/* Reserved (set to 0) */
	SInt16 							fdReserved[3];				/* Reserved (set to 0) */
	SInt8 							fdScript;					/* Extended flags. Script code if high-bit is set */
	SInt8 							fdXFlags;					/* Extended flags */
	SInt16 							fdComment;					/* Reserved (set to 0). Comment ID if high-bit is clear */
	SInt32 							fdPutAway;					/* Put away folder ID */
};
typedef struct FXInfo					FXInfo;
/* Folder info */
/*
     IMPORTANT:
     In MacOS 8, the frView field was changed to become reserved 
  	 field for the Finder.
*/

struct DInfo {
	Rect 							frRect;						/* Folder's window bounds */
	UInt16 							frFlags;					/* Flags ex. kIsInvisible, kNameLocked, etc.*/
	Point 							frLocation;					/* Folder's location in parent folder */
																/* If set to {0, 0}, the Finder will place the item automatically */
	SInt16 							frView;						/* Reserved (set to 0) */
};
typedef struct DInfo					DInfo;
/* Extended folder info */
/*
     IMPORTANT:
     In MacOS 8, the frOpenChain and frComment fields were changed
     to become reserved fields for the Finder.
  	 The frScript has become an extended flag.
*/

struct DXInfo {
	Point 							frScroll;					/* Scroll position */
	SInt32 							frOpenChain;				/* Reserved (set to 0) */
	SInt8 							frScript;					/* Extended flags. Script code if high-bit is set */
	SInt8 							frXFlags;					/* Extended flags */
	SInt16 							frComment;					/* Reserved (set to 0). Comment ID if high-bit is clear */
	SInt32 							frPutAway;					/* Put away folder ID */
};
typedef struct DXInfo					DXInfo;
/* Values of the 'message' parameter to a Control Panel 'cdev' */

enum {
	initDev						= 0,							/*Time for cdev to initialize itself*/
	hitDev						= 1,							/*Hit on one of my items*/
	closeDev					= 2,							/*Close yourself*/
	nulDev						= 3,							/*Null event*/
	updateDev					= 4,							/*Update event*/
	activDev					= 5,							/*Activate event*/
	deactivDev					= 6,							/*Deactivate event*/
	keyEvtDev					= 7,							/*Key down/auto key*/
	macDev						= 8,							/*Decide whether or not to show up*/
	undoDev						= 9,
	cutDev						= 10,
	copyDev						= 11,
	pasteDev					= 12,
	clearDev					= 13,
	cursorDev					= 14
};


/* Special values a Control Panel 'cdev' can return */

enum {
	cdevGenErr					= -1,							/*General error; gray cdev w/o alert*/
	cdevMemErr					= 0,							/*Memory shortfall; alert user please*/
	cdevResErr					= 1,							/*Couldn't get a needed resource; alert*/
	cdevUnset					= 3								/* cdevValue is initialized to this*/
};

/* Control Panel Default Proc */
typedef CALLBACK_API( long , ControlPanelDefProcPtr )(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
typedef STACK_UPP_TYPE(ControlPanelDefProcPtr) 					ControlPanelDefUPP;
enum { uppControlPanelDefProcInfo = 0x000FEAB0 }; 				/* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
#if MIXEDMODE_CALLS_ARE_FUNCTIONS
EXTERN_API(ControlPanelDefUPP)
NewControlPanelDefProc		   (ControlPanelDefProcPtr	userRoutine);
EXTERN_API(long)
CallControlPanelDefProc		   (ControlPanelDefUPP		userRoutine,
								short					message,
								short					item,
								short					numItems,
								short					cPanelID,
								EventRecord *			theEvent,
								long					cdevValue,
								DialogPtr				cpDialog);
#else
#define NewControlPanelDefProc(userRoutine) 					(ControlPanelDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
#define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)  CALL_SEVEN_PARAMETER_UPP((userRoutine), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
#endif



#if PRAGMA_STRUCT_ALIGN
	#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
	#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
	#pragma pack()
#endif

#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif

#ifdef __cplusplus
}
#endif

#endif /* __FINDER__ */

