home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Libraries / WASTE 1.1a4 / Interfaces 2 / Drag.p < prev    next >
Encoding:
Text File  |  1994-05-15  |  9.3 KB  |  352 lines  |  [TEXT/PJMM]

  1. unit Drag;
  2.  
  3. { Pascal interface to the Macintosh Libraries: }
  4. { Drag Manager }
  5.  
  6. { Based on material copyrighted by Apple Computer, Inc. }
  7.  
  8. interface
  9.     uses
  10.         AppleEvents;
  11.  
  12.     const
  13.  
  14.         _DragDispatch = $ABED;
  15.  
  16. { Gestalt Constants }
  17.  
  18.         gestaltDragMgrAttr = 'drag';                { Drag Manager attributes }
  19.         gestaltDragMgrPresent = 0;                { Drag Manager is present }
  20.         gestaltDragMgrFloatingWind = 1;        { Floating window support (?) }
  21.         gestaltPPCDragLibPresent = 2;            { PowerPC shared library available (?) }
  22.         gestaltTEAttr = 'teat';                        { TextEdit attributes }
  23.         gestaltTEHasGetHiliteRgn = 0;            { TextEdit has TEGetHiliteRgn }
  24.  
  25. { Flavor Flags }
  26.  
  27.         flavorSenderOnly = $00000001;                { flavor available to sender only }
  28.         flavorSenderTranslated = $00000002;        { flavor translated by sender }
  29.         flavorNotSaved = $00000004;                    { flavor should not be saved }
  30.         flavorSystemTranslated = $00000100;        { flavor translated by system }
  31.  
  32. { Drag Attributes }
  33.  
  34.         dragHasLeftSenderWindow = $00000001;        { drag has left source window }
  35.         dragInsideSenderApplication = $00000002;        { drag is in the source app }
  36.         dragInsideSenderWindow = $00000004;            { drag is in the source window }
  37.  
  38. { Special Flavor Type }
  39.  
  40.         flavorTypeHFS = 'hfs ';                                { flavor type for HFS data }
  41.         flavorTypePromiseHFS = 'phfs';                { flavor type for promised HFS }
  42.         flavorTypeDirectory = 'diry';                        { flavor type for AOCE directory }
  43.  
  44. { Drag Tracking Handler Messages }
  45.  
  46.         dragTrackingEnterHandler = 1;                    { drag has entered handler }
  47.         dragTrackingEnterWindow = 2;                { drag has entered window }
  48.         dragTrackingInWindow = 3;                        { drag is moving within window }
  49.         dragTrackingLeaveWindow = 4;                { drag has exited window }
  50.         dragTrackingLeaveHandler = 5;                { drag has exited handler }
  51.  
  52. { Drag Drawing Handler Messages }
  53.  
  54.         dragRegionBegin = 1;            { initialize drawing }
  55.         dragRegionDraw = 2;                { draw drag feedback }
  56.         dragRegionHide = 3;                { hide drag feedback }
  57.         dragRegionIdle = 4;                { drag feedback idle time }
  58.         dragRegionEnd = 5;                { end of drawing }
  59.  
  60. { Zooming Constants }
  61.  
  62.         zoomNoAcceleration = 0;        { use linear interpolation }
  63.         zoomAccelerate = 1;                { ramp up step size }
  64.         zoomDecelerate = 2;                { ramp down step size }
  65.  
  66. { Drag Manager result codes }
  67.  
  68.         badDragRefErr = -1850;
  69.         badDragItemErr = -1851;
  70.         badDragFlavorErr = -1852;
  71.         duplicateFlavorErr = -1853;
  72.         cantGetFlavorErr = -1854;
  73.         duplicateHandlerErr = -1855;
  74.         handlerNotFoundErr = -1856;
  75.         dragNotAcceptedErr = -1857;
  76.  
  77.     type
  78.  
  79.         DragReference = LongInt;
  80.         ItemReference = LongInt;
  81.         FlavorType = ResType;
  82.         FlavorFlags = LongInt;
  83.         DragAttributes = LongInt;
  84.         DragTrackingMessage = Integer;
  85.         DragRegionMessage = Integer;
  86.         ZoomAcceleration = Integer;
  87.  
  88. { Special Flavor Data Types }
  89.  
  90.         HFSFlavor = record
  91.                 fileType: OSType;                        { file type }
  92.                 fileCreator: OSType;                    { file creator }
  93.                 fdFlags: Integer;                        { Finder flags }
  94.                 fileSpec: FSSpec;                        { file system specification }
  95.             end;
  96.  
  97.         PromiseHFSFlavor = record
  98.                 fileType: OSType;                        { file type }
  99.                 fileCreator: OSType;                    { file creator }
  100.                 fdFlags: Integer;                        { Finder flags }
  101.                 promisedFlavor: FlavorType;    { promised flavor containing FSSpec }
  102.             end;
  103.  
  104. { User Function Prototypes }
  105.  
  106.         DragTrackingHandler = ProcPtr;
  107.         DragReceiveHandler = ProcPtr;
  108.         DragSendDataProc = ProcPtr;
  109.         DragInputProc = ProcPtr;
  110.         DragDrawingProc = ProcPtr;
  111.  
  112. { Drag Manager Routines Installing and Removing Drag Handlers }
  113.  
  114.     function InstallTrackingHandler (trackingHandler: DragTrackingHandler;
  115.                                     theWindow: WindowPtr;
  116.                                     handlerRefCon: univ Ptr): OSErr;
  117.     inline
  118.         $7001, _DragDispatch;
  119.  
  120.     function InstallReceiveHandler (receiveHandler: DragReceiveHandler;
  121.                                     theWindow: WindowPtr;
  122.                                     handlerRefCon: univ Ptr): OSErr;
  123.     inline
  124.         $7002, _DragDispatch;
  125.  
  126.     function RemoveTrackingHandler (trackingHandler: DragTrackingHandler;
  127.                                     theWindow: WindowPtr): OSErr;
  128.     inline
  129.         $7003, _DragDispatch;
  130.  
  131.     function RemoveReceiveHandler (receiveHandler: DragReceiveHandler;
  132.                                     theWindow: WindowPtr): OSErr;
  133.     inline
  134.         $7004, _DragDispatch;
  135.  
  136. { Creating and Disposing of Drag References }
  137.  
  138.     function NewDrag (var theDragRef: DragReference): OSErr;
  139.     inline
  140.         $7005, _DragDispatch;
  141.  
  142.     function DisposeDrag (theDragRef: DragReference): OSErr;
  143.     inline
  144.         $7006, _DragDispatch;
  145.  
  146. { Adding Drag Item Flavors }
  147.  
  148.     function AddDragItemFlavor (theDragRef: DragReference;
  149.                                     theItemRef: ItemReference;
  150.                                     theType: FlavorType;
  151.                                     dataPtr: univ Ptr;
  152.                                     dataSize: Size;
  153.                                     theFlags: FlavorFlags): OSErr;
  154.     inline
  155.         $7007, _DragDispatch;
  156.  
  157.     function SetDragItemFlavorData (theDragRef: DragReference;
  158.                                     theItemRef: ItemReference;
  159.                                     theType: FlavorType;
  160.                                     dataPtr: univ Ptr;
  161.                                     dataSize: Size;
  162.                                     dataOffset: LongInt): OSErr;
  163.     inline
  164.         $7009, _DragDispatch;
  165.  
  166. { Providing Drag Callback Procedures }
  167.  
  168.     function SetDragSendProc (theDragRef: DragReference;
  169.                                     sendProc: DragSendDataProc;
  170.                                     dragSendRefCon: univ Ptr): OSErr;
  171.     inline
  172.         $700A, _DragDispatch;
  173.  
  174.     function SetDragInputProc (theDragRef: DragReference;
  175.                                     inputProc: DragInputProc;
  176.                                     dragInputRefCon: univ Ptr): OSErr;
  177.     inline
  178.         $700B, _DragDispatch;
  179.  
  180.     function SetDragDrawingProc (theDragRef: DragReference;
  181.                                     drawingProc: DragDrawingProc;
  182.                                     dragDrawingRefCon: univ Ptr): OSErr;
  183.     inline
  184.         $700C, _DragDispatch;
  185.  
  186. { Performing a Drag }
  187.  
  188.     function TrackDrag (theDragRef: DragReference;
  189.                                     theEvent: EventRecord;
  190.                                     theRegion: RgnHandle): OSErr;
  191.     inline
  192.         $700D, _DragDispatch;
  193.  
  194. { Getting Drag Item Information }
  195.  
  196.     function CountDragItems (theDragRef: DragReference;
  197.                                     var numItems: Integer): OSErr;
  198.     inline
  199.         $700E, _DragDispatch;
  200.  
  201.     function GetDragItemReferenceNumber (theDragRef: DragReference;
  202.                                     index: Integer;
  203.                                     var theItemRef: ItemReference): OSErr;
  204.     inline
  205.         $700F, _DragDispatch;
  206.  
  207.     function CountDragItemFlavors (theDragRef: DragReference;
  208.                                     theItemRef: ItemReference;
  209.                                     var numFlavors: Integer): OSErr;
  210.     inline
  211.         $7010, _DragDispatch;
  212.  
  213.     function GetFlavorType (theDragRef: DragReference;
  214.                                     theItemRef: ItemReference;
  215.                                     index: Integer;
  216.                                     var theType: FlavorType): OSErr;
  217.     inline
  218.         $7011, _DragDispatch;
  219.  
  220.     function GetFlavorFlags (theDragRef: DragReference;
  221.                                     theItemRef: ItemReference;
  222.                                     theType: FlavorType;
  223.                                     var theFlags: FlavorFlags): OSErr;
  224.     inline
  225.         $7012, _DragDispatch;
  226.  
  227.     function GetFlavorDataSize (theDragRef: DragReference;
  228.                                     theItemRef: ItemReference;
  229.                                     theType: FlavorType;
  230.                                     var dataSize: Size): OSErr;
  231.     inline
  232.         $7013, _DragDispatch;
  233.  
  234.     function GetFlavorData (theDragRef: DragReference;
  235.                                     theItemRef: ItemReference;
  236.                                     theType: FlavorType;
  237.                                     dataPtr: univ Ptr;
  238.                                     var dataSize: Size;
  239.                                     dataOffset: LongInt): OSErr;
  240.     inline
  241.         $7014, _DragDispatch;
  242.  
  243.     function GetDragItemBounds (theDragRef: DragReference;
  244.                                     theItemRef: ItemReference;
  245.                                     var itemBounds: Rect): OSErr;
  246.     inline
  247.         $7015, _DragDispatch;
  248.  
  249.     function SetDragItemBounds (theDragRef: DragReference;
  250.                                     theItemRef: ItemReference;
  251.                                     itemBounds: Rect): OSErr;
  252.     inline
  253.         $7016, _DragDispatch;
  254.  
  255. { Getting and Setting Drag Status Information }
  256.  
  257.     function GetDragAttributes (theDragRef: DragReference;
  258.                                     var attributes: DragAttributes): OSErr;
  259.     inline
  260.         $7019, _DragDispatch;
  261.  
  262.     function GetDragMouse (theDragRef: DragReference;
  263.                                     var mouse: Point;
  264.                                     var pinnedMouse: Point): OSErr;
  265.     inline
  266.         $701A, _DragDispatch;
  267.  
  268.     function SetDragMouse (theDragRef: DragReference;
  269.                                     pinnedMouse: Point): OSErr;
  270.     inline
  271.         $701B, _DragDispatch;
  272.  
  273.     function GetDragOrigin (theDragRef: DragReference;
  274.                                     var initialMouse: Point): OSErr;
  275.     inline
  276.         $701C, _DragDispatch;
  277.  
  278.     function GetDragModifiers (theDragRef: DragReference;
  279.                                     var modifiers: Integer;
  280.                                     var mouseDownModifiers: Integer;
  281.                                     var mouseUpModifiers: Integer): OSErr;
  282.     inline
  283.         $701D, _DragDispatch;
  284.  
  285.     function GetDropLocation (theDragRef: DragReference;
  286.                                     var dropLocation: AEDesc): OSErr;
  287.     inline
  288.         $7017, _DragDispatch;
  289.  
  290.     function SetDropLocation (theDragRef: DragReference;
  291.                                     dropLocation: AEDesc): OSErr;
  292.     inline
  293.         $7018, _DragDispatch;
  294.  
  295. { Window Highlighting Utilities }
  296.  
  297.     function ShowDragHilite (theDragRef: DragReference;
  298.                                     hiliteFrame: RgnHandle;
  299.                                     inside: Boolean): OSErr;
  300.     inline
  301.         $701E, _DragDispatch;
  302.  
  303.     function HideDragHilite (theDragRef: DragReference): OSErr;
  304.     inline
  305.         $701F, _DragDispatch;
  306.  
  307.     function DragPreScroll (theDragRef: DragReference;
  308.                                     dH: Integer;
  309.                                     dV: Integer): OSErr;
  310.     inline
  311.         $7020, _DragDispatch;
  312.  
  313.     function DragPostScroll (theDragRef: DragReference): OSErr;
  314.     inline
  315.         $7021, _DragDispatch;
  316.  
  317.     function UpdateDragHilite (theDragRef: DragReference;
  318.                                     updateRgn: RgnHandle): OSErr;
  319.     inline
  320.         $7022, _DragDispatch;
  321.  
  322.  
  323. { Drag Manager Utilities }
  324.  
  325.     function WaitMouseMoved (initialMouse: Point): Boolean;
  326.     inline
  327.         $7023, _DragDispatch;
  328.  
  329.     function ZoomRects (fromRect: Rect;
  330.                                     toRect: Rect;
  331.                                     zoomSteps: Integer;
  332.                                     acceleration: ZoomAcceleration): OSErr;
  333.     inline
  334.         $7024, _DragDispatch;
  335.  
  336.     function ZoomRegion (region: RgnHandle;
  337.                                     zoomDistance: Point;
  338.                                     zoomSteps: Integer;
  339.                                     acceleration: ZoomAcceleration): OSErr;
  340.     inline
  341.         $7025, _DragDispatch;
  342.  
  343. { TextEdit Utilities }
  344.  
  345.     function TEGetHiliteRgn (region: RgnHandle;
  346.                                     hTE: TEHandle): OSErr;
  347.     inline
  348.         $3F3C, $000F, $A83D;
  349.  
  350. implementation
  351. end.
  352.