home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cluidm.zip / idmsrcop.hpp < prev    next >
C/C++ Source or Header  |  1993-05-06  |  10KB  |  184 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.1   30 Apr 1993 11:45:44   HAGGAR
  23. //
  24. //   Rev 1.0   22 Apr 1993 10:41:14   HAGGAR
  25. //Initial revision.
  26. *******************************************************************************/
  27. #ifndef _IHANDLE_
  28.   #include <ihandle.hpp>
  29. #endif
  30.  
  31. #ifndef _IREFCNT_
  32.   #include <irefcnt.hpp>
  33. #endif
  34.  
  35. #ifndef _IWINDOW_
  36.   #include <iwindow.hpp>
  37. #endif
  38.  
  39. #ifndef _IDMOPER_
  40.   #include <idmoper.hpp>
  41. #endif
  42.  
  43. #ifndef _ISTRING_
  44.   #include <istring.hpp>
  45. #endif
  46.  
  47. struct _DRAGINFO;
  48. class IDMSourceItem;
  49. class IDMSrcItemHandle;
  50. class IDMSourceBeginEvent;
  51.  
  52. class IDMSourceOperation : public IDMOperation {
  53. typedef IDMOperation
  54.   Inherited;
  55. /*******************************************************************************
  56. * This is the direct manipulation source drag operation class.  Objects of     *
  57. * this class provide information about source direct manipulation operations.  *
  58. *                                                                              *
  59. * Access to this information is usually gained in one of the following ways:   *
  60. *   o Via an associated IDMSourceItem object's dragOperation() function.       *
  61. *   o Via an associated direct manipulation event's dragOperation() function.  *
  62. *                                                                              *
  63. * Objects of this class possess the following attributes:                      *
  64. *   o Information about the source direct manipulation operation as a whole:   *
  65. *       - number of associated drag items (ie. IDMSourceItems).                *
  66. *       - pointer to the collection of IDMSourceItems.                         *
  67. *   o A collection of IDMSourceItem objects, one for each item being "dragged" *
  68. *     on this operation.                                                       *
  69. *                                                                              *
  70. * Instances of this class are not intended to be created by application        *
  71. * programmers.  Generally, they are created only by the direct manipulation    *
  72. * event classes requiring this information.  Typically, access is via an       *
  73. * IDMSrcOperationHandle object (see below).                                    *
  74. *******************************************************************************/
  75. public:
  76. typedef ISet<IDMSrcItemHandle> IDMSourceItemSet;
  77.  
  78. /*------------------------- Constructors/Destructor ----------------------------
  79. | Objects of this class are constructed one of two ways:                       |
  80. |   o by providing the source of the direct manipulation operation and the     |
  81. |     pointing device position.                                                |
  82. |   o by providing a pointer to a _DRAGINFO structure.                         |
  83. ------------------------------------------------------------------------------*/
  84. //  IDMSourceOperation ( IDMSourceBeginEvent::Source  source,
  85. //                       const IPoint &position );
  86.   IDMSourceOperation ( Source  source,
  87.                        const IPoint &position );
  88.  
  89.   IDMSourceOperation ( _DRAGINFO *pDragInfo );
  90.  
  91.   ~IDMSourceOperation ( );
  92.  
  93. /*-------------------------------- Drag Items ----------------------------------
  94. | The following functions provide means of accessing the IDMSourceItem objects |
  95. | involved in the direct manipulation operation described by instances of      |
  96. | this class:                                                                  |
  97. |   numberOfItems - Returns the number of drag items.                          |
  98. |   Item          - Returns the drag item with given index.                    |
  99. |   replaceItem   - Replaces a given drag item with another.                   |
  100. |   addItem       - Associates another drag item with this operation.          |
  101. |   removeItem    - Removes a drag item from the operation.                    |
  102. |   itemsSetCl    - Returns a pointer to the collection of IDMSourceItems.     |
  103. |   begin         - Initiates the dragging of the object(s).                   |
  104. ------------------------------------------------------------------------------*/
  105. unsigned
  106.   numberOfItems ( );
  107.  
  108. IDMSrcItemHandle
  109.   item ( unsigned index );
  110.  
  111. IDMSourceOperation
  112.   &replaceItem ( unsigned        index,
  113.                  IDMSrcItemHandle replacement ),
  114.  
  115.   &addItem     ( const IDMSrcItemHandle newItem ),
  116.  
  117.   &removeItem  ( unsigned index );
  118.  
  119. IDMSourceItemSet
  120.   *itemsSetCl ( );
  121.  
  122. void
  123.    begin ( );
  124.  
  125. protected:
  126. /*------------------------------ Implementation --------------------------------
  127. | These functions provide various utility services used to implement this      |
  128. | class:                                                                       |
  129. |   setItems    - Sets the pointer to the collection of IDMSourceItems.        |
  130. ------------------------------------------------------------------------------*/
  131. IDMSourceOperation
  132.   &setItems ( IDMSourceItemSet *pIDMSourceItemSet );
  133.  
  134.  
  135. private: /*------------------------ PRIVATE ----------------------------------*/
  136. IString
  137.   stringFromHandle        (const IStringHandle& hstr);
  138.  
  139. IDMSourceItemSet
  140.   *pDMSrcItemSetCl;
  141. }; //class IDMSourceOperation
  142.  
  143. class IDMSrcOperationHandle : public IReference< IDMSourceOperation > {
  144. /*******************************************************************************
  145. * Objects of this class provide access to IDMSourceOperation objects           *
  146. * associated with a direct manipulation event.  This "handle" class manages    *
  147. * references to the IDMSourceOperation object to ensure that it is not deleted *
  148. * until the direct manipulation operation is completed.                        *
  149. *                                                                              *
  150. * This class provides a "->" operator that enables instances to be treated     *
  151. * just like a pointer to an IDMSourceOperation object.                         *
  152. *                                                                              *
  153. * Example:                                                                     *
  154. *   // Event providing access to the drag information...                       *
  155. *   IBeginDragEvent                                                            *
  156. *    &event;                                                                   *
  157. *                                                                              *
  158. *   // Get drag information handle from event...                               *
  159. *   IDMSrcOperationHandle                                                      *
  160. *     srcinfo = event.dragOperation();                                         *
  161. *                                                                              *
  162. *   // Process items (using info as a "pointer to IDMSoruceOperation")...      *
  163. *   for( int i = 0; i < srcinfo->numberOfItems(); i++ )                        *
  164. *     {                                                                        *
  165. *     // Process drag items.                                                   *
  166. *     }                                                                        *
  167. *                                                                              *
  168. * This class has no members.  It is essentially a synonym for the type         *
  169. * IReference< IDMSourceOperation >.                                            *
  170. *******************************************************************************/
  171. public:
  172. /*------------------------- Constructors/Destructor ----------------------------
  173. | Objects of this class are constructed in the following manner:               |
  174. |   o by providing a pointer to this handle class.                             |
  175. ------------------------------------------------------------------------------*/
  176.   IDMSrcOperationHandle (IDMSourceOperation *pIDMSourceOp) :
  177.     IReference <IDMSourceOperation> (pIDMSourceOp) { }
  178.  
  179.   ~IDMSrcOperationHandle ( ) { }
  180.  
  181. }; //IDMSrcOperationHandle
  182.  
  183. #endif //_IDMSRCOP_
  184.