home *** CD-ROM | disk | FTP | other *** search
- /*
- file Utilities.h
-
- Description:
- This file contains a number of utility routines used in the
- PackageTool application. these routines have been moved here
- to simplify the example.
-
- PackageTool is an application illustrating how to create application
- packages in Mac OS 9. It provides a simple interface for converting
- correctly formatted folders into packages and vice versa.
-
- by John Montbriand, 1999.
-
- Copyright: © 1999 by Apple Computer, Inc.
- all rights reserved.
-
- Disclaimer:
- You may incorporate this sample code into your applications without
- restriction, though the sample code has been provided "AS IS" and the
- responsibility for its operation is 100% yours. However, what you are
- not permitted to do is to redistribute the source as "DSC Sample Code"
- after having made changes. If you're going to re-distribute the source,
- we require that you make it clear in the source that the code was
- descended from Apple Sample Code, but that you've made changes.
-
- Change History (most recent first):
- 10/19/99 created by John Montbriand
- */
-
- #ifndef __UTILITIES__
- #define __UTILITIES__
-
- #include <MacTypes.h>
- #include <Files.h>
- #include <Aliases.h>
- #include <Drag.h>
- #include <Icons.h>
- #include <QDOffscreen.h>
- #include <Script.h>
-
-
- /* ValidFSSpec verifies that *spec refers is formatted correctly, and it
- verifies that it refers to an existing file in an existing directory on
- and existing volume. If *spec is valid, the function returns noErr,
- otherwise an error is returned. */
- OSErr ValidFSSpec(FSSpec *spec);
-
-
- /* ResolveAliasQuietly resolves an alias using a fast search with no user interaction. Our main loop
- periodically resolves gFileAlias comparing the result to gTargetFile to keep the display up to date.
- As a result, we would like the resolve alias call to be as quick as possible AND since the application
- may be in the background when it is called, we don't want any user interaction. */
- OSErr ResolveAliasQuietly(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged);
-
-
- /* GrayOutBox grays out an area of the screen in the current grafport.
- *theBox is in local coordinates in the current grafport. This routine
- is for direct screen drawing only. */
- void GrayOutBox(Rect *theBox);
-
-
- /* ShowDragHiliteBox is called to hilite the drop box area in the
- main window. Here, we draw a 3 pixel wide border around *boxBounds. */
- OSErr ShowDragHiliteBox(DragReference theDragRef, Rect *boxBounds);
-
-
- /* UpdateRelativeAliasFile updates the alias file located at
- aliasDest referring to the targetFile. relative path
- information is stored in the new file. */
- OSErr UpdateRelativeAliasFile(FSSpec *theAliasFile, FSSpec *targetFile);
-
- /* FileSharingAppIsRunning returns true if the file sharing
- extension is running. */
- Boolean FileSharingAppIsRunning(void);
-
- /* FSSpecIsInDirectory returns true if the file system object
- referred to by theSpec is somewhere in the directory referred
- to by (vRefNum, dirID) */
- Boolean FSSpecIsInDirectory(FSSpec *theSpec, short vRefNum, long dirID);
-
-
- /* FSSpecIsAFolder returns true if the FSSpec pointed
- to by target refers to a folder. */
- Boolean FSSpecIsAFolder(FSSpec *target);
-
-
- /* ShowChangesInFinderWindow asks the finder redraw a directory
- window by either sending a update container event to the
- finder if this facility exists, or by bumping the parent directorie's
- modification date */
- OSErr ShowChangesInFinderWindow(short vRefNum, long dirID);
-
- #endif
-