home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / ColorSync 2.5.1 SDK / Sample Code / CSDemo 2.5 / ShellSources / dragUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-09  |  3.4 KB  |  108 lines  |  [TEXT/CWIE]

  1.  
  2. #ifndef _DRAGUTILS_
  3. #define _DRAGUTILS_
  4.  
  5.  
  6. #ifndef __DRAG__
  7. #include <Drag.h>
  8. #endif
  9.  
  10.  
  11. #ifndef __WINDOWS__
  12. #include <Windows.h>
  13. #endif
  14.  
  15.  
  16. /**\
  17. |**| ==============================================================================
  18. |**| PUBLIC TYPEDEFS
  19. |**| ==============================================================================
  20. \**/
  21.  
  22. typedef    struct    _DragZone  DragZoneRec, *DragZonePtr, **DragZoneHdl ;
  23. typedef    struct    _DragZones  DragZonesRec, *DragZonesPtr, **DragZonesHdl ;
  24.  
  25. typedef pascal OSErr (*DragZoneRecvProcPtr) (DragZoneHdl theZone,WindowRef theWindow,Point theLocation, Handle dataHdl) ;
  26.  
  27. #if GENERATINGCFM
  28. typedef UniversalProcPtr DragZoneRecvUPP;
  29. #else
  30. typedef DragZoneRecvProcPtr DragZoneRecvUPP;
  31. #endif
  32.  
  33. enum {
  34.     uppDragZoneRecvProcInfo = kPascalStackBased
  35.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  36.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DragZoneHdl)))
  37.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowRef)))
  38.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Point)))
  39.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Handle)))
  40. };
  41.         
  42. #if GENERATINGCFM
  43. #define NewDragZoneRecvProc(userRoutine)        \
  44.         (DragZoneRecvUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDragZoneRecvProcInfo, GetCurrentArchitecture())
  45. #else
  46. #define NewDragZoneRecvProc(userRoutine)        \
  47.         ((DragZoneRecvUPP) (userRoutine))
  48. #endif
  49.         
  50. #if GENERATINGCFM
  51. #define CallDragZoneRecvProc(userRoutine, theZone, theWindow, theLocation, dataHdl)        \
  52.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppDragZoneRecvProcInfo, (theZone), (theWindow), (theLocation), (dataHdl))
  53. #else
  54. #define CallDragZoneRecvProc(userRoutine, theZone, theWindow, theLocation, dataHdl)        \
  55.         (*(userRoutine))((theZone), (theWindow), (theLocation), (dataHdl))
  56. #endif
  57.  
  58.  
  59. struct _DragZone
  60. {
  61.     Rect            rect ;
  62.     FlavorType        flavor ;
  63.     OSType            HFSfileType ; 
  64.     DragZoneRecvUPP    dragRecvUPP ;
  65.     void            *zoneRefCon ;
  66. } ;
  67.  
  68. struct _DragZones
  69. {
  70.     WindowRef                window;
  71.     DragTrackingHandlerUPP    trackingHandler ;
  72.     DragReceiveHandlerUPP    receiveHandler ;
  73.     unsigned long            count ;
  74.     DragZoneHdl                item[] ;
  75. } ;
  76.  
  77.  
  78. /**\
  79. |**| ==============================================================================
  80. |**| PUBLIC FUNCTION PROTOTYPES
  81. |**| ==============================================================================
  82. \**/
  83. OSErr            Drag_present                ( void ) ;
  84. OSErr            Drag_available                ( void ) ;
  85. OSErr            Drag_initialize                ( void ) ;
  86. Boolean            DragIsInRect                ( DragReference drag, WindowRef window, Rect *rect ) ;
  87. Boolean            DragIsInSourceWindow        ( DragReference drag ) ;
  88. Boolean            DropLocationIsFinderTrash    ( DragReference drag ) ;
  89.  
  90. DragZonesHdl    NewDragZones                ( WindowRef window ) ;
  91. void            DisposeDragZonesHandle        ( DragZonesHdl zones ) ;
  92. OSErr            AddDragZone                    ( DragZonesHdl zones, DragZonePtr zone ) ;
  93. OSErr            DelDragZone                    ( DragZonesHdl zones, DragZoneHdl zone ) ;
  94. short            FindDragZones                ( DragZonesHdl zones, FlavorType flavor, OSType HFSfileType,
  95.                                                 short index, short count, DragZoneHdl *result ) ;
  96.                                                 
  97. Boolean            DragZoneItemsAcceptable        ( DragReference drag, DragZonesHdl zones ) ;
  98. long            DragZoneIsInWhichRect        ( DragReference drag, WindowRef theWindow, DragZonesHdl zones ) ;
  99.  
  100. OSErr            RegisterDragAppleEvents        ( void ) ;
  101. pascal OSErr    HandleDragRecv                ( AppleEvent *theAppleEvent, AppleEvent *reply, long refCon ) ;
  102. OSErr            SendDragRecv                ( DragZoneHdl theZone, WindowRef theWindow, Point theLocation,
  103.                                                  Handle dataHdl, DragZoneRecvUPP theDragZoneRecvUPP ) ;
  104.  
  105. OSErr            OutlineRegion                ( RgnHandle theRgn ) ;
  106.  
  107.  
  108. #endif