home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / PowerPlant / CDragAndDrop / CDragTask.h < prev   
Encoding:
Text File  |  1995-02-09  |  2.1 KB  |  52 lines  |  [TEXT/CWIE]

  1. // =================================================================================
  2. //    CDragTask.h                ©1995 J. Rodden, DD/MF & Associates. All rights reserved
  3. // =================================================================================
  4. // You do not need to inherit this class.
  5. //
  6. // LDragTask gives us general drag functionality and behaviour.  CDragTask exists so
  7. // that we can add behaviour specific to dragging our items without having to inherit
  8. // from LDragTask anymore.
  9. //
  10. // CDragTask actually acts as a stub object, it passes the work onto the object being
  11. // dragged so that all drag manager code can be isolated in the object being dragged
  12. // or its owner and you don't ever have to deal with an LDragTask again.
  13. //
  14. // By using CDragTask and overriding AddFlavors and MakeDragRegion in the object 
  15. // being dragged, you can (a) include as many flavors of an item as you want, (b) 
  16. // define your own outline to replace the generic rectangle that LDragTask provides,
  17. // (c) arrange to send drag data on demand by calling InstallDragSendData when
  18. // adding flavors (and installing null data in the drag) and overriding DoSendDragData
  19. // for the object being dragged, and (d) override the drag manager's default behaviors
  20. // for DragInput and DragDrawing by calling InstallDragInput or InstallDragDrawing
  21. // and overriding DoDragInput or DoDragDrawing respectively.
  22. // =================================================================================
  23.  
  24. #pragma once
  25.  
  26. #include <LDragTask.h>
  27.  
  28. class CDragItem;
  29.  
  30. class CDragTask : public LDragTask {
  31. public:
  32.                     CDragTask(const EventRecord &inEventRecord,
  33.                                 CDragItem*            inDragItem = nil);
  34.                                 
  35.                     CDragTask(const EventRecord&    inEventRecord,
  36.                                 const Rect*            inItemRect,
  37.                                 ItemReference        inItemRef,
  38.                                 CDragItem*            inDragItem = nil);
  39.                                 
  40. protected:
  41.     virtual void    AddFlavors (DragReference inDragRef);
  42.     virtual void    MakeDragRegion (DragReference inDragRef, RgnHandle inDragRegion);
  43.     
  44.     virtual void    InstallDragSendData();
  45.     virtual    void    InstallDragInput();
  46.     virtual    void    InstallDragDrawing();
  47.  
  48. private:
  49.     CDragItem*        dragItem;
  50.     
  51. };
  52.