home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IDMTGTRN.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  8KB  |  156 lines

  1. #ifndef _IDMTGTRN_
  2. #define _IDMTGTRN_
  3. /*******************************************************************************
  4. * FILE NAME: idmtgtrn.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IDMTargetRenderer - Direct manipulation target renderer class.           *
  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               *
  15. *   disclosure                                                                 *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. *******************************************************************************/
  19. #ifndef _IDMCOMM_
  20.   #include <idmcomm.hpp>
  21. #endif
  22.  
  23. #ifndef _IDMRENDR_
  24.   #include <idmrendr.hpp>
  25. #endif
  26.  
  27. #ifndef _IDMITEM_
  28.   #include <idmitem.hpp>
  29. #endif
  30.  
  31. #ifndef _ISTRING_
  32.   #include <istring.hpp>
  33. #endif
  34.  
  35. /*----------------------------------------------------------------------------*/
  36. /* Align classes on four byte boundary.                                       */
  37. /*----------------------------------------------------------------------------*/
  38. #pragma pack(4)
  39.  
  40. /* Forward Declarations */
  41. struct  _DRAGTRANSFER;
  42. class   IDMTargetDropEvent;
  43. class   IDMTargetEndEvent;
  44.  
  45.  
  46. class IDMTargetRenderer : public IDMRenderer {
  47. typedef IDMRenderer
  48.   Inherited;
  49. typedef IDM::DropIndicator
  50.   DropIndicator;
  51. /*******************************************************************************
  52. * Objects of this class provide target rendering support for a direct          *
  53. * manipulation operation.  Instances of this class are registered with the     *
  54. * target handler.  The handler selects a "best match" renderer for a given     *
  55. * drag item and invokes the rendering functions of this renderer when source   *
  56. * or target rendering events occur.                                            *
  57. *******************************************************************************/
  58. public:
  59.  
  60. /*------------------------ Constructors/Destructor -----------------------------
  61. | Objects of this class are constructed in the following manner:               |
  62. |   o By providing rmfs and types which indicates which drag item can be       |
  63. |     rendered by this target renderer.                                        |
  64. |   o No arguments.                                                            |
  65. ------------------------------------------------------------------------------*/
  66.   IDMTargetRenderer     ( const char *rmfs, const char *type = IDM::any );
  67.  
  68.   IDMTargetRenderer     ( );
  69.  
  70. virtual
  71.   ~IDMTargetRenderer    ( );
  72.  
  73.  
  74. /*--------------------------------- Testing ------------------------------------
  75. | The following functions test whether a given item can be rendered:           |
  76. |   canRender       - Returns a drop indicator with the renderer's ability to  |
  77. |                     render the item with the argument attributes.            |
  78. ------------------------------------------------------------------------------*/
  79. virtual DropIndicator
  80.   canRender         ( const IDMItem::Handle &dragItem );
  81.  
  82.  
  83. /*---------------------------- Operation Specific ------------------------------
  84. | The following function selects the appropriate operation:                    |
  85. |   supportsOperation - Returns true if the default operation (for example,    |
  86. |                       move, copy, or link) is supported by the item.         |
  87. ------------------------------------------------------------------------------*/
  88. virtual Boolean
  89.   supportsOperation   ( const IDMItem::Handle &dragItem );
  90.  
  91. /*-------------------------------- Rendering -----------------------------------
  92. | The following functions are called to perform rendering operations:          |
  93. |   targetRender             - Called when a drop event occurs for a drag      |
  94. |                              item and this renderer must render the item.    |
  95. |   targetRenderPrepare      - Called when the source window requests that the |
  96. |                              target window generate a preparation event.     |
  97. |   targetRenderComplete     - Called when a completion event occurs and this  |
  98. |                              renderer must render a drag item.               |
  99. |   informSourceOfCompletion - Informs the source window that the target       |
  100. |                              window has finished processing the data         |
  101. |                              associated with the dropped item.  The source   |
  102. |                              window is informed for both source and target   |
  103. |                              rendering.                                      |
  104. ------------------------------------------------------------------------------*/
  105. virtual IDMTargetRenderer
  106.  &targetRender                ( IDMTargetDropEvent    &event,
  107.                                 const IDMItem::Handle &dragItem ),
  108.  
  109.  &targetRenderPrepare         ( IDMTargetDropEvent    &event,
  110.                                 const IDMItem::Handle &dragItem ),
  111.  
  112.  &targetRenderComplete        ( IDMTargetEndEvent     &event ),
  113.  &informSourceOfCompletion    ( const IDMItem::Handle &dragItem );
  114.  
  115. protected:
  116. /*------------------------------ Implementation --------------------------------
  117. | The following functions provide utilities used to implement this class:      |
  118. |   renderAtSource      - Sends a render event to the source window to request |
  119. |                         source rendering for the argument item.              |
  120. |   prepareAtSource     - Sends a prepare event to the source window to request|
  121. |                         source preparation for the argument item.            |
  122. |   renderComplete      - Called to process a completion event for a drag item.|
  123. |   renderToName        - Called to provide the name of the location where the |
  124. |                         data will be renderer to.  This name can be a        |
  125. |                         filename, shared memory buffer, etc.                 |
  126. ------------------------------------------------------------------------------*/
  127. virtual Boolean
  128.   renderAtSource     ( IDMTargetDropEvent    &event,
  129.                        const IDMItem::Handle &dragItem ),
  130.   prepareAtSource    ( IDMTargetDropEvent    &event,
  131.                        const IDMItem::Handle &dragItem ),
  132.   renderComplete     ( const IDMItem::Handle &dragItem, void* pBuffer );
  133.  
  134. virtual IString
  135.   renderToName       ( const IDMItem::Handle &dragItem );
  136.  
  137. private: /*------------------------ PRIVATE ----------------------------------*/
  138.  
  139. _DRAGTRANSFER
  140.  *pPMDragTransfer;
  141.  
  142. _DRAGTRANSFER
  143.   *allocDragTransfer (IDMTargetDropEvent    &dropEvent,
  144.                       const IDMItem::Handle &pDI);
  145.  
  146. _DRAGTRANSFER
  147.   *dragTransfer () const;
  148. }; // class IDMTargetRenderer
  149.  
  150. /*----------------------------------------------------------------------------*/
  151. /* Resume compiler default packing.                                           */
  152. /*----------------------------------------------------------------------------*/
  153. #pragma pack()
  154.  
  155. #endif // _IDMTGTRN_
  156.