home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IDMOPER.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  12KB  |  254 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          - Direct manipulation operation common base class, *
  9.                               or abstract 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. *******************************************************************************/
  20. #ifndef _IREFCNT_
  21.   #include <irefcnt.hpp>
  22. #endif
  23.  
  24. #ifndef _IPOINT_
  25.   #include <ipoint.hpp>
  26. #endif
  27.  
  28. #ifndef _IHANDLE_
  29.   #include <ihandle.hpp>
  30. #endif
  31.  
  32. #ifndef _IDMITEM_
  33.   #include <idmitem.hpp>
  34. #endif
  35.  
  36. #ifndef _IDMCOMM_
  37.   #include <idmcomm.hpp>
  38. #endif
  39.  
  40. /*----------------------------------------------------------------------------*/
  41. /* Align classes on four byte boundary.                                       */
  42. /*----------------------------------------------------------------------------*/
  43. #pragma pack(4)
  44.  
  45. /* Forward Declarations */
  46. struct _DRAGINFO;
  47. class  IContainerObject;
  48. class  IDMSourceBeginEvent;
  49. class  IDMTargetEnterEvent;
  50. class  IDMItemSeq;
  51.  
  52.  
  53. class IDMOperation : public IRefCounted {
  54. typedef IRefCounted
  55.   Inherited;
  56. typedef IDM::Source
  57.   Source;
  58. /*******************************************************************************
  59. * This is the common base class, or abstract class, for the direct manipulation*
  60. * source and target drag operation classes.  Objects of this class provide     *
  61. * general-purpose information about direct manipulation operations.   Access   *
  62. * to this information is gained through its derived classes.                   *
  63. *                                                                              *
  64. * Objects of this class possess information about the direct manipulation      *
  65. * operation as a whole:                                                        *
  66. *       - Operation type (for example, copy, move, or link)                    *
  67. *       - Position of the pointing device within the source or target window   *
  68. *       - Source of the operation (pointing device versus keyboard)            *
  69. *       - Generic drag item handle                                             *
  70. *       - Number of associated drag items, IDMItems                            *
  71. *       - Pointer to the collection of IDMItems                                *
  72. *       - A collection of IDMItem objects, one for each item being dragged     *
  73. *         during this operation.                                               *
  74. *                                                                              *
  75. * Instances of this class are not intended to be created by application        *
  76. * programmers.  Generally, instances are created only by their subclasses that *
  77. * require this information.                                                    *
  78. *******************************************************************************/
  79. public:
  80. /*-------------------------------- Operations ----------------------------------
  81. | The following functions deal with the default operation attribute in         |
  82. | instances of this class:                                                     |
  83. |   operation     - Returns the default direct manipulation operation.         |
  84. |   setOperation  - Sets the default direct manipulation operation.            |
  85. |                                                                              |
  86. | The following static members provide the set of pre-defined operation codes: |
  87. |   drag    - Default drag (no augmentation keys are pressed).                 |
  88. |   copy    - Copy (the copy augmentation key is pressed).                     |
  89. |   link    - Link (the link augmentation key(s) is(are) pressed).             |
  90. |   move    - Move (the move augmentation key is pressed).                     |
  91. |   unknown - Unknown (application-defined operation codes should              |
  92. |             be assigned values greater than this).                           |
  93. ------------------------------------------------------------------------------*/
  94. virtual unsigned long
  95.   operation        ( ) const;
  96.  
  97. virtual IDMOperation
  98.   &setOperation    ( unsigned long op );
  99.  
  100. static const unsigned long
  101.   drag,
  102.   copy,
  103.   link,
  104.   move,
  105.   unknown;
  106.  
  107. /*-------------------------------- Accessors -----------------------------------
  108. | These functions provide read/write access to attributes of instances of      |
  109. | this class:                                                                  |
  110. |   position              - Returns the drag or drop position within the       |
  111. |                           source or target window.                           |
  112. |   source                - Returns the source of the direct manipulation      |
  113. |                           operation (i.e. always pointing device)            |
  114. |   sourceWindowHandle    - Returns the handle of the source window for the    |
  115. |                           direct manipulation operation.                     |
  116. |   targetWindowHandle    - Returns the handle of the target window for the    |
  117. |                           direct manipulation operation.                     |
  118. |   sourceWindow          - Returns a pointer to the source window for the     |
  119. |                           direct manipulation operation.                     |
  120. |   targetWindow          - Returns a pointer to the target window for the     |
  121. |                           direct manipulation operation.                     |
  122. |   setSource             - Sets the source of the direct manipulation         |
  123. |                           operation.                                         |
  124. |   setPosition           - Sets the pointing device position for the direct   |
  125. |                           manipulation operation.                            |
  126. |   setSourceWindowHandle - Sets the source window handle of the direct        |
  127. |                           manipulation operation during a source begin event.|
  128. |   setTargetWindowHandle - Sets the target window handle of the direct        |
  129. |                           manipulation operation during a target enter event.|
  130. ------------------------------------------------------------------------------*/
  131. virtual IPoint
  132.   position                 ( ) const;
  133.  
  134. virtual Source
  135.   source                   ( ) const;
  136.  
  137. virtual IWindowHandle
  138.   sourceWindowHandle       ( ) const,
  139.   targetWindowHandle       ( ) const;
  140.  
  141. virtual IWindow
  142.  *sourceWindow             ( ) const,
  143.  *targetWindow             ( ) const;
  144.  
  145. virtual IDMOperation
  146.  &setSource                ( Source        source ),
  147.  &setPosition              ( IPoint        position ),
  148.  &setSourceWindowHandle    ( IWindowHandle window ),
  149.  &setTargetWindowHandle    ( IWindowHandle window );
  150.  
  151. /*-------------------------------- Drag Items ----------------------------------
  152. | The following functions provide a means of accessing the IDMItem objects     |
  153. | involved in the direct manipulation operation described by instances of      |
  154. | this class:                                                                  |
  155. |   numberOfItems  - Returns the number of drag items.                         |
  156. |   item           - Returns the drag item with a given position. 0 is         |
  157. |                    returned if the position is invalid.                      |
  158. |   replaceItem    - Replaces a given drag item with another.                  |
  159. |   addItem        - Associates another drag item with this operation.         |
  160. |   removeItem     - Removes a drag item from the operation, using either a    |
  161. |                    position or the drag item handle.                         |
  162. |                                                                              |
  163. | Note: Items are maintained positionally, which is 1-based.                   |
  164. ------------------------------------------------------------------------------*/
  165. unsigned
  166.   numberOfItems     ( );
  167.  
  168. IDMItem::Handle
  169.   item              ( unsigned              position );
  170.  
  171. IDMOperation
  172.  &replaceItem       ( unsigned              position,
  173.                       const IDMItem::Handle &replacement ),
  174.  &addItem           ( const IDMItem::Handle &newItem ),
  175.  &removeItem        ( unsigned              position ),
  176.  &removeItem        ( const IDMItem::Handle &itemToRemove );
  177.  
  178. /*------------------------------ Container Support -----------------------------
  179. | The following functions facilitates container support in the operation:      |
  180. |   containerObject    - Returns the pointer to a container object.            |
  181. |   setContainerObject - Sets a pointer to a container object.                 |
  182. ------------------------------------------------------------------------------*/
  183. IContainerObject
  184.  *containerObject       ( ) const;
  185.  
  186. IDMOperation
  187.  &setContainerObject    ( IContainerObject *object );
  188.  
  189.  
  190. protected:
  191. /*------------------------- Constructors/Destructor ----------------------------
  192. | Objects of this class are constructed by providing the following:            |
  193. |       - Reference to the source begin event                                  |
  194. |       - Reference to the target enter event                                  |
  195. ------------------------------------------------------------------------------*/
  196.   IDMOperation     ( IDMSourceBeginEvent &event );
  197.  
  198.   IDMOperation     ( IDMTargetEnterEvent &event );
  199.  
  200. virtual
  201.   ~IDMOperation    ( );
  202.  
  203. /*------------------------------ Implementation --------------------------------
  204. | The following functions provide various utility services used to implement   |
  205. | this class:                                                                  |
  206. |   dragInfo    - Returns the handle to the drag information.                  |
  207. |   setDragInfo - Sets the handle to the drag information.                     |
  208. ------------------------------------------------------------------------------*/
  209. _DRAGINFO
  210.  *dragInfo       ( ) const;
  211.  
  212. IDMOperation
  213.  &setDragInfo    ( _DRAGINFO     *dragInfo );
  214.  
  215. private: /*------------------------ PRIVATE ----------------------------------*/
  216.  
  217. unsigned long
  218.   op;
  219.  
  220. IWindowHandle
  221.   srcWindowHandle,
  222.   tgtWindowHandle;
  223.  
  224. Source
  225.   src;
  226.  
  227. IPoint
  228.   pos;
  229.  
  230. IContainerObject
  231.  *pCnrObj;
  232.  
  233. _DRAGINFO
  234.  *pPMDragInfo;
  235.  
  236. IDMItemSeq
  237.  *pDMItemSeqCl;
  238.  
  239. IDMItemSeq
  240.  *itemCollection ();
  241.  
  242. }; // class IDMOperation
  243.  
  244. /*----------------------------------------------------------------------------*/
  245. /* Resume compiler default packing.                                           */
  246. /*----------------------------------------------------------------------------*/
  247. #pragma pack()
  248.  
  249. #ifndef I_NO_INLINES
  250.   #include <idmoper.inl>
  251. #endif
  252.  
  253. #endif //_IDMOPER_
  254.