home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / uicldd.zip / IDMTGTOP.HPP < prev    next >
Text File  |  1993-09-03  |  13KB  |  271 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:   S:/ibmclass/idrag/vcs/idmtgtop.hpv  $
  21. //
  22. //   Rev 1.24   03 Sep 1993 11:19:48   HAGGAR
  23. //Added drag image support and made assorted fixes
  24. //
  25. //   Rev 1.23   01 Sep 1993 11:59:00   banzai
  26. //Remove test functions
  27. //
  28. //   Rev 1.22   01 Sep 1993 10:37:28   banzai
  29. //Massage per container integration
  30. //
  31. //   Rev 1.21   17 Aug 1993 15:25:12   banzai
  32. //Move ISet stuff to .CPP
  33. //
  34. //   Rev 1.20   14 Aug 1993 08:50:38   banzai
  35. //Prose cleanup
  36. //
  37. //   Rev 1.19   12 Aug 1993 22:11:04   banzai
  38. //Can't remember - its late
  39. //
  40. //   Rev 1.18   12 Aug 1993 15:36:58   banzai
  41. //Cleanup compiler warnings
  42. //
  43. //   Rev 1.17   12 Aug 1993 13:53:34   banzai
  44. //Merge source and target item into one
  45. //
  46. //   Rev 1.16   02 Aug 1993 15:28:04   HAGGAR
  47. //more rendering changes
  48. //
  49. //   Rev 1.15   15 Jul 1993 14:02:46   HAGGAR
  50. //rendering changes
  51. //
  52. //   Rev 1.14   13 Jul 1993 15:57:50   banzai
  53. //Add assignment operator for handles
  54. //
  55. //   Rev 1.13   12 Jul 1993 18:57:14   banzai
  56. //Drag provider changes
  57. //
  58. //   Rev 1.12   12 Jul 1993 15:57:18   banzai
  59. //No change.
  60. //
  61. //   Rev 1.11   12 Jul 1993 11:31:50   banzai
  62. //Rendering changes
  63. //
  64. //   Rev 1.10   01 Jul 1993 12:23:18   HAGGAR
  65. //rendering changes
  66. //
  67. //   Rev 1.9   28 Jun 1993 11:47:50   banzai
  68. //Fix traps in handle logic
  69. //
  70. //   Rev 1.8   21 Jun 1993 10:57:14   banzai
  71. //Enable setItemsRC
  72. //
  73. //   Rev 1.7   18 Jun 1993 14:15:06   banzai
  74. //Fix handle bugs
  75. //
  76. //   Rev 1.6   04 Jun 1993 16:35:16   HAGGAR
  77. //drag changes
  78. //
  79. //   Rev 1.5   13 May 1993 13:57:50   HAGGAR
  80. //No change.
  81. //
  82. //   Rev 1.4   13 May 1993 08:19:20   HAGGAR
  83. //
  84. //   Rev 1.3   03 May 1993 16:14:02   unknown
  85. //Remove dead function
  86. //
  87. //   Rev 1.2   03 May 1993 16:06:08   unknown
  88. //Latest changes per IC_UM_DRAGOVER
  89. //
  90. //   Rev 1.1   30 Apr 1993 11:45:48   HAGGAR
  91. //
  92. //   Rev 1.0   22 Apr 1993 10:41:18   HAGGAR
  93. //Initial revision.
  94. *******************************************************************************/
  95. #ifndef _IHANDLE_
  96.   #include <ihandle.hpp>
  97. #endif
  98.  
  99. #ifndef _IREFCNT_
  100.   #include <irefcnt.hpp>
  101. #endif
  102.  
  103. /* Forward Declarations */
  104. struct _DRAGINFO;
  105. class IEvent;
  106. class IDMItem;
  107. class IDMItemHandle;
  108. class IDMTgtOperationHandle;
  109. class IDMEvent;
  110. class IDMTargetItemSeq;
  111.  
  112.  
  113. class IDMTargetOperation : public IDMOperation {
  114. typedef IDMOperation
  115.   Inherited;
  116. /*******************************************************************************
  117. * This is the direct manipulation target drag operation class.  Objects of     *
  118. * this class provide information about target direct manipulation operations.  *
  119. *                                                                              *
  120. * Access to this information is usually gained in one of the following ways:   *
  121. *   o Via an associated IDMItem object's dragOperation() function.       *
  122. *   o Via an associated direct manipulation event's dragOperation() function.  *
  123. *                                                                              *
  124. * Objects of this class possess the following attributes:                      *
  125. *   o Information about the target direct manipulation operation as a whole:   *
  126. *       - number of associated drag items (ie. IDMItems).                *
  127. *       - pointer to the collection of IDMItems.                         *
  128. *   o A collection of IDMItem objects, one for each item being "dragged" *
  129. *     on this operation.                                                       *
  130. *                                                                              *
  131. * Instances of this class are not intended to be created by application        *
  132. * programmers.  Generally, they are created only by the direct manipulation    *
  133. * event classes requiring this information.  Typically, access is via an       *
  134. * IDMTgtOperationHandle object (see below).                                    *
  135. *******************************************************************************/
  136. public:
  137. /*------------------------- Constructors/Destructor ----------------------------
  138. | Objects of this class are constructed in the following manner:               |
  139. |   o by providing a reference to a generic IEvent.                            |
  140. ------------------------------------------------------------------------------*/
  141. //IDMTargetOperation     ( const IEvent &event );
  142.   IDMTargetOperation     ( _DRAGINFO *dragInformation );
  143.  
  144. virtual
  145.   ~IDMTargetOperation    ( );
  146.  
  147. /*-------------------------------- Drag Items ----------------------------------
  148. | The following functions provide means of accessing the IDMTargetItem objects |
  149. | involved in the direct manipulation operation described by instances of      |
  150. | this class:                                                                  |
  151. |   numberOfItems - Returns the number of target drag items.                   |
  152. |   item          - Returns the drag item with given index.                    |
  153. |   addItem       - Associates another drag item with this operation.          |
  154. ------------------------------------------------------------------------------*/
  155. unsigned
  156.   numberOfItems    ( );
  157.  
  158. IDMItemHandle
  159.   item             ( unsigned index );
  160.  
  161. IDMTargetOperation
  162.   &addItem         ( const IDMItemHandle &newItem );
  163.  
  164. /*------------------------------ Implementation --------------------------------
  165. | These functions provide various utility services used to implement this      |
  166. | class:                                                                       |
  167. |   instanceFor         - Returns IDMTargetOperation object                    |
  168. |   targetOperation     - Returns IDMTargetOperation object handle that was    |
  169. |                         created during the target enter event.               |
  170. |   setTargetOperation  - Set IDMTargetOperation object handle during the      |
  171. |                         target enter event.                                  |
  172. ------------------------------------------------------------------------------*/
  173. static IDMTgtOperationHandle
  174.   instanceFor           ( _DRAGINFO *dragInformation );
  175. //instanceFor           ( const IEvent &event );
  176.  
  177. static IDMTgtOperationHandle
  178.   targetOperation       ( );
  179.  
  180. static void
  181.   setTargetOperation    ( IDMTgtOperationHandle tgtOperation );
  182.  
  183. /*------------------------------ Implementation --------------------------------
  184. | The following utility functions are used to implement the behavior of        |
  185. | this class:                                                                  |
  186. |   itemCollection - Returns a pointer to the target collection of             |
  187. |                    IDMItemHandles.                                           |
  188. |   itemsRC        - Returns a pointer to the items return code (RC) array.    |
  189. |   setItemsRC     - Sets the pointer to the items return code (RC) array.     |
  190. ------------------------------------------------------------------------------*/
  191. IDMTargetItemSeq
  192.  *itemCollection    ( );
  193.  
  194. unsigned int
  195.  *itemsRC           ( ) const;
  196.  
  197. IDMTargetOperation
  198.  &setItemsRC        ( unsigned int *returnCodes );
  199.  
  200.  
  201. protected:
  202.  
  203. /*------------------------------ Implementation --------------------------------
  204. | The following utility function is used to implement the behavior of          |
  205. | this class:                                                                  |
  206. |   allocIDMTgtOper     - Creates an instance of the IDMTargetOperation class  |
  207. |                         and returns a handle to it.                          |
  208. ------------------------------------------------------------------------------*/
  209. static IDMTgtOperationHandle
  210.   allocIDMTgtOper    ( _DRAGINFO *dragInfomation );
  211. //allocIDMTgtOper    ( const IEvent &event );
  212.  
  213. private: /*------------------------ PRIVATE ----------------------------------*/
  214. IDMTargetItemSeq
  215.  *pDMTgtItemSeqCl;
  216.  
  217. static IDMTgtOperationHandle
  218.   pDMTgtOpHandle;
  219.  
  220. unsigned int
  221.  *pItemsRC;
  222. }; //class IDMTargetOperation
  223.  
  224. class IDMTgtOperationHandle : public IReference< IDMTargetOperation > {
  225. /*******************************************************************************
  226. * Objects of this class provide access to IDMTargetOperation objects           *
  227. * associated with a direct manipulation event.  This "handle" class manages    *
  228. * references to the IDMTargetOperation object to ensure that it is not deleted *
  229. * until the drag operation is completed.                                       *
  230. *                                                                              *
  231. * This class provides a "->" operator that enables instances to be treated     *
  232. * just like a pointer to an IDMTargetOperation object.                         *
  233. *                                                                              *
  234. * Example:                                                                     *
  235. *   // Event providing access to the drag information...                       *
  236. *   IBeginDragEvent                                                            *
  237. *    &event;                                                                   *
  238. *                                                                              *
  239. *   // Get drag information handle from event...                               *
  240. *   IDMTgtOperationHandle                                                      *
  241. *     tgtinfo = event.dragOperation();                                         *
  242. *                                                                              *
  243. *   // Process items (using info as a "pointer to IDMTargetOperation")...      *
  244. *   for( int i = 0; i < tgtinfo->numberOfItems(); i++ )                        *
  245. *     {                                                                        *
  246. *     // Process drag items.                                                   *
  247. *     }                                                                        *
  248. *                                                                              *
  249. * This class has no members.  It is essentially a synonym for the type         *
  250. * IReference< IDMTargetOperation >.                                            *
  251. *******************************************************************************/
  252. public:
  253. /*------------------------- Constructors/Destructor ----------------------------
  254. | Objects of this class are constructed in the following manner:               |
  255. |   o by providing a pointer to this handle class.                             |
  256. ------------------------------------------------------------------------------*/
  257.   IDMTgtOperationHandle  ( IDMTargetOperation *tgtOperation );
  258.   ~IDMTgtOperationHandle ( );
  259.  
  260. /*--------------------------------- Operators ---------------------------------+
  261. | Operators defined for IDMTgtItemHandle:                                      |
  262. |   =  - Overload definition to handle assignments of target drag operation    |
  263. |        pointers to target drag operation handles.                            |
  264. +-----------------------------------------------------------------------------*/
  265. IDMTgtOperationHandle
  266.  &operator = (IDMTargetOperation *tgtOperation);
  267.  
  268. }; //IDMTgtOperationHandle
  269.  
  270. #endif //_IDMTGTOP_
  271.