home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / uicldd.zip / IDMOPER.HPP < prev    next >
Text File  |  1993-09-03  |  9KB  |  216 lines

  1. #ifndef _IDMOPER_
  2. #define _IDMOPER_
  3. /*******************************************************************************
  4. * FILE NAME: idmoper.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IDMOperation          - General purpose "direct manipulation operation"  *
  9. *                             class.                                           *
  10. *                                                                              *
  11. * COPYRIGHT:                                                                   *
  12. *   Licensed Materials - Property of IBM                                       *
  13. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  14. *   All Rights Reserved                                                        *
  15. *   US Government Users Restricted Rights - Use, duplication, or               *
  16. *   disclosure                                                                 *
  17. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  18. *                                                                              *
  19. * $Log:   S:/ibmclass/idrag/vcs/idmoper.hpv  $
  20. //
  21. //   Rev 1.13   03 Sep 1993 11:19:22   HAGGAR
  22. //Added drag image support and made assorted fixes
  23. //
  24. //   Rev 1.12   17 Aug 1993 15:25:06   banzai
  25. //Move ISet stuff to .CPP
  26. //
  27. //   Rev 1.11   16 Aug 1993 20:20:34   banzai
  28. //Make IDMCOMM stuff into IDM struct
  29. //
  30. //   Rev 1.10   14 Aug 1993 08:47:30   banzai
  31. //Hide PM Drag info stuff & make setOperation public
  32. //
  33. //   Rev 1.9   13 Aug 1993 14:16:02   banzai
  34. //Move setOperation to public & move PM specific stuff to private
  35. //
  36. //   Rev 1.8   12 Aug 1993 22:09:28   banzai
  37. //Remove IDMOperationHandle class
  38. //
  39. //   Rev 1.7   12 Aug 1993 13:53:02   banzai
  40. //Merge source and target item into one
  41. //
  42. //   Rev 1.6   09 Aug 1993 12:45:04   HAGGAR
  43. //rendering
  44. //
  45. //   Rev 1.5   06 Aug 1993 16:41:46   banzai
  46. //No changes
  47. //
  48. //   Rev 1.4   02 Aug 1993 15:27:56   HAGGAR
  49. //No change.
  50. //
  51. //   Rev 1.3   12 Jul 1993 15:57:10   banzai
  52. //No change.
  53. //
  54. //   Rev 1.2   28 Jun 1993 11:47:24   banzai
  55. //Fix traps in handle logic
  56. //
  57. //   Rev 1.1   30 Apr 1993 11:45:36   HAGGAR
  58. //
  59. //   Rev 1.0   22 Apr 1993 10:41:10   HAGGAR
  60. //Initial revision.
  61. *******************************************************************************/
  62. #ifndef _IREFCNT_
  63.   #include <irefcnt.hpp>
  64. #endif
  65.  
  66. #ifndef _IPOINT_
  67.   #include <ipoint.hpp>
  68. #endif
  69.  
  70. #ifndef _IHANDLE_
  71.   #include <ihandle.hpp>
  72. #endif
  73.  
  74. #ifndef _IDMCOMM_
  75.   #include <idmcomm.hpp>
  76. #endif
  77.  
  78. typedef IDM::Source Source;
  79.  
  80. /* Forward Declarations */
  81. struct _DRAGINFO;
  82.  
  83.  
  84. class IDMOperation : public IRefCounted {
  85. typedef IRefCounted
  86.   Inherited;
  87. /*******************************************************************************
  88. * This is the common base class for the direct manipulation source and target  *
  89. * drag operation classes.  Objects of this class provide general-purpose       *
  90. * information about direct manipulation operations.                            *
  91. *                                                                              *
  92. * Access to this information is gained via its derived classes.                *
  93. *                                                                              *
  94. * Objects of this class possess the following attributes:                      *
  95. *   o Information about the direct manipulation operation as a whole:          *
  96. *       - operation "type" (i.e., copy, move, or link),                        *
  97. *       - position (i.e., of the pointing device) within the source or         *
  98. *         target window,                                                       *
  99. *       - source of the operation (pointing device versus keyboard),           *
  100. *       - generic drag item handle.                                            *
  101. *                                                                              *
  102. * Instances of this class are not intended to be created by application        *
  103. * programmers.  Generally, they are created only by their subclasses           *
  104. * requiring this information.                                                  *
  105. *******************************************************************************/
  106. public:
  107. /*-------------------------------- Accessors -----------------------------------
  108. | These functions provide access to attributes of instances of this class:     |
  109. |   position     - Returns the drag or drop position within the source/target  |
  110. |                  window.                                                     |
  111. |   source       - Returns the source of the direct manipulation operation     |
  112. |                  (always "unknown" on the target side).                      |
  113. |   sourceWindow - Returns the handle of the source window for the direct      |
  114. |                  manipulation operation.                                     |
  115. ------------------------------------------------------------------------------*/
  116. IPoint
  117.   position        ( ) const;
  118.  
  119. Source
  120.   source          ( ) const;
  121.  
  122. IWindowHandle
  123.   sourceWindow    ( ) const;
  124.  
  125. /*-------------------------------- Operations ----------------------------------
  126. | These functions deal with the "default operation" attribute of instances     |
  127. | of this class:                                                               |
  128. |   operation     - Returns the default direct manipulation operation.         |
  129. |   setOperation  - Set the default direct manipulation operation.             |
  130. |                                                                              |
  131. | These static members provide the set of pre-defined operation codes:         |
  132. |   drag    - Default drag (no augmentation keys are pressed).                 |
  133. |   copy    - Copy (the copy augmentation key is pressed).                     |
  134. |   link    - Link (the link augmentation key(s) is(are) pressed).             |
  135. |   move    - Move (the move augmentation key is pressed).                     |
  136. |   unknown - Unknown (application-defined operation codes should              |
  137. |             be assigned values greater than this).                           |
  138. ------------------------------------------------------------------------------*/
  139. virtual unsigned short
  140.   operation        ( ) const;
  141.  
  142. virtual IDMOperation
  143.   &setOperation    ( unsigned short Operation );
  144.  
  145. static const unsigned short
  146.   drag,
  147.   copy,
  148.   link,
  149.   move,
  150.   unknown;
  151.  
  152. /*------------------------------ Implementation --------------------------------
  153. | These functions provide various utility services used to implement this      |
  154. | class:                                                                       |
  155. |   cleanup - Releases resources at the conclusion of a direct manipulation    |
  156. |             operation.                                                       |
  157. ------------------------------------------------------------------------------*/
  158. IDMOperation
  159.  &cleanup    ( );
  160.  
  161. protected:
  162. /*------------------------- Constructors/Destructor ----------------------------
  163. | Objects of this class are constructed in the following manner:               |
  164. |   o by providing the source of the direct manipulation operation, the        |
  165. |     position of the pointing device, and the default operation.              |
  166. ------------------------------------------------------------------------------*/
  167.   IDMOperation     ( Source               source,
  168.                      const IPoint         &position,
  169.                      const unsigned short defaultOperation = drag );
  170.  
  171. virtual
  172.   ~IDMOperation    ( );
  173.  
  174. /*------------------------------ Implementation --------------------------------
  175. | These functions provide various utility services used to implement this      |
  176. | class:                                                                       |
  177. |   setSrcWindow  - Set the source window of the direct manipulation operation.|
  178. |   setSrc        - Set the source of the direct manipulation operation.       |
  179. |   setPosition   - Set the pointing device position for the direct            |
  180. |                   manipulation operation.                                    |
  181. |   setImages     - Sets the pointer to the collection of IDMDragImages.       |
  182. |   setDragInfo   - Sets the handle to our drag information.                   |
  183. ------------------------------------------------------------------------------*/
  184. IDMOperation
  185.  &setSrcWindow    ( IWindowHandle sourceWindow ),
  186.  &setSrc          ( Source        source ),
  187.  &setPosition     ( IPoint        position ),
  188.  &setDragInfo     ( _DRAGINFO     *pDragInfo );
  189.  
  190. private: /*------------------------ PRIVATE ----------------------------------*/
  191.  
  192. unsigned short
  193.   op;
  194.  
  195. IWindowHandle
  196.   srcWindow;
  197.  
  198. Source
  199.   src;
  200.  
  201. IPoint
  202.   pos;
  203.  
  204. _DRAGINFO
  205.  *pPMDragInfo;
  206.  
  207. _DRAGINFO
  208.  *PMDragInfo ();
  209. }; // class IDMOperation
  210.  
  211. #ifndef I_NO_INLINES
  212.   #include <idmoper.inl>
  213. #endif
  214.  
  215. #endif //_IDMOPER_
  216.