home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cluidm.zip / idmtgtop.hpp < prev    next >
Text File  |  1993-05-06  |  10KB  |  191 lines

  1. #ifndef _IDMTGTOP_
  2. #define _IDMTGTOP_
  3. /*******************************************************************************
  4. * FILE NAME: idmtgtop.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IDMTargetOperation    - Direct manipulation "Target" operation class.    *
  9. *     IDMTgtOperationHandle - "Handle" for IDMTgtOperation object to maintain  *
  10. *                             references to it.                                *
  11. *                                                                              *
  12. * COPYRIGHT:                                                                   *
  13. *   Licensed Materials - Property of IBM                                       *
  14. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  15. *   All Rights Reserved                                                        *
  16. *   US Government Users Restricted Rights - Use, duplication, or               *
  17. *   disclosure                                                                 *
  18. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  19. *                                                                              *
  20. * $Log:   M:/ibmclass/idrag/vcs/idmtgtop.hpv  $
  21. //
  22. //   Rev 1.3   03 May 1993 16:14:02   unknown
  23. //Remove dead function
  24. //
  25. //   Rev 1.2   03 May 1993 16:06:08   unknown
  26. //Latest changes per IC_UM_DRAGOVER
  27. //
  28. //   Rev 1.1   30 Apr 1993 11:45:48   HAGGAR
  29. //
  30. //   Rev 1.0   22 Apr 1993 10:41:18   HAGGAR
  31. //Initial revision.
  32. *******************************************************************************/
  33. #ifndef _IHANDLE_
  34.   #include <ihandle.hpp>
  35. #endif
  36.  
  37. #ifndef _IREFCNT_
  38.   #include <irefcnt.hpp>
  39. #endif
  40.  
  41. /* Forward Declarations */
  42. class _DRAGINFO;
  43. class IDMTgtItemHandle;
  44. class IDMTargetItem;
  45. class IDMTgtOperationHandle;
  46.  
  47. class IDMTargetOperation : public IDMOperation {
  48. typedef IDMOperation
  49.   Inherited;
  50. /*******************************************************************************
  51. * This is the direct manipulation target drag operation class.  Objects of     *
  52. * this class provide information about target direct manipulation operations.  *
  53. *                                                                              *
  54. * Access to this information is usually gained in one of the following ways:   *
  55. *   o Via an associated IDMTargetItem object's dragOperation() function.       *
  56. *   o Via an associated direct manipulation event's dragOperation() function.  *
  57. *                                                                              *
  58. * Objects of this class possess the following attributes:                      *
  59. *   o Information about the target direct manipulation operation as a whole:   *
  60. *       - number of associated drag items (ie. IDMTargetItems).                *
  61. *       - pointer to the collection of IDMTargetItems.                         *
  62. *   o A collection of IDMTargetItem objects, one for each item being "dragged" *
  63. *     on this operation.                                                       *
  64. *                                                                              *
  65. * Instances of this class are not intended to be created by application        *
  66. * programmers.  Generally, they are created only by the direct manipulation    *
  67. * event classes requiring this information.  Typically, access is via an       *
  68. * IDMTgtOperationHandle object (see below).                                    *
  69. *******************************************************************************/
  70. public:
  71. typedef ISet<IDMTgtItemHandle> IDMTargetItemSet;
  72.  
  73. /*------------------------- Constructors/Destructor ----------------------------
  74. | Objects of this class are constructed in the following manner:               |
  75. |   o by providing a pointer to a _DRAGINFO structure.                         |
  76. ------------------------------------------------------------------------------*/
  77.   IDMTargetOperation ( _DRAGINFO *pDragInfo );
  78.  
  79.   ~IDMTargetOperation ( );
  80.  
  81. /*-------------------------------- Drag Items ----------------------------------
  82. | The following functions provide means of accessing the IDMTargetItem objects |
  83. | involved in the direct manipulation operation described by instances of      |
  84. | this class:                                                                  |
  85. |   numberOfItems - Returns the number of target drag items.                   |
  86. |   item          - Returns the drag item with given index.                    |
  87. |   addItem       - Associates another drag item with this operation.          |
  88. ------------------------------------------------------------------------------*/
  89. unsigned
  90.   numberOfItems ( );
  91.  
  92. IDMTgtItemHandle
  93.   item ( unsigned index );
  94.  
  95. IDMTargetOperation
  96.   &addItem     ( const IDMTgtItemHandle newItem );
  97.  
  98. /*------------------------------ Implementation --------------------------------
  99. | These functions provide various utility services used to implement this      |
  100. | class:                                                                       |
  101. |   instanceFor         - Returns IDMTargetOperation object for a given        |
  102. |                         _DRAGINFO structure.                                 |
  103. |   targetOperation     - Returns IDMTargetOperation object handle that was    |
  104. |                         created during the target enter event.               |
  105. |   setTargetOperation  - Set IDMTargetOperation object handle during the      |
  106. |                         target enter event.                                  |
  107. ------------------------------------------------------------------------------*/
  108. static IDMTgtOperationHandle
  109.   instanceFor           ( _DRAGINFO *pDragInfo );
  110.  
  111. static IDMTgtOperationHandle
  112.   targetOperation       ( );
  113.  
  114. static void //IDMTargetOperation
  115.  setTargetOperation    ( IDMTgtOperationHandle targetOp );
  116.  
  117. /*------------------------------ Implementation --------------------------------
  118. | These functions provide various utility services used to implement this      |
  119. | class:                                                                       |
  120. |   itemsSetCl    - Returns a pointer to the collection of IDMTargetItems.     |
  121. |   setItems      - Sets the pointer to the collection of IDMTargetItems.      |
  122. |   itemsRC       - Returns a pointer to the items return code (RC) array.     |
  123. |   setItemsRC    - Sets the pointer to the items return code (RC) array.      |
  124. |                                                                              |
  125. |   MAB - temporarily move to public                                           |
  126. ------------------------------------------------------------------------------*/
  127. IDMTargetItemSet
  128.  *itemsSetCl    ( );
  129.  
  130. IDMTargetOperation
  131.  &setItems      ( IDMTargetItemSet *pIDMTargetItemSet );
  132.  
  133. unsigned int
  134.  *itemsRC       ( ) const;
  135.  
  136. IDMTargetOperation
  137.  &setItemsRC    ( unsigned int *returnCodes );
  138.  
  139. protected:
  140. private: /*------------------------ PRIVATE ----------------------------------*/
  141.  
  142. IDMTargetItemSet
  143.   *pDMTgtItemSetCl;
  144.  
  145. static IDMTgtOperationHandle
  146.   pDMTgtOpHandle;
  147.  
  148. }; //class IDMTargetOperation
  149.  
  150. class IDMTgtOperationHandle : public IReference< IDMTargetOperation > {
  151. /*******************************************************************************
  152. * Objects of this class provide access to IDMTargetOperation objects           *
  153. * associated with a direct manipulation event.  This "handle" class manages    *
  154. * references to the IDMTargetOperation object to ensure that it is not deleted *
  155. * until the drag operation is completed.                                       *
  156. *                                                                              *
  157. * This class provides a "->" operator that enables instances to be treated     *
  158. * just like a pointer to an IDMTargetOperation object.                         *
  159. *                                                                              *
  160. * Example:                                                                     *
  161. *   // Event providing access to the drag information...                       *
  162. *   IBeginDragEvent                                                            *
  163. *    &event;                                                                   *
  164. *                                                                              *
  165. *   // Get drag information handle from event...                               *
  166. *   IDMTgtOperationHandle                                                      *
  167. *     tgtinfo = event.dragOperation();                                         *
  168. *                                                                              *
  169. *   // Process items (using info as a "pointer to IDMTargetOperation")...      *
  170. *   for( int i = 0; i < tgtinfo->numberOfItems(); i++ )                        *
  171. *     {                                                                        *
  172. *     // Process drag items.                                                   *
  173. *     }                                                                        *
  174. *                                                                              *
  175. * This class has no members.  It is essentially a synonym for the type         *
  176. * IReference< IDMTargetOperation >.                                            *
  177. *******************************************************************************/
  178. public:
  179. /*------------------------- Constructors/Destructor ----------------------------
  180. | Objects of this class are constructed in the following manner:               |
  181. |   o by providing a pointer to this handle class.                             |
  182. ------------------------------------------------------------------------------*/
  183.   IDMTgtOperationHandle (IDMTargetOperation *pIDMTargetOp) :
  184.     IReference< IDMTargetOperation > (pIDMTargetOp) { }
  185.  
  186.   ~IDMTgtOperationHandle ( ) { }
  187.  
  188. }; //IDMTgtOperationHandle
  189.  
  190. #endif //_IDMTGTOP_
  191.