home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / uicldd.zip / IDMPROV.HPP < prev    next >
Text File  |  1993-09-01  |  8KB  |  189 lines

  1. #ifndef _IDMPROV_
  2. #define _IDMPROV_
  3. /*******************************************************************************
  4. * FILE NAME: idmprov.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IDMItemProvider    - Base class used to provide drag items.              *
  9. *     IDMItemProviderFor - Template class used to provide drag items to a      *
  10. *                          source handler at commencement of a direct          *
  11. *                          manipulation operation and target handler           *
  12. *                          after a target drop event.                          *
  13. *                                                                              *
  14. * COPYRIGHT:                                                                   *
  15. *   Licensed Materials - Property of IBM                                       *
  16. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  17. *   All Rights Reserved                                                        *
  18. *   US Government Users Restricted Rights - Use, duplication, or               *
  19. *   disclosure                                                                 *
  20. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  21. *                                                                              *
  22. * $Log:   M:/ibmclass/idrag/vcs/idmprov.hpv  $
  23. //
  24. //   Rev 1.12   01 Sep 1993 10:36:58   banzai
  25. //Massage per container integration
  26. //
  27. //   Rev 1.11   30 Aug 1993 15:58:58   banzai
  28. //Prose changes
  29. //
  30. //   Rev 1.10   19 Aug 1993 10:57:10   banzai
  31. //Prose changes
  32. //
  33. //   Rev 1.9   18 Aug 1993 15:45:48   banzai
  34. //Make provideSourceItems virtual
  35. //
  36. //   Rev 1.8   12 Aug 1993 22:08:58   banzai
  37. //Use handles instead of refs for accurate count
  38. //
  39. //   Rev 1.7   12 Aug 1993 15:36:50   banzai
  40. //Cleanup compiler warnings
  41. //
  42. //   Rev 1.6   12 Aug 1993 13:53:10   banzai
  43. //Merge source and target item into one
  44. //
  45. //   Rev 1.5   10 Aug 1993 15:20:22   banzai
  46. //Make drag item provider into template
  47. //
  48. //   Rev 1.4   09 Aug 1993 14:59:36   banzai
  49. //Use template for target drag provider
  50. //
  51. //   Rev 1.3   26 Jul 1993 19:26:04   banzai
  52. //Design changes per prv/item/rndr
  53. //
  54. //   Rev 1.2   20 Jul 1993 10:47:02   banzai
  55. //Data acquisition design changes
  56. //
  57. //   Rev 1.1   12 Jul 1993 18:57:06   banzai
  58. //Drag provider changes
  59. //
  60. //   Rev 1.0   12 Jul 1993 12:14:30   banzai
  61. //New Tgt/Src drag item providers
  62. //
  63. *******************************************************************************/
  64. #ifndef _IVBASE_
  65.   #include <ivbase.hpp>
  66. #endif
  67.  
  68. /* Forward declarations */
  69. struct _DRAGITEM;
  70. class IDMSrcOperationHandle;
  71. class IDMItemHandle;
  72.  
  73.  
  74. class IDMItemProvider : public IVBase {
  75. typedef IVBase
  76.   Inherited;
  77. /*******************************************************************************
  78.   BUGBUG - rewrite the commentary per latest round of changes
  79.  
  80.   Objects of this class have one purpose: they provide an IDMSourceOperation
  81.   object with the items to be dragged when a direct manipulation operation
  82.   begins.  A pointer to an object derived from this class must be provided
  83.   when an IDMSourceHandler is constructed.
  84.  
  85.   When the source handler detects that a direct manipulation operation is
  86.   being initiated from one of its windows, it will call the provideSourceItems
  87.   function of the derived class, passing the IDMSourceOperation object (via a
  88.   handle to it).  The class derived from IDMSourceProvider simply creates
  89.   IDMItem derived objects to represent the items to be dragged from the
  90.   source window and adds these to the IDMSourceOperation object.
  91.  
  92.   This class is an abstract base class.  Derived classes must implement the
  93.   provideSourceItems function in an application (or control) specific manner.
  94. *******************************************************************************/
  95. public:
  96. /*------------------------- Constructors/Destructor ----------------------------
  97. | Objects of this class are constructed in the following manner:               |
  98. ------------------------------------------------------------------------------*/
  99.   IDMItemProvider ( );
  100.  
  101. virtual
  102.   ~IDMItemProvider ( );
  103.  
  104. /*--------------------------- Drag Item Provision ------------------------------
  105.   provideSourceItems   - Called to give provider opportunity to attach derived
  106.                          IDMItems to the argument IDMSourceOperation
  107.                          object.  This function is called when a drag operation
  108.                          commences over a control object.  Returns true if
  109.                          items were provided, false otherwise.
  110.   provideTargetItemFor - Called to give provider opportunity to replace generic
  111.                          IDMItems with a derived class.  This function
  112.                          is called when a drop occurs on a target window.
  113. ------------------------------------------------------------------------------*/
  114. virtual Boolean
  115.   provideSourceItems   ( const IDMSrcOperationHandle &sourceOperation );
  116.  
  117. virtual IDMItemHandle
  118.   provideTargetItemFor ( const IDMItemHandle &dragItem );
  119.  
  120. protected:
  121.  
  122. private: /*------------------------ PRIVATE ----------------------------------*/
  123. }; // class IDMItemProvider
  124.  
  125.  
  126. template < class T >
  127. class IDMItemProviderFor : public IDMItemProvider {
  128. typedef IDMItemProvider
  129.   Inherited;
  130. /*******************************************************************************
  131.   BUGBUG - rewrite the commentary per latest round of changes
  132.  
  133.   Objects of this class have one purpose: they provide an IDMSourceOperation
  134.   object with the items to be dragged when a direct manipulation operation
  135.   begins.  A pointer to an object derived from this class must be provided
  136.   when an IDMSourceHandler is constructed.
  137.  
  138.   When the source handler detects that a direct manipulation operation is
  139.   being initiated from one of its windows, it will call the provideSourceItems
  140.   function of the derived class, passing the IDMSourceOperation object (via a
  141.   handle to it).  The class derived from IDMSourceProvider simply creates
  142.   IDMItem derived objects to represent the items to be dragged from the
  143.   source window and adds these to the IDMSourceOperation object.
  144.  
  145.   This class is an abstract base class.  Derived classes must implement the
  146.   provideSourceItems function in an application (or control) specific manner.
  147. *******************************************************************************/
  148. public:
  149. /*------------------------- Constructors/Destructor ----------------------------
  150. | Objects of this class are constructed in the following manner:               |
  151. ------------------------------------------------------------------------------*/
  152.   IDMItemProviderFor ( ) {}
  153.  
  154. virtual
  155.   ~IDMItemProviderFor ( ) {}
  156.  
  157.  
  158. /*--------------------------- Drag Item Provision ------------------------------
  159.   provideSourceItems   - Defines template that provider uses to attach derived
  160.                          IDMItems to the argument IDMSourceOperation
  161.                          object.  This function is called when a drag operation
  162.                          commences over a control object.  Returns true if
  163.                          items were provided, false otherwise.
  164.   provideTargetItemFor - Defines template that provider uses to replace generic
  165.                          IDMItems with a derived class.  This function
  166.                          is called when a drop occurs on a target window.
  167. ------------------------------------------------------------------------------*/
  168. virtual Boolean
  169.   provideSourceItems   ( const IDMSrcOperationHandle &sourceOperation )
  170. {
  171.  
  172.   return( T::generateSourceItems( sourceOperation ) );
  173. }
  174.  
  175. virtual IDMItemHandle
  176.   provideTargetItemFor ( const IDMItemHandle &dragItem )
  177. {
  178.  
  179.   return( (IDMItemHandle)new T( *dragItem ) );
  180. }
  181.  
  182.  
  183. protected:
  184.  
  185. private: /*------------------------ PRIVATE ----------------------------------*/
  186. }; // class IDMItemProviderFor
  187.  
  188. #endif //_IDMPROV_
  189.