home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IDMSRCOP.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  7KB  |  139 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. *                                                                              *
  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 _IREFCNT_
  20.   #include <irefcnt.hpp>
  21. #endif
  22.  
  23. #ifndef _IDMOPER_
  24.   #include <idmoper.hpp>
  25. #endif
  26.  
  27. /*----------------------------------------------------------------------------*/
  28. /* Align classes on four byte boundary.                                       */
  29. /*----------------------------------------------------------------------------*/
  30. #pragma pack(4)
  31.  
  32. /* Forward Declarations */
  33. struct _DRAGINFO;
  34. class IDMSourceBeginEvent;
  35. class IDMItemSeq;
  36. class IDMImage;
  37.  
  38.  
  39. class IDMSourceOperation : public IDMOperation {
  40. typedef IDMOperation
  41.   Inherited;
  42. typedef IDM::DragImageStyle
  43.   DragImageStyle;
  44. /*******************************************************************************
  45. * Objects of this class provide information about source direct manipulation   *
  46. * operations.                                                                  *
  47. *                                                                              *
  48. * Access to this information is usually gained through the following way:      *
  49. *   o The IDMItem::sourceOperation() function.                                 *
  50. *                                                                              *
  51. * Instances of this class are not intended to be created by application        *
  52. * programmers.  They are created by the source event handler class,            *
  53. * IDMSourceHandler.  Typically, access is through an                           *
  54. * IDMSourceOperation::Handle object.                                           *
  55. *******************************************************************************/
  56. public:
  57. /*------------------------ IDMSourceOperation::Handle --------------------------
  58. | IDMSourceOperation::Handle provides access to the IDMSourceOperation objects |
  59. | associated with a direct manipulation operation.  Handle manages the         |
  60. | references to the IDMSourceOperation object and ensures that this object is  |
  61. | not deleted until the direct manipulation operation is completed.            |
  62. |                                                                              |
  63. | Use Handle to reference a source operation handle within this class and      |
  64. | IDMSourceOperation::Handle externally.                                       |
  65. |                                                                              |
  66. | Handle provides a "->" operator that enables instances to be treated just    |
  67. | like a pointer to an IDMSourceOperation object.                              |
  68. ------------------------------------------------------------------------------*/
  69. typedef IReference< IDMSourceOperation > Handle;
  70.  
  71. /*------------------------- Constructors/Destructor ----------------------------
  72. | Objects of this class are constructed by providing the following:            |
  73. |                                                                              |
  74. |   o A reference to the source begin event and a drag image style.            |
  75. ------------------------------------------------------------------------------*/
  76.   IDMSourceOperation     ( IDMSourceBeginEvent &event,
  77.                            DragImageStyle      dragStyle = IDM::systemImages );
  78.  
  79. virtual
  80.   ~IDMSourceOperation    ( );
  81.  
  82. /*-------------------------------- Accessors -----------------------------------
  83. | These functions provide read/write access to attributes of instances of      |
  84. | this class:                                                                  |
  85. |   imageStyle       - Returns the drag image style for this source            |
  86. |                      operation.                                              |
  87. |   setImageStyle    - Sets the drag image style for this source operation.    |
  88. |   pointerOffset    - Returns the position of the pointing device relative    |
  89. |                      to the source container object's origin.                |
  90. |   setPointerOffset - Sets the position of the pointing device relative to    |
  91. |                      the source container object's origin.                   |
  92. ------------------------------------------------------------------------------*/
  93. virtual DragImageStyle
  94.   imageStyle           ( ) const;
  95.  
  96. virtual ISize
  97.   pointerOffset        ( ) const;
  98.  
  99. virtual IDMSourceOperation
  100.   &setImageStyle       ( DragImageStyle dragImageStyle = IDM::systemImages ),
  101.   &setPointerOffset    ( const ISize    &offset );
  102.  
  103. /*-------------------------------- Utilities -----------------------------------
  104. | These functions provide various utility services used to implement this      |
  105. | class:                                                                       |
  106. |   begin         - Initiates the dragging of the object(s).                   |
  107. |   operationFrom - Retrieves a handle to the source drag operation from the   |
  108. |                   drag information structure.                                |
  109. ------------------------------------------------------------------------------*/
  110. IDMSourceOperation
  111.  &begin            ( );
  112.  
  113. static Handle
  114.   operationFrom    ( _DRAGINFO *dragInformation );
  115.  
  116. protected:
  117. private: /*------------------------ PRIVATE ----------------------------------*/
  118.  
  119. ISize
  120.   ptrOffset,
  121.   totalImgOffset;
  122.  
  123. DragImageStyle
  124.   drgImgStyle;
  125.  
  126. ISize
  127.   totalImageOffset ();
  128.  
  129. void
  130.   storeImageOffset(IDMImage *pIDMImage);
  131. }; //class IDMSourceOperation
  132.  
  133. /*----------------------------------------------------------------------------*/
  134. /* Resume compiler default packing.                                           */
  135. /*----------------------------------------------------------------------------*/
  136. #pragma pack()
  137.  
  138. #endif //_IDMSRCOP_
  139.