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

  1. #ifndef _IDMSRCOP_
  2. #define _IDMSRCOP_
  3. /*******************************************************************************
  4. * FILE NAME: idmsrcop.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IDMSourceOperation    - Direct manipulation "Source" operation class.    *
  9. *     IDMSrcOperationHandle - "Handle" for the IDMSrcOperation object to       *
  10. *                             maintain 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/idmsrcop.hpv  $
  21. //
  22. //   Rev 1.13   03 Sep 1993 11:19:42   HAGGAR
  23. //Added drag image support and made assorted fixes
  24. //
  25. //   Rev 1.12   17 Aug 1993 15:25:08   banzai
  26. //Move ISet stuff to .CPP
  27. //
  28. //   Rev 1.11   16 Aug 1993 13:00:38   banzai
  29. //Forward declare IDMSrcOperationHandle
  30. //
  31. //   Rev 1.10   14 Aug 1993 08:50:44   banzai
  32. //Prose cleanup
  33. //
  34. //   Rev 1.9   12 Aug 1993 13:53:24   banzai
  35. //Merge source and target item into one
  36. //
  37. //   Rev 1.8   03 Aug 1993 20:10:38   banzai
  38. //Remove addRef()
  39. //
  40. //   Rev 1.7   02 Aug 1993 15:28:02   HAGGAR
  41. //more rendering changes
  42. //
  43. //   Rev 1.6   15 Jul 1993 14:02:42   HAGGAR
  44. //rendering changes
  45. //
  46. //   Rev 1.5   13 Jul 1993 15:57:48   banzai
  47. //Add assignment operator for handles
  48. //
  49. //   Rev 1.4   12 Jul 1993 11:31:48   banzai
  50. //Rendering changes
  51. //
  52. //   Rev 1.3   01 Jul 1993 12:23:16   HAGGAR
  53. //rendering changes
  54. //
  55. //   Rev 1.2   12 May 1993 17:28:40   HAGGAR
  56. //various changes
  57. //
  58. //   Rev 1.1   30 Apr 1993 11:45:44   HAGGAR
  59. //
  60. //   Rev 1.0   22 Apr 1993 10:41:14   HAGGAR
  61. //Initial revision.
  62. *******************************************************************************/
  63. #ifndef _IHANDLE_
  64.   #include <ihandle.hpp>
  65. #endif
  66.  
  67. #ifndef _IREFCNT_
  68.   #include <irefcnt.hpp>
  69. #endif
  70.  
  71. #ifndef _IWINDOW_
  72.   #include <iwindow.hpp>
  73. #endif
  74.  
  75. #ifndef _IDMOPER_
  76.   #include <idmoper.hpp>
  77. #endif
  78.  
  79. #ifndef _ISTRING_
  80.   #include <istring.hpp>
  81. #endif
  82.  
  83. /* Forward Declarations */
  84. struct _DRAGINFO;
  85. class IDMItem;
  86. class IDMItemHandle;
  87. class IDMSourceBeginEvent;
  88. class IDMSrcOperationHandle;
  89. class IDMSourceItemSeq;
  90. class IDMImage;
  91.  
  92.  
  93. class IDMSourceOperation : public IDMOperation {
  94. typedef IDMOperation
  95.   Inherited;
  96. /*******************************************************************************
  97. * This is the direct manipulation source drag operation class.  Objects of     *
  98. * this class provide information about source direct manipulation operations.  *
  99. *                                                                              *
  100. * Access to this information is usually gained in one of the following ways:   *
  101. *   o Via an associated IDMItem object's dragOperation() function.             *
  102. *   o Via an associated direct manipulation event's dragOperation() function.  *
  103. *                                                                              *
  104. * Objects of this class possess the following attributes:                      *
  105. *   o Information about the source direct manipulation operation as a whole:   *
  106. *       - number of associated drag items (ie. IDMItems).                      *
  107. *       - pointer to the collection of IDMItems.                               *
  108. *   o A collection of IDMItem objects, one for each item being "dragged"       *
  109. *     on this operation.                                                       *
  110. *                                                                              *
  111. * Instances of this class are not intended to be created by application        *
  112. * programmers.  Generally, they are created only by the direct manipulation    *
  113. * event classes requiring this information.  Typically, access is via an       *
  114. * IDMSrcOperationHandle object (see below).                                    *
  115. *******************************************************************************/
  116. public:
  117. /*------------------------- Constructors/Destructor ----------------------------
  118. | Objects of this class are constructed one of two ways:                       |
  119. |   o by providing the source of the direct manipulation operation and a       |
  120. |     source begin event.                                                      |
  121. |   o by providing a generic drag item handle.                                 |
  122. ------------------------------------------------------------------------------*/
  123.   IDMSourceOperation     ( Source                    source,
  124.                            const IDMSourceBeginEvent &event );
  125.  
  126.   IDMSourceOperation     ( _DRAGINFO                 *pDragInfo );
  127.  
  128. virtual
  129.   ~IDMSourceOperation    ( );
  130.  
  131. /*-------------------------------- Drag Items ----------------------------------
  132. | The following functions provide means of accessing the IDMItem objects       |
  133. | involved in the direct manipulation operation described by instances of      |
  134. | this class:                                                                  |
  135. |   numberOfItems  - Returns the number of drag items.                         |
  136. |   item           - Returns the drag item with given index.                   |
  137. |   replaceItem    - Replaces a given drag item with another.                  |
  138. |   addItem        - Associates another drag item with this operation.         |
  139. |   removeItem     - Removes a drag item from the operation.                   |
  140. |   itemCollection - Returns a pointer to the source collection of             |
  141. |                    IDMItemHandles.                                           |
  142. |   begin          - Initiates the dragging of the object(s).                  |
  143. ------------------------------------------------------------------------------*/
  144. unsigned
  145.   numberOfItems     ( );
  146.  
  147. IDMItemHandle
  148.   item              ( unsigned            index );
  149.  
  150. IDMSourceOperation
  151.  &replaceItem       ( unsigned            index,
  152.                       IDMItemHandle       replacement ),
  153.  &addItem           ( const IDMItemHandle &newItem ),
  154.  &removeItem        ( unsigned            index );
  155.  
  156. IDMSourceItemSeq
  157.  *itemCollection    ( );
  158.  
  159. IDMSourceOperation
  160.  &begin             (unsigned short dragItemStyle );
  161.  
  162. /*------------------------------ Implementation --------------------------------
  163. | These functions provide various utility services used to implement this      |
  164. | class:                                                                       |
  165. |   setSourceOperation - Sets the IDMSourceOperation object that is created    |
  166. |                        when a drag operation begins.                         |
  167. |   sourceOperation    - Returns the IDMSrcOperationHandle that was created    |
  168. |                        when the drag was initiated.                          |
  169. ------------------------------------------------------------------------------*/
  170. static void
  171.   setSourceOperation    ( IDMSrcOperationHandle sourceOp );
  172.  
  173. static IDMSrcOperationHandle
  174.   sourceOperation ();
  175.  
  176. protected:
  177. private: /*------------------------ PRIVATE ----------------------------------*/
  178.  
  179. IDMSourceItemSeq
  180.   *pDMSrcItemSeqCl;
  181.  
  182. static IDMSrcOperationHandle
  183.   pDMSrcOpHandle;
  184.  
  185. void
  186.   storeImageOffset(IDMImage *pIDMImage);
  187.  
  188. ISize
  189.   totalImageOffset ();
  190.  
  191. ISize
  192.   totalImgOffset;
  193. }; //class IDMSourceOperation
  194.  
  195. class IDMSrcOperationHandle : public IReference< IDMSourceOperation > {
  196. /*******************************************************************************
  197. * Objects of this class provide access to IDMSourceOperation objects           *
  198. * associated with a direct manipulation event.  This "handle" class manages    *
  199. * references to the IDMSourceOperation object to ensure that it is not deleted *
  200. * until the direct manipulation operation is completed.                        *
  201. *                                                                              *
  202. * This class provides a "->" operator that enables instances to be treated     *
  203. * just like a pointer to an IDMSourceOperation object.                         *
  204. *                                                                              *
  205. * Example:                                                                     *
  206. *   // Event providing access to the drag information...                       *
  207. *   IBeginDragEvent                                                            *
  208. *    &event;                                                                   *
  209. *                                                                              *
  210. *   // Get drag information handle from event...                               *
  211. *   IDMSrcOperationHandle                                                      *
  212. *     srcinfo = event.dragOperation();                                         *
  213. *                                                                              *
  214. *   // Process items (using info as a "pointer to IDMSoruceOperation")...      *
  215. *   for( int i = 0; i < srcinfo->numberOfItems(); i++ )                        *
  216. *     {                                                                        *
  217. *     // Process drag items.                                                   *
  218. *     }                                                                        *
  219. *                                                                              *
  220. * This class has no members.  It is essentially a synonym for the type         *
  221. * IReference< IDMSourceOperation >.                                            *
  222. *******************************************************************************/
  223. public:
  224. /*------------------------- Constructors/Destructor ----------------------------
  225. | Objects of this class are constructed in the following manner:               |
  226. |   o by providing a pointer to this handle class.                             |
  227. ------------------------------------------------------------------------------*/
  228.   IDMSrcOperationHandle  ( IDMSourceOperation *srcOperation );
  229.   ~IDMSrcOperationHandle ( );
  230.  
  231. /*--------------------------------- Operators ---------------------------------+
  232. | Operators defined for IDMSrcOperationHandle:                                 |
  233. |   =  - Overload definition to handle assignments of source drag operation    |
  234. |        pointers to source drag operation handles.                            |
  235. +-----------------------------------------------------------------------------*/
  236. IDMSrcOperationHandle
  237.  &operator = (IDMSourceOperation *srcOperation);
  238.  
  239. }; //IDMSrcOperationHandle
  240.  
  241. #endif //_IDMSRCOP_
  242.