home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cluidm.zip / idmevent.hpp < prev    next >
Text File  |  1993-05-03  |  24KB  |  496 lines

  1. #ifndef _IDMEVENT_
  2. #define _IDMEVENT_
  3. /*******************************************************************************
  4. * FILE NAME: idmevent.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IDMEvent                                                                 *
  9. *                                                                              *
  10. *     IDMSourceBeginEvent                                                      *
  11. *     IDMSourceRenderEvent                                                     *
  12. *     IDMSourcePrepareEvent                                                    *
  13. *     IDMSourceEndEvent                                                        *
  14. *     IDMSourceNotifyEvent                                                     *
  15. *                                                                              *
  16. *     IDMTargetEnterEvent                                                      *
  17. *     IDMTargetDropEvent                                                       *
  18. *     IDMTargetEndEvent                                                        *
  19. *                                                                              *
  20. * COPYRIGHT:                                                                   *
  21. *   Licensed Materials - Property of IBM                                       *
  22. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  23. *   All Rights Reserved                                                        *
  24. *   US Government Users Restricted Rights - Use, duplication, or               *
  25. *   disclosure                                                                 *
  26. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  27. *                                                                              *
  28. * $Log:   M:/ibmclass/idrag/vcs/idmevent.hpv  $
  29. //
  30. //   Rev 1.2   03 May 1993 16:05:46   unknown
  31. //Latest changes per IC_UM_DRAGOVER
  32. //
  33. //   Rev 1.1   30 Apr 1993 11:45:18   HAGGAR
  34. //
  35. //   Rev 1.0   22 Apr 1993 10:41:02   HAGGAR
  36. //Initial revision.
  37. *******************************************************************************/
  38. #ifndef _IEVENT_
  39.   #include <ievent.hpp>
  40. #endif
  41.  
  42. #ifndef _IDMSRCOP_
  43.   #include <idmsrcop.hpp>
  44. #endif
  45.  
  46. #ifndef _IDMTGTOP_
  47.   #include <idmtgtop.hpp>
  48. #endif
  49.  
  50. class IDMSrcItemHandle;
  51. class IPoint;
  52. class IWindowHandle;
  53. class IString;
  54.  
  55. class IDMEvent : public IEvent {
  56. /*******************************************************************************
  57. * This is the common base class for all direct manipulation event classes.     *
  58. *******************************************************************************/
  59. public:
  60. protected:
  61. /*----------------------- Constructor/Destructor ------------------------------|
  62. | Instances of this class are constructed from a generic IEvent and an         |
  63. | IDragInformation handle.                                                     |
  64. |                                                                              |
  65. | The constructor is protected so that this class is effectively an abstract   |
  66. | base class.                                                                  |
  67. ------------------------------------------------------------------------------*/
  68.   IDMEvent ( IEvent &event );
  69.   ~IDMEvent ( );
  70.  
  71. private: /*------------------------ PRIVATE ----------------------------------*/
  72. };
  73.  
  74. class IDMSourceBeginEvent : public IDMEvent {
  75. typedef IDMEvent
  76.   Inherited;
  77. /*******************************************************************************
  78. * Objects of this class represent the event that occurs upon initiation        *
  79. * of a direct manipulation event at the source window.  Instances are          *
  80. * passed as argument to the IDMSourceHandler functions setup() and             *
  81. * begin() functions.                                                           *
  82. *******************************************************************************/
  83. public:
  84. /*------------------------- Constructors/Destructor ----------------------------
  85. | Objects of this class are constructed from generic IEvent objects.           |
  86. ------------------------------------------------------------------------------*/
  87.   IDMSourceBeginEvent ( IEvent &event );
  88.   ~IDMSourceBeginEvent ( );
  89.  
  90. /*--------------------------------- Accessors ----------------------------------
  91. | These functions provide means of getting and setting the accessible          |
  92. | attributes of instances of this class:                                       |
  93. |   Source        - Enumeration of the possible drag start sources:            |
  94. |                     pointingDevice - Drag initiated via mouse.               |
  95. |                     keyboard       - Drag initiated via keyboard.            |
  96. |   source        - Returns the source of the drag operation.                  |
  97. |   position      - Returns the pointing device position (only if source is    |
  98. |                   pointingDevice).                                           |
  99. |   dragOperation - Returns the source drag operation handle for this event.   |
  100. ------------------------------------------------------------------------------*/
  101.  
  102. //virtual IDMOperation::Source
  103. //  source ( ) const;
  104.  
  105. virtual IPoint
  106.   position ( ) const;
  107.  
  108. IDMSrcOperationHandle
  109.   dragOperation () const;
  110.  
  111. protected:
  112. private: /*------------------------ PRIVATE ----------------------------------*/
  113. IDMSrcOperationHandle
  114.   pDMSrcOpHandle;
  115. IPoint
  116.   pos;
  117. }; // IDMSourceBeginEvent
  118.  
  119.  
  120. class IDMSourceRenderEvent : public IDMEvent {
  121. typedef IDMEvent
  122.   Inherited;
  123. /*******************************************************************************
  124. * Objects of this class represent direct manipulation "rendering" events.      *
  125. * Such events are created and dispatched to source handlers when a direct      *
  126. * manipulation target handler requests source rendering.                       *
  127. *                                                                              *
  128. * In addition to the standard IEvent attributes (event and window              *
  129. * identifiers), such objects also possess:                                     *
  130. *   o an associated IDragItem                                                  *
  131. *   o a target window handle                                                   *
  132. *   o a rendering mechanism/format selected by the target                      *
  133. *   o a target name                                                            *
  134. *   o an arbitrary target "information" (an unsigned long)                     *
  135. *******************************************************************************/
  136. public:
  137. /*------------------------- Constructors/Destructor ----------------------------
  138. | Objects of this class are constructed from generic IEvent objects.           |
  139. ------------------------------------------------------------------------------*/
  140.   IDMSourceRenderEvent ( IEvent &event );
  141.   ~IDMSourceRenderEvent ( );
  142.  
  143. /*-------------------------------- Accessors -----------------------------------
  144. | The following functions provide access to the accessible attributes of       |
  145. | instances of this class:                                                     |
  146. |   dragItem          - Returns handle to the IDragItem corresponding to       |
  147. |                       the item being rendered.                               |
  148. |   alternateWindow   - Returns the handle of the alternate source window.     |
  149. |   selectedMechanism - Returns the selected rendering mechanism.              |
  150. |   selectedFormat    - Returns the selected rendering format.                 |
  151. |   targetName        - Returns the target "render to" name.                   |
  152. |   targetInfo        - Returns the target-defined "information."              |
  153. |   dragOperation     - Returns the source drag operation handle for this      |
  154. |                       event.                                                 |
  155. ------------------------------------------------------------------------------*/
  156. IDMSrcItemHandle
  157.   dragItem ( ) const;
  158.  
  159. IWindowHandle
  160.   alternateWindow ( ) const;
  161.  
  162. IString
  163.   selectedMechanism ( ) const,
  164.   selectedFormat    ( ) const,
  165.   targetName        ( ) const;
  166.  
  167. unsigned long
  168.   targetInfo ( ) const;
  169.  
  170. IDMSrcOperationHandle
  171.   dragOperation ();
  172.  
  173. protected:
  174. private: /*------------------------ PRIVATE ----------------------------------*/
  175. IDMSrcOperationHandle
  176.   pDMSrcOpHandle;
  177. }; // IDMSourceRenderEvent
  178.  
  179. class IDMSourcePrepareEvent : public IDMSourceRenderEvent {
  180. typedef IDMSourceRenderEvent
  181.   Inherited;
  182. /*******************************************************************************
  183. * These events are sent to the source window when the source renderer for a    *
  184. * given object has indicated such notification is necessary prior to starting  *
  185. * the source rendering of a drag item.                                         *
  186. *                                                                              *
  187. * Objects of this class provide all the "query" functions inherited from       *
  188. * IDMSourceRenderEvent.  In addition, functions are provided to provide        *
  189. * return information to the target:                                            *
  190. *   o an alternate source window that the target should communicate with       *
  191. *     during rendering                                                         *
  192. *   o two result flags indicating whether rendering should be done by the      *
  193. *     target and/or whether the target should retry with a different           *
  194. *     rendering mechanism and format.                                          *
  195. *******************************************************************************/
  196. public:
  197. /*------------------------- Constructors/Destructor ----------------------------
  198. | Objects of this class are constructed from generic IEvent objects.           |
  199. ------------------------------------------------------------------------------*/
  200.   IDMSourcePrepareEvent ( IEvent &event );
  201.   ~IDMSourcePrepareEvent ( );
  202.  
  203. /*---------------------------------- Result ------------------------------------
  204. | These functions provide means of specifying render preparation results to    |
  205. | be passed back to the target:                                                |
  206. |   setAlternateWindow   - Sets alternate source window handle.                |
  207. |   targetCanRetry       - Returns current setting of the "retry" flag.        |
  208. |   setTargetCanRetry    - Sets "retry" flag.                                  |
  209. |   noSourceRendering    - Returns current "no source rendering" flag.         |
  210. |   setNoSourceRendering - Sets "no source rendering" flag.                    |
  211. ------------------------------------------------------------------------------*/
  212. virtual Boolean
  213.   targetCanRetry    ( ) const,
  214.   noSourceRendering ( ) const;
  215.  
  216. virtual IDMSourcePrepareEvent
  217.  &setAlternateWindow   ( const IWindowHandle &window ),
  218.  &setTargetCanRetry    ( Boolean              flag ),
  219.  &setNoSourceRendering ( Boolean            flag );
  220.  
  221. }; // IDMSourcePrepareEvent
  222.  
  223. class IDMSourceEndEvent : public IDMEvent {
  224. typedef IDMEvent
  225.   Inherited;
  226. /*******************************************************************************
  227. * These events are sent to the direct manipulation source window when a        *
  228. * target renderer has completed the rendering of a drag item.  One such        *
  229. * event is expected for each of the drag items involved in the direct          *
  230. * manipulation operation.                                                      *
  231. *******************************************************************************/
  232. public:
  233. /*------------------------- Constructors/Destructor ----------------------------
  234. | Objects of this class are constructed from generic IEvent objects.           |
  235. ------------------------------------------------------------------------------*/
  236.   IDMSourceEndEvent ( IEvent &event );
  237.   ~IDMSourceEndEvent ( );
  238.  
  239. /*-------------------------------- Accessors -----------------------------------
  240. | These functions provide access to attributes of instances of this class:     |
  241. |   dragItem            - Returns handle of drag item the target has           |
  242. |                         completed rendering of.                              |
  243. |   wasTargetSuccessful - Returns whether target successfully completed its    |
  244. |                         rendering.                                           |
  245. |   dragOperation       - Returns the source drag operation handle for this   |
  246. |                         event.                                              |
  247. ------------------------------------------------------------------------------*/
  248. IDMSrcItemHandle
  249.   dragItem ( ) const;
  250.  
  251. virtual Boolean
  252.   wasTargetSuccessful ( ) const;
  253.  
  254. IDMSrcOperationHandle
  255.   dragOperation ();
  256.  
  257. protected:
  258. private: /*------------------------ PRIVATE ----------------------------------*/
  259. IDMSrcOperationHandle
  260.   pDMSrcOpHandle;
  261. }; // IDMSourceEndEvent
  262.  
  263. class IDMSourceNotifyEvent : public IDMEvent {
  264. /*******************************************************************************
  265. * Events of this class are sent to the source window when the dragged objects  *
  266. * pass over a new potential target window.  The event essentially passes to    *
  267. * the source the result information returned by IDMTargetHandler::enter().     *
  268. *******************************************************************************/
  269. public:
  270. /*------------------------- Constructors/Destructor ----------------------------
  271. | Objects of this class are constructed from generic IEvent objects.           |
  272. ------------------------------------------------------------------------------*/
  273.   IDMSourceNotifyEvent ( IEvent &event );
  274.   ~IDMSourceNotifyEvent ( );
  275.  
  276. /*-------------------------------- Accessors -----------------------------------
  277. | These functions provide access to attributes of instances of this class:     |
  278. |   DropIndicator    - Enumeration of possible drop indicator values:          |
  279. |                        ok             - Drop permitted.                      |
  280. |                        notOk          - Not permitted at this location.      |
  281. |                        operationNotOk - Operation(s) not permitted.          |
  282. |                        neverOk        - Not permitted on this window.        |
  283. |   dropIndicator    - Returns target indicator of whether drop is permitted.  |
  284. |   defaultOperation - Returns default operation to be used by target.         |
  285. |   dragOperation    - Returns the source drag operation handle for this event.|
  286. ------------------------------------------------------------------------------*/
  287. enum DropIndicator
  288.   {
  289.   ok,
  290.   notOk,
  291.   operationNotOk,
  292.   neverOk
  293.   };
  294.  
  295. virtual DropIndicator
  296.   dropIndicator ( ) const;
  297.  
  298. virtual unsigned short
  299.   defaultOperation ( ) const;
  300.  
  301. IDMSrcOperationHandle
  302.   dragOperation ();
  303.  
  304. protected:
  305. private: /*------------------------ PRIVATE ----------------------------------*/
  306. IDMSrcOperationHandle
  307.   pDMSrcOpHandle;
  308. DropIndicator
  309.   dropInd;
  310. unsigned short
  311.   op;
  312. }; // IDMSourceNotifyEvent
  313.  
  314.  
  315. class IDMTargetEnterEvent : public IDMEvent {
  316. typedef IDMEvent
  317.   Inherited;
  318. /*******************************************************************************
  319. * Instances of this class encapsulate direct manipulation events that          *
  320. * occur at the target handler when a drag operation enters a potential         *
  321. * target window.  Target handlers access information about the dragged         *
  322. * items from the associated IDMTargetOperation object                          *
  323. *                                                                              *
  324. * The event result field is of particular importance for these event objects.  *
  325. * The result will indicate whether the dragged object(s) can be dropped on     *
  326. * this target, and if so, what the default operation would be.  This class     *
  327. * provides specialized functions to set the components of the event result.    *
  328. *******************************************************************************/
  329. public:
  330. /*------------------------- Constructors/Destructor ----------------------------
  331. | Objects of this class are constructed from generic IEvent objects.           |
  332. ------------------------------------------------------------------------------*/
  333.   IDMTargetEnterEvent     ( IEvent &event );
  334.  
  335.   ~IDMTargetEnterEvent    ( );
  336.  
  337. /*--------------------------------- Accessors ----------------------------------
  338. | These functions provide means of getting and setting the accessible          |
  339. | attributes of instances of this class:                                       |
  340. |   position      - Returns the pointing device position.                      |
  341. |   dragOperation - Returns handle of the target operation object for the      |
  342. |                   target enter event.                                        |
  343. ------------------------------------------------------------------------------*/
  344. virtual IPoint
  345.   position         ( ) const;
  346.  
  347. IDMTgtOperationHandle
  348.   dragOperation    ( ) const;
  349.  
  350. /*---------------------------------- Result ------------------------------------
  351. | These functions provide means of querying and setting the components of      |
  352. | the event result:                                                            |
  353. |   dropIndicator       - Returns indicator of whether drop is allowed.        |
  354. |   setDropIndicator    - Sets indicator of whether drop is allowed.           |
  355. |   defaultOperation    - Returns the default operation for this target.       |
  356. |   setDefaultOperation - Sets the default operation for this target.          |
  357. ------------------------------------------------------------------------------*/
  358. virtual IDMSourceNotifyEvent::DropIndicator
  359.   dropIndicator ( ) const;
  360.  
  361. virtual unsigned short
  362.   defaultOperation ( ) const;
  363.  
  364. IDMTargetEnterEvent
  365.  &setDropIndicator    ( IDMSourceNotifyEvent::DropIndicator indicator ),
  366.  &setDefaultOperation ( unsigned short operation );
  367.  
  368.  
  369. private: /*------------------------ PRIVATE ----------------------------------*/
  370. IDMTgtOperationHandle
  371.   pDMTgtOpHandle;
  372.  
  373. IPoint
  374.   pos;
  375.  
  376. IDMSourceNotifyEvent::DropIndicator
  377.   dropInd;
  378.  
  379. unsigned short
  380.   op;
  381.  
  382. }; // IDMTargetEnterEvent
  383.  
  384. class IDMUMTgtEnterEvent : public IDMEvent {
  385. typedef IDMEvent
  386.   Inherited;
  387. /*******************************************************************************
  388. * Instances of this class encapsulate direct manipulation events that          *
  389. * occur at the target handler when a drag operation enters a potential         *
  390. * target window.  Target handlers access information about the dragged         *
  391. * items from the associated IDMTargetOperation object                          *
  392. *                                                                              *
  393. * The event result field is of particular importance for these event objects.  *
  394. * The result will indicate whether the dragged object(s) can be dropped on     *
  395. * this target, and if so, what the default operation would be.  This class     *
  396. * provides specialized functions to set the components of the event result.    *
  397. *******************************************************************************/
  398. public:
  399. /*------------------------- Constructors/Destructor ----------------------------
  400. | Objects of this class are constructed from generic IEvent objects or         |
  401. | from an IDMTargetEnterEvent object.                                          |
  402. ------------------------------------------------------------------------------*/
  403.   IDMUMTgtEnterEvent     ( IEvent &event );
  404.  
  405.   ~IDMUMTgtEnterEvent    ( );
  406.  
  407. /*--------------------------------- Accessors ----------------------------------
  408. | These functions provide means of getting and setting the accessible          |
  409. | attributes of instances of this class:                                       |
  410. |   position      - Returns the pointing device position.                      |
  411. |   dragOperation - Returns handle of the target operation object for the      |
  412. |                   target enter event.                                        |
  413. ------------------------------------------------------------------------------*/
  414. virtual IPoint
  415.   position         ( ) const;
  416.  
  417. IDMTgtOperationHandle
  418.   dragOperation    ( ) const;
  419.  
  420. private: /*------------------------ PRIVATE ----------------------------------*/
  421. IDMTgtOperationHandle
  422.   pDMTgtOpHandle;
  423.  
  424. IPoint
  425.   pos;
  426.  
  427. }; // IDMUMTgtEnterEvent
  428.  
  429. class IDMTargetDropEvent : public IDMEvent {
  430. typedef IDMEvent
  431.   Inherited;
  432. /*******************************************************************************
  433. * Instances of this class encapsulate direct manipulation events that          *
  434. * occur at the target handler when a drop occurs on a target window.           *
  435. * Target handlers access information about the dragged items from the          *
  436. * stored IDMTargetOperation object that was created as part of the             *
  437. * IDMTargetEnterEvent processing.                                              *
  438. *******************************************************************************/
  439. public:
  440. /*------------------------- Constructors/Destructor ----------------------------
  441. | Objects of this class are constructed from generic IEvent objects.           |
  442. ------------------------------------------------------------------------------*/
  443.   IDMTargetDropEvent     ( IEvent &event );
  444.  
  445.   ~IDMTargetDropEvent    ( );
  446.  
  447. /*--------------------------------- Accessors ----------------------------------
  448. | This function provides means of getting and setting the accessible           |
  449. | attributes of instances of this class:                                       |
  450. |   dragOperation - Returns handle of the target operation object for the      |
  451. |                   target drop event.                                         |
  452. ------------------------------------------------------------------------------*/
  453. IDMTgtOperationHandle
  454.   dragOperation    ( ) const;
  455.  
  456. private: /*------------------------ PRIVATE ----------------------------------*/
  457. IDMTgtOperationHandle
  458.   pDMTgtOpHandle;
  459.  
  460. }; // IDMTargetDropEvent
  461.  
  462.  
  463. class IDMTargetEndEvent : public IDMSourceRenderEvent {
  464. typedef IDMEvent
  465.   Inherited;
  466. /*******************************************************************************
  467.   These events occur when the source window has completed rendering of a
  468.   given drag item.  The event provides information about the item rendered
  469.   (as per the IDMSourceRenderEvent processed by the source), plus, provides
  470.   result information provided by the source window.
  471. *******************************************************************************/
  472. public:
  473. /*------------------------- Constructors/Destructor ----------------------------
  474. | Objects of this class are constructed from generic IEvent objects.           |
  475. ------------------------------------------------------------------------------*/
  476.   IDMTargetEndEvent ( IEvent &event );
  477.   ~IDMTargetEndEvent ( );
  478.  
  479. /*---------------------------------- Result ------------------------------------
  480.   These functions provide access to rendering result information returned
  481.   by the source window:
  482.     renderingFailed -
  483.     targetCanRetry  -
  484. ------------------------------------------------------------------------------*/
  485. virtual Boolean
  486.   renderingFailed ( ) const,
  487.   targetCanRetry  ( ) const;
  488.  
  489. }; // IDMTargetEndEvent
  490.  
  491. #ifndef I_NO_INLINES
  492.   #include <idmevent.inl>
  493. #endif
  494.  
  495. #endif //_IDMEVENT_
  496.