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

  1. #ifndef _IDMCNRIT_
  2.   #define _IDMCNRIT_
  3. /*******************************************************************************
  4. * FILE NAME: idmcnrit.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the definition of the classes:                          *
  8. *     IDMCnrItem       - Container direct manipulation "item" class.           *
  9. *     IDMCnrItemHandle - Handle to manage references to IDMCnrItem objects.    *
  10. *                                                                              *
  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 disclosure    *
  17. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  18. *                                                                              *
  19. * $Log:   M:/ibmclass/idrag/vcs/idmcnrit.hpv  $                         *
  20. //
  21. //   Rev 1.2   04 Sep 1993 14:00:08   banzai
  22. //Container DM LIVES!
  23. //
  24. //   Rev 1.1   03 Sep 1993 20:08:34   banzai
  25. //Container related changes
  26. //
  27. //   Rev 1.0   02 Sep 1993 20:30:28   banzai
  28. //Initial Drop
  29. //
  30. *******************************************************************************/
  31. #ifndef _IDMITEM_
  32.   #include <idmitem.hpp>
  33. #endif
  34.  
  35. #ifndef _ICNRCTL_
  36.   #include <icnrctl.hpp>
  37. #endif
  38.  
  39. #ifndef _ICNROBJ_
  40.   #include <icnrobj.hpp>
  41. #endif
  42.  
  43. /* Forward Declarations */
  44. struct _DRAGITEM;
  45. class IDMSrcOperationHandle;
  46. class IDMTgtOperationHandle;
  47. class IDMCnrTargetHandler;
  48. class IDMCnrDropEvent;
  49.  
  50.  
  51. class IDMCnrItem : public IDMItem  {
  52. typedef IDMItem
  53.   Inherited;
  54. /*******************************************************************************
  55. * Objects of this class are created by containers when a direct manipulation   *
  56. * operation commences in a source container and during a direct manipulation   *
  57. * operation when a container object is dragged over a potential target         *
  58. * container.                                                                   *
  59. *                                                                              *
  60. * Objects of this class possess the following attributes (in addition to       *
  61. * those inherited from its base class):                                        *
  62. *   o Generic buffer (contents) to hold IContainerObject(s)                    *
  63. *   o association with a source or target drag operation object (see           *
  64. *     IDMSourceOperation or IDMTargetOperation)                                *
  65. *   o association(s) with derived source or target renderer object(s) capable  *
  66. *     of renderering container objects (see IDMCnrSrcRenderer or               *
  67. *     IDMCnrTgtRenderer) which are created by the source or handler (see       *
  68. *     IDMSourceHandler or IDMTargetHandler)                                    *
  69. *                                                                              *
  70. * This class provides virtual functions that implement support for direct      *
  71. * manipulation (i.e. drag drop) container object items.  Derived  classes      *
  72. * can be created to support more specific container object items.              *
  73. *******************************************************************************/
  74. public:
  75.  
  76. /*------------------------- Constructors/Destructor ----------------------------
  77. | Objects of this class are constructed in the following manner:               |
  78. |   o By providing pointers to the container control and object,               |
  79. |     the drag source operation handle, types, supported operations            |
  80. |     and attributes.                                                          |
  81. |   o By providing a generic drag item reference.                              |
  82. |   o By providing a generic drag item reference and a pointer to the target   |
  83. |     handler.                                                                 |
  84. ------------------------------------------------------------------------------*/
  85.   IDMCnrItem     ( IContainerControl           *container,
  86.                    IContainerObject            *object,
  87.                    const IDMSrcOperationHandle &sourceOperation,
  88.                    const IString               &types,
  89.                    unsigned short              supportedOperations = unknown,
  90.                    unsigned short              attributes = none);
  91.  
  92.   IDMCnrItem     ( const IDMItem               &dragItem );
  93.  
  94.   IDMCnrItem     ( const IDMItem               &dragItem,
  95.                    IDMCnrTargetHandler         *handler );
  96.  
  97. virtual
  98.   ~IDMCnrItem    ( );
  99.  
  100.  
  101. /*------------------------------ Source Items ----------------------------------
  102. | This function generates source items:                                        |
  103. |   generateCnrSourceItems - Generates container object items based upon       |
  104. |                            selected object(s) in the source container.       |
  105. ------------------------------------------------------------------------------*/
  106. static Boolean
  107.   generateCnrSourceItems    ( const IDMSrcOperationHandle &sourceOperation,
  108.                               IContainerControl           *container,
  109.                               IContainerObject            *containerObject,
  110.                               const ISize                 &sizeOffset );
  111.  
  112. /*------------------------------ Source Rendering ------------------------------
  113. | This function reads data from source window:                                 |
  114. |   renderPrepare - Acquires object data from container and stores in          |
  115. |                   container item.                                            |
  116. ------------------------------------------------------------------------------*/
  117. //virtual Boolean
  118. //  renderPrepare    ( IDMSourcePrepareEvent &event );
  119.  
  120. /*--------------------------------- Accessors ---------------------------------+
  121. | These functions provide a means of getting and setting the accessible        |
  122. | attributes of instances of this class:                                       |
  123. |   containerId     - Returns the source container's ID.                       |
  124. |   object          - Returns the container object.                            |
  125. |   sourceContainer - Returns the source container.                            |
  126. +-----------------------------------------------------------------------------*/
  127. unsigned long
  128.   containerId        ( ) const;
  129.  
  130. IContainerObject
  131.  *object             ( ) const;
  132.  
  133. IContainerControl
  134.  *sourceContainer    ( ) const;
  135.  
  136. /*------------------------------- Implementation ------------------------------+
  137. | This function facilitates re-usable means of creating container drag items   |
  138. | to support the multiple selection logic within containers:                   |
  139. |   createItem          - Creates container drag item.                         |
  140. |   cnrTargetHandler    - Returns pointer to the container's target handler.   |
  141. |   setCnrTargetHandler - Sets pointer to the container's target handler.      |
  142. +-----------------------------------------------------------------------------*/
  143. static IDMCnrItem
  144.  *createItem    ( const IDMSrcOperationHandle  &sourceOperation,
  145.                   IContainerControl            *container,
  146.                   IContainerObject             *containerObject,
  147.                   const ISize                  &sizeOffset );
  148.  
  149. IDMCnrTargetHandler
  150.  *cnrTargetHandler       ( ) const;
  151.  
  152. IDMCnrItem
  153.  &setCnrTargetHandler    ( IDMCnrTargetHandler *handler );
  154.  
  155. /*------------------------------ Drop Processing -------------------------------
  156. | This function writes data to the target window:                              |
  157. |   cnrDropped  - Sets container object into target container.                 |
  158. ------------------------------------------------------------------------------*/
  159. virtual Boolean
  160.   cnrDropped    ( IWindow *containerControl, IDMCnrDropEvent &event );
  161.  
  162. protected:
  163. /*--------------------------------- Accessors ---------------------------------+
  164. | These functions provide a means of getting and setting the accessible        |
  165. | attributes of instances of this class:                                       |
  166. |   setObject - Sets the container object.                                     |
  167. +-----------------------------------------------------------------------------*/
  168. IDMCnrItem
  169.  &setObject    ( IContainerObject *cnrObject );
  170.  
  171. /*-----------------------  Rendering Mechanisms/Formats  -----------------------
  172. | This function provides means for setting the "RMF" of the drag item:         |
  173. |   buildRMF  - Builds a rendering mechanism and format (RMF) string.          |
  174. ------------------------------------------------------------------------------*/
  175. IString
  176.   buildRMF    ( const IString &mechanism, const IString &format );
  177.  
  178. private: /*------------------------ PRIVATE ----------------------------------*/
  179.  
  180. IContainerControl
  181.  *pContainerCtl;
  182.  
  183. IContainerObject
  184.  *pContainerObj;
  185.  
  186. IDMCnrTargetHandler
  187.  *pCnrTgtHnd;
  188.  
  189. }; // IDMCnrItem
  190.  
  191.  
  192. class IDMCnrItemHandle : public IReference< IDMCnrItem > {
  193. /*******************************************************************************
  194. * Objects of this class provide access to IDMCnrItem objects                   *
  195. * associated with a direct manipulation event.  This "handle" class manages    *
  196. * references to the IDMCnrItem object to ensure that it is not                 *
  197. * deleted until the drag operation is completed.                               *
  198. *                                                                              *
  199. * This class provides a "->" operator that enables instances to be treated     *
  200. * just like a pointer to an IDMCnrItem object.                                 *
  201. *                                                                              *
  202. * Example:                                                                     *
  203. *                                                                              *
  204. * This class has no members.  It is essentially a synonym for the type         *
  205. * IReference< IDMCnrItem >.                                                    *
  206. *******************************************************************************/
  207. public:
  208.   IDMCnrItemHandle     ( IDMCnrItem *containerItem );
  209.   ~IDMCnrItemHandle    ( );
  210.  
  211. /*--------------------------------- Operators ---------------------------------+
  212. | Operators defined for IDMCnrItemHandle:                                      |
  213. |   =  - Overload definition to handle assignments of container item pointers  |
  214. |        to container drag item handles.                                       |
  215. +-----------------------------------------------------------------------------*/
  216. IDMCnrItemHandle
  217.  &operator = ( IDMCnrItem *containerItem );
  218.  
  219. }; // IDMCnrItemHandle
  220.  
  221. /*--------------------------------- INLINES ----------------------------------*/
  222. #ifndef I_NO_INLINES
  223.   #include <idmcnrit.inl>
  224. #endif
  225.  
  226. #endif // _IDMCNRIT_
  227.