home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cluidm.zip / idmsrch.hpp < prev    next >
C/C++ Source or Header  |  1993-04-30  |  11KB  |  189 lines

  1. #ifndef _IDMSRCH_
  2. #define _IDMSRCH_
  3. /*******************************************************************************
  4. * FILE NAME: idmsrch.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IDMSourceHandler - Direct manipulation source window handler.            *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. * $Log:   S:/ibmclass/idrag/vcs/idmsrch.hpv  $
  18. //
  19. //   Rev 1.1   30 Apr 1993 11:45:42   HAGGAR
  20. //No change.
  21. //
  22. //   Rev 1.0   22 Apr 1993 10:41:12   HAGGAR
  23. //Initial revision.
  24. *******************************************************************************/
  25. #ifndef _IDMHNDLR_
  26.   #include <idmhndlr.hpp>
  27. #endif
  28.  
  29. #ifndef _IDMEVENT_
  30.   #include <idmevent.hpp>
  31. #endif
  32.  
  33. #ifndef _IDMRENDR_
  34.   #include <idmrendr.hpp>
  35. #endif
  36.  
  37. #ifndef _ISET_H
  38.   #include <iset.h>
  39. #endif
  40.  
  41. class IDMSourceHandler : public IDMHandler {
  42. typedef IDMHandler
  43.   Inherited;
  44. /*******************************************************************************
  45. * Objects of this class handle events occuring at source windows in direct     *
  46. * manipulation operations.  An instance of this class (or a derived class)     *
  47. * must be added to any window that will support direct manipulation from       *
  48. * that window.                                                                 *
  49. *                                                                              *
  50. * Example:                                                                     *
  51. * // Create IDragItemProvider object specific to my entry field...             *
  52. * MyDragItemProvider                                                           *
  53. *   provider;                                                                  *
  54. *                                                                              *
  55. * // Define source handler and add to an entry field...                        *
  56. * IDMSourceHandler                                                             *
  57. *   source( provider );                                                        *
  58. *                                                                              *
  59. * IEntryField                                                                  *
  60. *  *pEntryField;                                                               *
  61. *                                                                              *
  62. * source.startHandlingEventsFor( pEntryField );                                *
  63. *******************************************************************************/
  64. public:
  65. typedef ISet<IDMSrcRendererHandle> IDMSourceRendererSet;
  66.  
  67. /*----------------------- Constructor/Destructor -------------------------------
  68. | Objects of this class are constructed as follows:                            |
  69. ------------------------------------------------------------------------------*/
  70.   IDMSourceHandler ( );
  71.  
  72.   ~IDMSourceHandler ( );
  73.  
  74. protected:
  75. /*------------------------------ Event Handling --------------------------------
  76. | These functions are dispatched in response to specific direct manipulation   |
  77. | source events:                                                               |
  78. |   setup            - Called to process the initiation of a drag operation    |
  79. |                      and subsequently commence a drag operation.  This is    |
  80. |                      called in response to WM_BEGINDRAG.  The initial        |
  81. |                      processing of this function is to invoke the            |
  82. |                      createIDMSrcOper() function.  Then the                  |
  83. |                      provideDragItems() function of the IDragItemProvider    |
  84. |                      class is envoked to retrieve the items that are to be   |
  85. |                      dragged.  Then the IC_UM_BEGINDRAG message is sent to   |
  86. |                      all source handlers.  If there are items to be dragged, |
  87. |                      the function begin() is called to commence the drag via |
  88. |                      DrgDrag().                                              |
  89. |   assocItmsToRndrs - Called to associate each IDMSourceItem object with an   |
  90. |                      IDMSourceRenderer object that supports the specified    |
  91. |                      Type and RMF.  This is called in response to the        |
  92. |                      IC_UM_BEGINDRAG message.                                |
  93. |   prepareToRender  - Called to indicate to the source that rendering is      |
  94. |                      about to commence.  The default implementation in       |
  95. |                      this class dispatches the prepareToRender() function    |
  96. |                      on the corresponding IDMSourceItem created during       |
  97. |                      setup().                                                |
  98. |   render           - Called to indicate to the source handler to render      |
  99. |                      a given drag item.  The default implementation in       |
  100. |                      this class is to dispatch the render() function on      |
  101. |                      the IDMSourceItem object created during setup().        |
  102. |   endConversation  - Called to indicate that a given item has been processed |
  103. |                      by the target.  The default implementation in this      |
  104. |                      class dispatches the endConversation() function on the  |
  105. |                      corresponding IDMSourceItem object created during       |
  106. |                      setup().  When all the endConversation events have been |
  107. |                      received, then the IDMSourceOperaton object created at  |
  108. |                      setup() will be deleted.                                |
  109. |   dragOverNotify   - Called to indicate that a target window has processed   |
  110. |                      a "target enter" event.  The default implementation in  |
  111. |                      this class takes no action.  Derived classes can use    |
  112. |                      the information received from the target to draw        |
  113. |                      different source emphasis, etc.                         |
  114. ------------------------------------------------------------------------------*/
  115. virtual Boolean
  116.   setup            ( IDMSourceBeginEvent   &event ),
  117.   assocItmsToRndrs ( IDMSourceBeginEvent   &event ),
  118.   prepareToRender  ( IDMSourcePrepareEvent &event ),
  119.   render           ( IDMSourceRenderEvent  &event ),
  120.   endConversation  ( IDMSourceEndEvent     &event ),
  121.   dragOverNotify   ( IDMSourceNotifyEvent  &event ),
  122.   begin            ( IDMSourceBeginEvent   &event );
  123.  
  124. /*------------------------------ Implementation --------------------------------
  125. | The following utility functions are used to implement the behavior of        |
  126. | this class:                                                                  |
  127. |   allocIDMSrcOper     - Creates an instance of the IDMSourceOperation class  |
  128. |                         and returns a pointer to it.                         |
  129. ------------------------------------------------------------------------------*/
  130. virtual IDMSrcOperationHandle
  131.   allocIDMSrcOper ( IDMSourceBeginEvent& event ) const;
  132.  
  133. /*------------------------------ Renderers -------------------------------------
  134. | The following functions provide means of accessing the IDMSourceRenderer     |
  135. | objects involved in the direct manipulation operation.                       |
  136. |   numberOfRenderers - Returns the number of renderers.                       |
  137. |   renderer          - Returns the renderer with given index.                 |
  138. |   replaceRenderer   - Replaces a given renderer with another.                |
  139. |   addRenderer       - Associates another renderer with this operation.       |
  140. |   removeRenderer    - Removes a renderer from the operation.                 |
  141. ------------------------------------------------------------------------------*/
  142. unsigned
  143.   numberOfRenderers ( );
  144.  
  145. IDMSrcRendererHandle
  146.   renderer ( unsigned index );
  147.  
  148. IDMSourceHandler
  149.  &replaceRenderer ( unsigned             index,
  150.                     IDMSrcRendererHandle replacement ),
  151.  
  152.  &addRenderer ( IDMSrcRendererHandle newItem ),
  153.  
  154.  &removeRenderer  ( unsigned   index );
  155.  
  156. /*------------------------------ Implementation --------------------------------
  157. | The following utility functions are used to implement the behavior of        |
  158. | this class:                                                                  |
  159. |   sendBeginEvent      - Sends IC_UM_BEGINDRAG to the associated window.      |
  160. |   setRenderers        - Sets the pointer to the collection of                |
  161. |                         IDMSourceRenderers.                                  |
  162. |   rendererSetCl       - Returns a pointer to the collection of               |
  163. |                         IDMSourceRenderers.                                  |
  164. ------------------------------------------------------------------------------*/
  165. virtual void
  166.   sendBeginEvent ( IDMSourceBeginEvent &beginEvent );
  167. IDMSourceHandler
  168.   &setRenderers ( IDMSourceRendererSet *pIDMSrcRendererSet );
  169. IDMSourceRendererSet
  170.   *rendererSetCl ();
  171.  
  172. /*-------------------------------- Overrides -----------------------------------
  173. | This class overrides the following inherited functions:                      |
  174. |   dispatchHandlerEvent - Dispatching function; handles drag source events.   |
  175. ------------------------------------------------------------------------------*/
  176. virtual Boolean
  177.   dispatchHandlerEvent ( IEvent &event );
  178.  
  179. private: /*------------------------ PRIVATE ----------------------------------*/
  180. IDMSourceRendererSet
  181.   *pIRendererSetCl;
  182. }; //IDMSourceHandler
  183.  
  184. #ifndef I_NO_INLINES
  185.   #include <idmsrch.inl>
  186. #endif
  187.  
  188. #endif //_IDMSRCH_
  189.