home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef _DRAGUTILS_
- #define _DRAGUTILS_
-
-
- #ifndef __DRAG__
- #include <Drag.h>
- #endif
-
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
-
- /**\
- |**| ==============================================================================
- |**| PUBLIC TYPEDEFS
- |**| ==============================================================================
- \**/
-
- typedef struct _DragZone DragZoneRec, *DragZonePtr, **DragZoneHdl ;
- typedef struct _DragZones DragZonesRec, *DragZonesPtr, **DragZonesHdl ;
-
- typedef pascal OSErr (*DragZoneRecvProcPtr) (DragZoneHdl theZone,WindowRef theWindow,Point theLocation, Handle dataHdl) ;
-
- #if GENERATINGCFM
- typedef UniversalProcPtr DragZoneRecvUPP;
- #else
- typedef DragZoneRecvProcPtr DragZoneRecvUPP;
- #endif
-
- enum {
- uppDragZoneRecvProcInfo = kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DragZoneHdl)))
- | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowRef)))
- | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Point)))
- | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Handle)))
- };
-
- #if GENERATINGCFM
- #define NewDragZoneRecvProc(userRoutine) \
- (DragZoneRecvUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDragZoneRecvProcInfo, GetCurrentArchitecture())
- #else
- #define NewDragZoneRecvProc(userRoutine) \
- ((DragZoneRecvUPP) (userRoutine))
- #endif
-
- #if GENERATINGCFM
- #define CallDragZoneRecvProc(userRoutine, theZone, theWindow, theLocation, dataHdl) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), uppDragZoneRecvProcInfo, (theZone), (theWindow), (theLocation), (dataHdl))
- #else
- #define CallDragZoneRecvProc(userRoutine, theZone, theWindow, theLocation, dataHdl) \
- (*(userRoutine))((theZone), (theWindow), (theLocation), (dataHdl))
- #endif
-
-
- struct _DragZone
- {
- Rect rect ;
- FlavorType flavor ;
- OSType HFSfileType ;
- DragZoneRecvUPP dragRecvUPP ;
- void *zoneRefCon ;
- } ;
-
- struct _DragZones
- {
- WindowRef window;
- DragTrackingHandlerUPP trackingHandler ;
- DragReceiveHandlerUPP receiveHandler ;
- unsigned long count ;
- DragZoneHdl item[] ;
- } ;
-
-
- /**\
- |**| ==============================================================================
- |**| PUBLIC FUNCTION PROTOTYPES
- |**| ==============================================================================
- \**/
- OSErr Drag_present ( void ) ;
- OSErr Drag_available ( void ) ;
- OSErr Drag_initialize ( void ) ;
- Boolean DragIsInRect ( DragReference drag, WindowRef window, Rect *rect ) ;
- Boolean DragIsInSourceWindow ( DragReference drag ) ;
- Boolean DropLocationIsFinderTrash ( DragReference drag ) ;
-
- DragZonesHdl NewDragZones ( WindowRef window ) ;
- void DisposeDragZonesHandle ( DragZonesHdl zones ) ;
- OSErr AddDragZone ( DragZonesHdl zones, DragZonePtr zone ) ;
- OSErr DelDragZone ( DragZonesHdl zones, DragZoneHdl zone ) ;
- short FindDragZones ( DragZonesHdl zones, FlavorType flavor, OSType HFSfileType,
- short index, short count, DragZoneHdl *result ) ;
-
- Boolean DragZoneItemsAcceptable ( DragReference drag, DragZonesHdl zones ) ;
- long DragZoneIsInWhichRect ( DragReference drag, WindowRef theWindow, DragZonesHdl zones ) ;
-
- OSErr RegisterDragAppleEvents ( void ) ;
- pascal OSErr HandleDragRecv ( AppleEvent *theAppleEvent, AppleEvent *reply, long refCon ) ;
- OSErr SendDragRecv ( DragZoneHdl theZone, WindowRef theWindow, Point theLocation,
- Handle dataHdl, DragZoneRecvUPP theDragZoneRecvUPP ) ;
-
- OSErr OutlineRegion ( RgnHandle theRgn ) ;
-
-
- #endif