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

  1. #ifndef _IDMTGTOP_
  2. #define _IDMTGTOP_
  3. /*******************************************************************************
  4. * FILE NAME: idmtgtop.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IDMTargetOperation    - Direct manipulation target operation 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 _IDMOPER_
  20.   #include <idmoper.hpp>
  21. #endif
  22.  
  23. /*----------------------------------------------------------------------------*/
  24. /* Align classes on four byte boundary.                                       */
  25. /*----------------------------------------------------------------------------*/
  26. #pragma pack(4)
  27.  
  28. /* Forward Declarations */
  29. class IContainerControl;
  30. class IDMItemSeq;
  31. class IDMImage;
  32.  
  33.  
  34. class IDMTargetOperation : public IDMOperation {
  35. typedef IDMOperation
  36.   Inherited;
  37. typedef IDM::DropStyle
  38.   DropStyle;
  39. /*******************************************************************************
  40. * Objects of this class provide information about direct manipulation target   *
  41. * operations.                                                                  *
  42. *                                                                              *
  43. * Access to this information is usually gained through the static              *
  44. * targetOperation() function.                                                  *
  45. *                                                                              *
  46. * Instances of this class are not intended to be created by application        *
  47. * programmers.  They are created by the source event handler class,            *
  48. * IDMTargetHandler.  Typically, access to the IDMTargetOperation class is      *
  49. * through an IDMTargetOperation::Handle object.                                *
  50. *******************************************************************************/
  51. public:
  52. /*------------------------ IDMTargetOperation::Handle --------------------------
  53. | IDMTargetOperation::Handle provides access to the IDMTargetOperation objects |
  54. | associated with a direct manipulation operation.  Handle manages the         |
  55. | references to the IDMTargetOperation object and ensures that this object is  |
  56. | not deleted until the direct manipulation operation is completed.            |
  57. |                                                                              |
  58. | Use Handle to reference a target operation handle within this class and      |
  59. | IDMTargetOperation::Handle externally.                                       |
  60. |                                                                              |
  61. | The handle provides a "->" operator that enables instances to be treated     |
  62. | just like pointers to an IDMTargetOperation object.                          |
  63. ------------------------------------------------------------------------------*/
  64. typedef IReference< IDMTargetOperation > Handle;
  65.  
  66. /*------------------------- Constructors/Destructor ----------------------------
  67. | Objects of this class are constructed by providing one of the following      |
  68. | items:                                                                       |
  69. |   o A reference to the target enter event.                                   |
  70. ------------------------------------------------------------------------------*/
  71.   IDMTargetOperation     ( IDMTargetEnterEvent &event );
  72.  
  73. virtual
  74.   ~IDMTargetOperation    ( );
  75.  
  76. /*-------------------------------- Utilities -----------------------------------
  77. | The following functions provide various utility services used to implement   |
  78. | this class:                                                                  |
  79. |   instanceFor         - Returns an IDMTargetOperation object                 |
  80. |   targetOperation     - Returns an IDMTargetOperation object handle that was |
  81. |                         created during the target enter event                |
  82. |   setTargetOperation  - Sets an IDMTargetOperation object handle during the  |
  83. |                         target enter event                                   |
  84. ------------------------------------------------------------------------------*/
  85. static IDMTargetOperation::Handle
  86.   instanceFor           ( IDMTargetEnterEvent &event );
  87.  
  88. static IDMTargetOperation::Handle
  89.   targetOperation       ( );
  90.  
  91. static void
  92.   setTargetOperation    ( IDMTargetOperation::Handle tgtOperation );
  93.  
  94. /*------------------------------ Container Support ----------------------------+
  95. | These functions provide a means of getting and setting container specific    |
  96. | attributes of instances of this class:                                       |
  97. |   wasDragAfter          - Returns the state of the latest drag-over or       |
  98. |                           drag-after notification.                           |
  99. |   isStyle               - Queries whether a specified style flag is set.     |
  100. |   setDropOffset         - Sets the current drop offset.                      |
  101. |   setContainerNoRefresh - Sets the given container to no-refresh.            |
  102. |                           When drop processing returns, refresh is turned    |
  103. |                           on again.                                          |
  104. |   setContainerRefresh   - Forces the no-refresh containers to refresh.       |
  105. |   setStyle              - Sets the drop style.                               |
  106. |   dropOffset            - Queries the current drop offset.                   |
  107. |   style                 - Returns the drop style.                            |
  108. |   dropPosition          - Computes the drop position for this item, in       |
  109. |                           container workspace coordinates, and sets the      |
  110. |                           offset for the next item, according to the         |
  111. |                           handler's drop style.                              |
  112. |   positionRelativeTo    - Returns a drag item's position relative to the     |
  113. |                           target container.  If the item pointer is 0, the   |
  114. |                           drop point relative to the container is returned.  |
  115. +-----------------------------------------------------------------------------*/
  116. Boolean
  117.   wasDragAfter             ( ) const,
  118.   isStyle                  ( DropStyle             dropStyle );
  119.  
  120. IDMTargetOperation
  121.  &setDropOffset            ( const ISize           &newPointerOffset ),
  122.  &setContainerNoRefresh    ( IContainerControl     *noRefresh ),
  123.  &setContainerRefresh      ( ),
  124.  &setStyle                 ( DropStyle             dropStyle );
  125.  
  126. ISize
  127.   dropOffset               ( ) const;
  128.  
  129. DropStyle
  130.   style                    ( ) const;
  131.  
  132. IPoint
  133.   dropPosition             ( const IDMItem::Handle &dragItem,
  134.                              IDMTargetDropEvent    &event ),
  135.   positionRelativeTo       ( const IDMItem::Handle &pItem,
  136.                              IDMTargetDropEvent    &event );
  137.  
  138. protected:
  139. private: /*------------------------ PRIVATE ----------------------------------*/
  140. friend class IDMTargetHandler;
  141.  
  142. static IDMTargetOperation::Handle
  143.   pDMTgtOpHandle;
  144.  
  145. Boolean
  146.   bWasDragAfter,
  147.   bNotDragLeave,
  148.   bDrop;
  149.  
  150. ISize
  151.   sizeDropOffset;
  152.  
  153. DropStyle
  154.   dropStyle;
  155.  
  156. IContainerControl
  157.  *pCnrNoRefresh1,
  158.  *pCnrNoRefresh2;
  159.  
  160. }; //class IDMTargetOperation
  161.  
  162. /*----------------------------------------------------------------------------*/
  163. /* Resume compiler default packing.                                           */
  164. /*----------------------------------------------------------------------------*/
  165. #pragma pack()
  166.  
  167. #endif //_IDMTGTOP_
  168.