home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cluidm.zip / idmitem.hpp < prev    next >
Text File  |  1993-04-30  |  46KB  |  874 lines

  1. #ifndef _IDMITEM_
  2. #define _IDMITEM_
  3. /*******************************************************************************
  4.   FILE NAME: idrgitem.hpp
  5.  
  6.   DESCRIPTION:
  7.     This file contains the declaration(s) of the class(es):
  8.       IDMItem                   - Base direct manipulation "item" class.
  9.       IDMSourceItem             - Source direct manipulation "item" class.
  10.       IDMSrcItemHandle          - Handle to manage references to IDMSourceItem
  11.                                   objects.
  12.       IDMTargetItem             - Target direct manipulation "item" class.
  13.       IDMTgtItemHandle          - Handle to manage references to IDMTargetItem
  14.                                   objects.
  15.       IDMRendererAssociate      - Base direct manipulation renderer association
  16.                                   class.
  17.       IDMSrcRendererAssoc       - Source direct manipulation renderer
  18.                                   association class.
  19.       IDMSrcRendererAssocHandle - Handle to manage references to
  20.                                   IDMSrcRendererAssoc objects.
  21.       IDMTgtRendererAssoc       - Target direct manipulation renderer
  22.                                   association class.
  23.       IDMTgtRendererAssocHandle - Handle to manage references to
  24.                                   IDMTgtRendererAssoc objects.
  25.       IDMSrcRendererAssocSeq    - Sequence of IDMSrcRendererAssoc objects.
  26.       IDMTgtRendererAssocSeq    - Sequence of IDMTgtRendererAssoc objects.
  27.  
  28.   COPYRIGHT:
  29.     Licensed Materials - Property of IBM
  30.     (C) Copyright IBM Corporation 1992, 1993
  31.     All Rights Reserved
  32.     US Government Users Restricted Rights - Use, duplication, or
  33.     disclosure
  34.     restricted by GSA ADP Schedule Contract with IBM Corp.
  35.  
  36. * $Log:   S:/ibmclass/idrag/vcs/idmitem.hpv  $
  37. //
  38. //   Rev 1.1   30 Apr 1993 11:45:28   HAGGAR
  39. //
  40. //   Rev 1.0   22 Apr 1993 10:41:06   HAGGAR
  41. //Initial revision.
  42. *******************************************************************************/
  43. #ifndef _IREFCNT_
  44.   #include <irefcnt.hpp>
  45. #endif
  46.  
  47. #ifndef _ISEQ_H
  48.   #include <iseq.h>
  49. #endif
  50.  
  51. #ifndef _IDMSRCOP_
  52.   #include <idmsrcop.hpp>
  53. #endif
  54.  
  55. #ifndef _IDMTGTOP_
  56.   #include <idmtgtop.hpp>
  57. #endif
  58.  
  59. #ifndef _IDMRENDR_
  60.   #include <idmrendr.hpp>
  61. #endif
  62.  
  63. #ifndef _ISTRING_
  64.   #include <istring.hpp>
  65. #endif
  66.  
  67. /* Forward Declarations */
  68. struct _DRAGITEM;
  69. class IDMSrcRendererAssoc;
  70. class IDMTgtRendererAssoc;
  71. class IDMSourceRenderEvent;
  72. class IDMSourcePrepareEvent;
  73. class IDMTargetRenderEvent;
  74. class IDMSrcRndrAssocHandle;
  75. class IDMTgtRndrAssocHandle;
  76.  
  77. class IDMSrcRendererAssocSeq : public ISequence< IDMSrcRendererAssoc* > {
  78. /*******************************************************************************
  79.   This class is just a wrapper for a sequence of IDMSrcRendererAssoc's.  It
  80.   is used to add a level of indirection in the IDMSourceItem interface.
  81. *******************************************************************************/
  82. }; // class IDMSrcRendererAssocSeq
  83.  
  84. class IDMTgtRendererAssocSeq : public ISequence< IDMTgtRendererAssoc* > {
  85. /*******************************************************************************
  86.   This class is just a wrapper for a sequence of IDMTgtRendererAssoc's.  It
  87.   is used to add a level of indirection in the IDMTargetItem interface.
  88. *******************************************************************************/
  89. }; // class IDMTgtRendererAssocSeq
  90.  
  91. class IDMItem : public IRefCounted {
  92. typedef IRefCounted
  93.   Inherited;
  94. /*******************************************************************************
  95. * This is the common base class for the direct manipulation source and target  *
  96. * drag item classes.                                                           *
  97. *                                                                              *
  98. * This base class provides the common support required to represent objects    *
  99. * that are dragged/dropped during a direct manipulation operation.  The        *
  100. * derived classes, IDMSourceDragItem and IDMTargetDragItem, are declared       *
  101. * below.                                                                       *
  102. *                                                                              *
  103. * Objects of this class possess the following attributes (in addition to       *
  104. * those inherited from its base class):                                        *
  105. *   o source window handle                                                     *
  106. *   o types ("true" and additional) of the dragged object                      *
  107. *   o container name (at the source)                                           *
  108. *   o source name                                                              *
  109. *   o suggested target name                                                    *
  110. *   o relative position of the corresponding object image in the drag pointer  *
  111. *   o source flags providing instructions as to how the object is to be        *
  112. *     rendered, etc.                                                           *
  113. *******************************************************************************/
  114. public:
  115.  
  116. /*----------------------  Supported Operations Flags  --------------------------
  117.   The following static members define a drag object's supported
  118.   operations flags:
  119.  
  120.   The valid supported operations are:
  121.     unknown   - No supported drag operations are available.
  122.     copyable  - The source object that is being dragged can be copied to
  123.                 the specified drop location.
  124.     moveable  - The source object that is being dragged can be moved to
  125.                 the specified drop location.
  126.     linkable  - The source object that is being dragged can be linked to
  127.                 the specified object.
  128.  
  129.   Note:  These static members represent bit masks.  User defined values
  130.          must be greater than linkable.
  131. ------------------------------------------------------------------------------*/
  132. static const unsigned short
  133.   unknown,
  134.   copyable,
  135.   moveable,
  136.   linkable;
  137.  
  138. /*----------------------------  Attributes Flags  ------------------------------
  139.   The following static members define the drag object's attribute flags:
  140.  
  141.   The valid attributes of dragged objects are:
  142.     none             - No attributes are defined.
  143.     open             - Source object is open
  144.     reference        - Source object is a reference to another object
  145.     group            - Source object is a group of objects
  146.     container        - Source object is a container of other objects
  147.     prepare          - Source object requires preparation before it
  148.                          establishes a data transfer conversation
  149.     removableMedia   - Source object is on removable media, or source object
  150.                          cannot be recovered after a move operation
  151.  
  152.   Note:  These static members represent bit masks.  User defined values
  153.          must be greater than removableMedia.
  154. ----------------------------------------------------------------------------*/
  155. static const unsigned short
  156.   none,
  157.   open,
  158.   reference,
  159.   group,
  160.   container,
  161.   prepare,
  162.   removableMedia;
  163.  
  164. /*-------------------------------- Accessors -----------------------------------
  165. | These functions provide access to attributes of instances of this class:     |
  166. |   sourceWindow         - Returns handle of the source window for this item.  |
  167. |   containerName        - Returns the source container name.                  |
  168. |   sourceName           - Returns the source object "name."                   |
  169. |   targetName           - Returns the suggested target object "name."         |
  170. |   attributes           - Returns the control attributes for this item.       |
  171. |   supportedOperations  - Returns the operations supported by this item       |
  172. |   origin               - Returns the item's origin offset from pointer       |
  173. |                           hotspot.                                           |
  174. |   dragImage            - Returns the drag image for this item, or 0 if none. |
  175. ------------------------------------------------------------------------------*/
  176. IWindowHandle
  177.   sourceWindow           ( ) const;
  178.  
  179. IString
  180.   containerName          ( ) const,
  181.   sourceName             ( ) const,
  182.   targetName             ( ) const;
  183.  
  184. unsigned short
  185.   attributes             ( ) const;
  186.  
  187. unsigned short
  188.   supportedOperations    ( ) const;
  189.  
  190. ISize
  191.   origin                 ( ) const;
  192.  
  193. //pfh virtual IDMImageHandle
  194. //pfh   dragImage              ( ) const;
  195.  
  196. /*-------------------------------- Attributes ----------------------------------
  197. | These functions permit the testing of a variety of drag item "attribute"     |
  198. | flags:                                                                       |
  199. |   isOpen                 - Indicates whether the dragged object is "open."   |
  200. |   isReference            - Indicates whether the dragged object is a         |
  201. |                            "reference" to another object.                    |
  202. |   isGroup                - Indicates whether the item is a group of objecgs. |
  203. |   isContainer            - Indicates whether the item is a container of other|
  204. |                            objects.                                          |
  205. |   isOnRemovableMedia     - Indicates whether the item is on removable media  |
  206. |                            or cannot be recovered after a move operation.    |
  207. |   requiresPreparation    - Indicates whether the source requires preparation |
  208. |                            prior to rendering.                               |
  209. ------------------------------------------------------------------------------*/
  210. virtual Boolean
  211.   isOpen                    ( ) const,
  212.   isReference               ( ) const,
  213.   isGroup                   ( ) const,
  214.   isContainer               ( ) const,
  215.   isOnRemovableMedia        ( ) const,
  216.   requiresPreparation       ( ) const;
  217.  
  218. /*-------------------------------- Operations ----------------------------------
  219. | These functions permit the querying of the supported direct manipulation     |
  220. | operations for the drag item:                                                |
  221. |   canBeCopied  - Indicates whether a copy operation is supported.            |
  222. |   canBeLinked  - Indicates whether a link operation is supported.            |
  223. |   canBeMoved   - Indicates whether a move operation is supported.            |
  224. ------------------------------------------------------------------------------*/
  225. virtual Boolean
  226.   canBeCopied    ( ) const,
  227.   canBeLinked    ( ) const,
  228.   canBeMoved     ( ) const;
  229.  
  230. /*------------------------------- Object Type ----------------------------------
  231. | These functions provide means for querying the "type" of the item:           |
  232. |   trueType  - Returns the "true type" of the item.                           |
  233. |   types     - Returns all types for the item.                                |
  234. |   hasType   - Indicates whether the item supports an argument type.          |
  235. ------------------------------------------------------------------------------*/
  236. virtual IString
  237.   trueType          ( ) const,
  238.   types             ( ) const;
  239.  
  240. virtual Boolean
  241.   hasType           ( const IString &aType ) const;
  242.  
  243. /*-----------------------  Rendering Mechanisms/Formats  -----------------------
  244. | These functions provide means for querying the rendering mechanism and/or    |
  245. | format of the item:                                                          |
  246. |   nativeSourceRMF - Returns the "native" rendering mechanism and format of   |
  247. |                      the item.                                               |
  248. |   nativeSourceRM  - Returns the "native" rendering mechanism of the item.    |
  249. |   nativeSourceRF  - Returns the "native" rendering format of the item.       |
  250. |   sourceRMFs      - Returns all rendering mechanisms and formats of the item.|
  251. |   hasRMF          - Indicates whether the item supports a specific rendering |
  252. |                      mechanism and format.                                   |
  253. ------------------------------------------------------------------------------*/
  254. virtual IString
  255.   nativeSourceRMF    ( ) const,
  256.   nativeSourceRM     ( ) const,
  257.   nativeSourceRF     ( ) const,
  258.   sourceRMFs         ( ) const;
  259.  
  260. virtual Boolean
  261.   hasRMF       ( const IString &aType );
  262.  
  263. //pfh moved from protected to public since I need them in IDMSourceOperation.
  264. /*--------------------------- Source Accessors ---------------------------------
  265. | These functions allow the setting of attributes for instances of the source  |
  266. | drag item class, IDMSourceItem, which is derived from this class:            |
  267. |   setSourceWindow      - Sets the source window for this item.               |
  268. |   setContainerName     - Sets the source container name.                     |
  269. |   setTargetName        - Sets the suggested target object "name."            |
  270. |   setSourceName        - Sets the source object "name."                      |
  271. |   setOrigin            - Sets this item's origin offset from the pointer     |
  272. |                           hotspot.                                           |
  273. ------------------------------------------------------------------------------*/
  274. IDMItem
  275.  &setSourceWindow        ( IWindowHandle window ),
  276.  &setContainerName       ( const char* containerName ),
  277.  &setTargetName          ( const char* targetName ),
  278.  &setSourceName          ( const char* sourceName ),
  279.  &setOrigin              ( const ISize& origin );
  280.  
  281. //pfh moved from protected to public since I need them in IDMSourceOperation.
  282. /*-----------------------  Rendering Mechanisms/Formats  -----------------------
  283. | These functions provide means for setting the "RMF" of the source drag       |
  284. | item:                                                                        |
  285. |   addRMF - Adds an additional RMF (or RMFs).                                 |
  286. ------------------------------------------------------------------------------*/
  287. virtual IDMItem
  288.  &addRMF            ( const IString &aRMF );
  289.  
  290. protected:
  291. /*----------------------------- Constructor ------------------------------------
  292. | Generic objects of this class are constructed in the following manner:       |
  293. |   o By providing the types, supported operations and attributes.             |
  294. ------------------------------------------------------------------------------*/
  295.   IDMItem     ( const IString &types,
  296.                 const unsigned short supportedOperations = unknown,
  297.                 const unsigned short attributes = none);
  298.  
  299. /*--------------------------- Source Accessors ---------------------------------
  300. | These functions allow the setting of attributes for instances of the source  |
  301. | drag item class, IDMSourceItem, which is derived from this class:            |
  302. |   setDragImage         - Sets or removes this item's drag image              |
  303. ------------------------------------------------------------------------------*/
  304. //pfh IDMItem
  305. //pfh &setDragImage           ( IDMImageHandle image,
  306. //pfh                           Boolean        autoDelete = true);
  307.  
  308. /*--------------------------- Source Attributes --------------------------------
  309. | These functions permit the setting of a variety of source drag item          |
  310. | "attribute" flags:                                                           |
  311. |   setOpen                - Set/reset the "isOpen" flag.                      |
  312. |   setReference           - Set/reset the "isReference" flag.                 |
  313. |   setGroup               - Set/reset the "isGroup" flag.                     |
  314. |   setContainer           - Set/reset the "isContainer" flag.                 |
  315. |   setOnRemovableMedia    - Set/reset the "isOnRemovableMedia" flag.          |
  316. |   setRequiresPreparation - Set/reset the "requiresPreparation" flag.         |
  317. ------------------------------------------------------------------------------*/
  318. virtual IDMItem
  319.  &setOpen                   ( Boolean open             = true ),
  320.  &setReference              ( Boolean reference        = true ),
  321.  &setGroup                  ( Boolean group            = true ),
  322.  &setContainer              ( Boolean container        = true ),
  323.  &setOnRemovableMedia       ( Boolean onRemovableMedia = true ),
  324.  &setRequiresPreparation    ( Boolean requiresPrep     = true );
  325.  
  326. /*--------------------------- Source Operations --------------------------------
  327. | These functions permit the setting of the supported direct manipulation      |
  328. | operations for the source drag item:                                         |
  329. |   enableCopy    - Enables or disables copy operation for the item.           |
  330. |   enableLink    - Enables or disables link operation for the item.           |
  331. |   enableMove    - Enables or disables move operation for the item.           |
  332. ------------------------------------------------------------------------------*/
  333. virtual IDMItem
  334.  &enableCopy       ( Boolean copyable = true ),
  335.  &enableLink       ( Boolean linkable = true ),
  336.  &enableMove       ( Boolean moveable = true );
  337.  
  338. /*-------------------------- Source Object Type --------------------------------
  339. | These functions provide means for setting the "type" of the source drag      |
  340. | item:                                                                        |
  341. |   setTrueType     - Sets the "true type" to the argument type.               |
  342. |   addType         - Adds an additional type (or types).                      |
  343. |   removeType      - Removes a type from this item.                           |
  344. |   replaceType     - Replaces a type for this item.                           |
  345. ------------------------------------------------------------------------------*/
  346. virtual IDMItem
  347.  &setTrueType       ( const IString &aType ),
  348.  &addType           ( const IString &aType ),
  349.  &removeType        ( const IString &aType ),
  350.  &replaceType       ( const IString &oldType, const IString &newType );
  351.  
  352. /*-----------------------  Rendering Mechanisms/Formats  -----------------------
  353. | These functions provide means for setting the "RMF" of the source drag       |
  354. | item:                                                                        |
  355. |   setNativeRMF    - Sets the "native RMF to the argument type.               |
  356. |   removeRMF       - Removes a RMF from this item.                            |
  357. |   replaceRMF      - Replaces a RMF for this item.                            |
  358. ------------------------------------------------------------------------------*/
  359. virtual IDMItem
  360.  &setNativeRMF      ( const IString &aRMF ),
  361.  &removeRMF         ( const IString &aRMF ),
  362.  &replaceRMF        ( const IString &oldRMF, const IString &newRMF );
  363.  
  364.  
  365. private: /*------------------------ PRIVATE ----------------------------------*/
  366.  
  367. unsigned short
  368.   dragSupOps,
  369.   dragAttrs;
  370.  
  371. IWindowHandle
  372.   sourceWndh;
  373.  
  374. //pfhIDMImageHandle
  375. //pfh  pDragImage;
  376.  
  377. Boolean
  378.   bAutoDelImage;
  379.  
  380. ISize
  381.   sizeOrigin;
  382.  
  383. IString
  384.   strContainerName,
  385.   strSourceName,
  386.   strTargetName,
  387.   strTypes,
  388.   strRMFs;
  389.  
  390. }; // IDMItem
  391.  
  392.  
  393. //class IDMItemHandle : public IReference< IDMItem > {
  394. /*******************************************************************************
  395. * Objects of this common base class provide access to generic IDMItem objects. *
  396. * This "handle" class manages references to the IDMItem object to ensure that  *
  397. * it is not deleted until the drag operation is completed.                     *
  398. *                                                                              *
  399. * This class provides a "->" operator that enables instances to be treated     *
  400. * just like a pointer to an IDMItem object.                                    *
  401. *                                                                              *
  402. * This class has no members.  It is essentially a synonym for the type         *
  403. * IReference< IDMItem >.                                                       *
  404. *******************************************************************************/
  405. //public:
  406. //  IDMItemHandle (IDMItem *pIDMItem);
  407. //  ~IDMItemHandle ( );
  408.  
  409. /*--------------------------------- Operators ---------------------------------+
  410. | Operators defined for IDMItemHandle:                                         |
  411. |   == - Overload definition to handle comparisons of base drag item handles.  |
  412. |   <  - Overload definition to handle comparisons of base drag item handles.  |
  413. +-----------------------------------------------------------------------------*/
  414. //Boolean
  415. //  operator ==    ( const IDMItemHandle &item ) const,
  416. //  operator <     ( const IDMItemHandle &item ) const;
  417.  
  418. //}; // IDMItemHandle
  419.  
  420.  
  421. class IDMSourceItem : public IDMItem {
  422. typedef IDMItem
  423.   Inherited;
  424. /*******************************************************************************
  425. * Objects of this class are created by windows when a direct manipulation      *
  426. * operation commences on the source side.                                      *
  427. *                                                                              *
  428. * Objects of this class possess the following attributes (in addition to       *
  429. * those inherited from its base class):                                        *
  430. *   o association with a source drag operation object (see                     *
  431. *     IDMSourceOperation)                                                      *
  432. *   o association(s) with source drag renderer object(s) (see                  *
  433. *     IDMSourceRenderer) which are created by the source handler (see          *
  434. *     IDMSourceHandler)                                                        *
  435. *                                                                              *
  436. * This class provides virtual functions that implement the source rendering    *
  437. * of the dragged/dropped objects.  Derived classes are created to support      *
  438. * additional rendering mechanisms and/or formats.  The IDMSourceItem           *
  439. * class supports, in conjunction with the standard library IWindow subclasses, *
  440. * rendering with all the standard system rendering mechanisms whenever such    *
  441. * rendering makes sense.                                                       *
  442. *******************************************************************************/
  443. friend class IDMSourceOperation;
  444.  
  445. public:
  446. /*-------------------------------- Rendering -----------------------------------
  447. | These functions are called during the course of "rendering" the drag item:   |
  448. |   render                 - Transfer the item from source to target.          |
  449. |   prepareToRender        - Notify source that rendering will commence.       |
  450. |   notifyRenderCompletion - Notify source/target that rendering is complete.  |
  451. |                                                                              |
  452. |   Bill - move to source renderer ...                                         |
  453. ------------------------------------------------------------------------------*/
  454. virtual IDMSourceItem
  455.  &render                    ( const IDMSourceRenderEvent &renderEvent ),
  456.  &prepareToRender           ( const IDMSourcePrepareEvent &prepareEvent ),
  457.  ¬ifyRenderCompletion    ( const IDMSourceRenderEvent &renderEvent);
  458.  
  459. /*-------------------------------- Accessors -----------------------------------
  460. | These functions provide access to attributes of instances of this class:     |
  461. |   dragOperation        - Returns a handle to the "owning" IDMSourceOperation |
  462. |                           object.                                            |
  463. |   rendererAssociations - Used to access the rendering mechanism and format,  |
  464. |                           and type associations for this item.               |
  465. ------------------------------------------------------------------------------*/
  466. IDMSrcOperationHandle
  467.   dragOperation           ( ) const;
  468.  
  469. IDMSrcRendererAssocSeq
  470.   &rendererAssociations    ( );
  471.  
  472. /*------------------------- Constructors/Destructor ----------------------------
  473. | Objects of this class are constructed in the following manner:               |
  474. |   o By providing the drag source operation handle, types, supported          |
  475. |     operations and attributes.                                               |
  476. ------------------------------------------------------------------------------*/
  477.   IDMSourceItem     ( const IDMSrcOperationHandle sourceOperation,
  478.                       const IString &types,
  479.                       const unsigned short supportedOperations = unknown,
  480.                       const unsigned short attributes = none);
  481.  
  482. virtual
  483.   ~IDMSourceItem    ( );
  484.  
  485. protected:
  486. /*------------------------------ Implementation --------------------------------
  487.  
  488. ------------------------------------------------------------------------------*/
  489.  
  490. private: /*------------------------ PRIVATE ----------------------------------*/
  491.  
  492. //IString
  493. //  stringFromHandle        (const IStringHandle& hstr);
  494.  
  495. void
  496.   asPMDragItem  ( _DRAGITEM *pDragItem );
  497.  
  498. IDMSrcOperationHandle
  499.   pDMSrcOperation;
  500.  
  501. IDMSrcRendererAssocSeq
  502.   pSrcRendAssocSeqCl;
  503.  
  504. }; // IDMSourceItem
  505.  
  506.  
  507. class IDMSrcItemHandle : public IReference< IDMSourceItem > {
  508. /*******************************************************************************
  509. * Objects of this class provide access to IDMSourceItem objects                *
  510. * associated with a direct manipulation event.  This "handle" class manages    *
  511. * references to the IDMSourceItem object to ensure that it is not              *
  512. * deleted until the drag operation is completed.                               *
  513. *                                                                              *
  514. * This class provides a "->" operator that enables instances to be treated     *
  515. * just like a pointer to an IDMSourceItem object.                              *
  516. *                                                                              *
  517. * Example:                                                                     *
  518. *   // IDMSrcOperationHandle providing access to the source drag operation...  *
  519. *   IDMSrcOperationHandle                                                      *
  520. *     srcOperation;                                                            *
  521. *                                                                              *
  522. *   // Process items...                                                        *
  523. *   for( int i = 0; i < srcOperation->numberOfItems(); i++ )                   *
  524. *     {                                                                        *
  525. *     IDMSrcItemHandle                                                         *
  526. *       item = srcOperation->item( i );                                        *
  527. *     // If item is C code, then this handler can accept it...                 *
  528. *     if ( item->trueType() == IDragItem::cCode )                              *
  529. *       // Note: The following line is tentative and should be amended         *
  530. *       //       per the actual drag item protocol when it is completed.       *
  531. *       item -> enableDrop();                                                  *
  532. *     }                                                                        *
  533. *                                                                              *
  534. * This class has no members.  It is essentially a synonym for the type         *
  535. * IReference< IDMSourceItem >.                                                 *
  536. *******************************************************************************/
  537. public:
  538.   IDMSrcItemHandle (IDMSourceItem *pIDMSrcItem);
  539.   ~IDMSrcItemHandle ( );
  540.  
  541. /*--------------------------------- Operators ---------------------------------+
  542. | Operators defined for IDMSrcItemHandle:                                      |
  543. |   == - Overload definition to handle comparisons of source drag item handles.|
  544. |   <  - Overload definition to handle comparisons of source drag item handles.|
  545. +-----------------------------------------------------------------------------*/
  546. Boolean
  547.   operator ==    ( const IDMSrcItemHandle &sourceItem ) const,
  548.   operator <     ( const IDMSrcItemHandle &sourceItem ) const;
  549.  
  550. }; // IDMSrcItemHandle
  551.  
  552.  
  553. class IDMTargetItem : private IDMItem {
  554. typedef IDMItem
  555.   Inherited;
  556. /*******************************************************************************
  557. * Objects of this class are created by windows during a direct manipulation    *
  558. * operation when the objects are dragged over or dropped on a target window.   *
  559. *                                                                              *
  560. * Objects of this class possess the following attributes (in addition to       *
  561. * those inherited from its base class):                                        *
  562. *   o association with a target drag operation object (see                     *
  563. *     IDMTargetOperation)                                                      *
  564. *   o association(s) with target drag renderer object(s) (see                  *
  565. *     IDMTargetRenderer) which are created by the target handler (see          *
  566. *     IDMTargetHandler)                                                        *
  567. *                                                                              *
  568. * This class provides virtual functions that implement the target rendering    *
  569. * of the dragged/dropped objects.  Derived classes are created to support      *
  570. * additional rendering mechanisms and/or formats.  The IDMTargetItem           *
  571. * class supports, in conjunction with the standard library IWindow subclasses, *
  572. * rendering with all the standard system rendering mechanisms whenever such    *
  573. * rendering makes sense.                                                       *
  574. *******************************************************************************/
  575. public:
  576. friend class IDMTgtOperationHandle;
  577. friend class IDMTargetRenderer;
  578.  
  579. /*-------------------------------- Promotions ----------------------------------
  580. | The following functions are inherited as private functions from IDMItem.     |
  581. | They are promoted to make them publicly accessible.                          |
  582. |   sourceWindow         - Returns handle of the source window for this item.  |
  583. |   containerName        - Returns the source container name.                  |
  584. |   sourceName           - Returns the source object "name."                   |
  585. |   targetName           - Returns the suggested target object "name."         |
  586. |   attributes           - Returns the control attributes for this item.       |
  587. |   supportedOperations  - Returns the operations supported by this item       |
  588. |   origin               - Returns the item's origin offset from pointer       |
  589. |                           hotspot.                                           |
  590. |   dragImage            - Returns the drag image for this item, or 0 if none. |
  591. |   isOpen               - Indicates whether the dragged object is "open."     |
  592. |   isReference          - Indicates whether the dragged object is a           |
  593. |                          "reference" to another object.                      |
  594. |   isGroup              - Indicates whether the item is a group of objecgs.   |
  595. |   isContainer          - Indicates whether the item is a container of other  |
  596. |                          objects.                                            |
  597. |   isOnRemovableMedia   - Indicates whether the item is on removable media    |
  598. |                          or cannot be recovered after a move operation.      |
  599. |   requiresPreparation  - Indicates whether the soure requires preparation    |
  600. |                          prior to rendering.                                 |
  601. |   canBeCopied          - Indicates whether a copy operation is supported.    |
  602. |   canBeLinked          - Indicates whether a link operation is supported.    |
  603. |   canBeMoved           - Indicates whether a move operation is supported.    |
  604. |   trueType             - Returns the "true type" of the item.                |
  605. |   types                - Returns all types for the item.                     |
  606. |   hasType              - Indicates whether the item supports an argument     |
  607. |                          type.                                               |
  608. |   nativeRMF            - Returns the "native" rendering mechanism and format |
  609. |                          of the item.                                        |
  610. |   nativeRM             - Returns the "native" rendering mechanism of the     |
  611. |                          item.                                               |
  612. |   nativeRF             - Returns the "native" rendering format of the item.  |
  613. |   RMFs                 - Returns all rendering mechanisms and formats of     |
  614. |                          the item.                                           |
  615. |   hasRMF               - Indicates whether the item supports a specific      |
  616. |                          rendering mechanism and format.                     |
  617. |   addRef               - used by the template class.                         |
  618. |   removeRef            - used by the template class.                         |
  619. ------------------------------------------------------------------------------*/
  620.   IDMItem::sourceWindow;
  621.   IDMItem::containerName;
  622.   IDMItem::sourceName;
  623.   IDMItem::targetName;
  624.   IDMItem::attributes;
  625.   IDMItem::supportedOperations;
  626.   IDMItem::origin;
  627.   IDMItem::isOpen;
  628.   IDMItem::isReference;
  629.   IDMItem::isGroup;
  630.   IDMItem::isContainer;
  631.   IDMItem::isOnRemovableMedia;
  632.   IDMItem::requiresPreparation;
  633.   IDMItem::canBeCopied;
  634.   IDMItem::canBeLinked;
  635.   IDMItem::canBeMoved;
  636.   IDMItem::trueType;
  637.   IDMItem::types;
  638.   IDMItem::hasType;
  639.   IDMItem::hasRMF;
  640.   IDMItem::addRef;
  641.   IDMItem::removeRef;
  642.   IDMItem::sourceRMFs;
  643.  
  644. /*--------------------------  Target Rendering  --------------------------------
  645. | These functions are called during the course of "rendering" the drag item:   |
  646. |   render                 - Allow target to render the item.                  |
  647. |   notifyRenderCompletion - Notify target that rendering is complete. (???)   |
  648. ------------------------------------------------------------------------------*/
  649. virtual IDMTargetItem
  650.  &render                    ( const IDMTargetRenderEvent &renderEvent ),
  651.  ¬ifyRenderCompletion    ( );
  652.  
  653. /*-------------------------------- Accessors -----------------------------------
  654. | These functions provide access to attributes of instances of this class:     |
  655. |   dragOperation        - Returns a handle to the "owning" IDMTargetOperation |
  656. |                           object.                                            |
  657. |   rendererAssociations - Used to access the rendering mechanism and format,  |
  658. |                           and type associations for this item.               |
  659. ------------------------------------------------------------------------------*/
  660. IDMTgtOperationHandle
  661.   dragOperation           ( ) const;
  662.  
  663. virtual IDMTgtRendererAssocSeq
  664.  &rendererAssociations    ( );
  665.  
  666. //pfh moved to make public
  667. /*------------------------- Constructors/Destructor ----------------------------
  668. | Objects of this class are constructed in the following manner:               |
  669. |   o By providing a pointer to a DRAGITEM structure                           |
  670. ------------------------------------------------------------------------------*/
  671.   IDMTargetItem     ( _DRAGITEM *pDragItem );
  672.  
  673. virtual
  674.   ~IDMTargetItem    ( );
  675.  
  676. protected:
  677. private: /*------------------------ PRIVATE ----------------------------------*/
  678.  
  679. void
  680.   asPMDragItem  ( _DRAGITEM *pDragItem );
  681.  
  682. //IString
  683. //  stringFromHandle  (const IStringHandle& hstr);
  684.  
  685. _DRAGITEM
  686.  *PMDragItem  ( );
  687.  
  688. _DRAGITEM
  689.  *pPMDragItem;
  690.  
  691. IDMTgtOperationHandle
  692.   pDMTgtOperation;
  693.  
  694. IDMTgtRendererAssocSeq
  695.   pTgtRendAssocSeqCl;
  696.  
  697. }; // IDMTargetItem
  698.  
  699.  
  700. class IDMTgtItemHandle : public IReference< IDMTargetItem > {
  701. /*******************************************************************************
  702. * Objects of this class provide access to IDMTargetItem objects                *
  703. * associated with a direct manipulation event.  This "handle" class manages    *
  704. * references to the IDMTargetItem object to ensure that it is not              *
  705. * deleted until the drag operation is completed.                               *
  706. *                                                                              *
  707. * This class provides a "->" operator that enables instances to be treated     *
  708. * just like a pointer to an IDMTargetItem object.                              *
  709. *                                                                              *
  710. * Example:                                                                     *
  711. *   // IDMTgtOperationHandle providing access to the drag information...       *
  712. *   IDMTgtOperationHandle                                                      *
  713. *     tgtOperation;                                                            *
  714. *                                                                              *
  715. *   // Process items...                                                        *
  716. *   for( int i = 0; i < tgtOperation->numberOfItems(); i++ )                   *
  717. *     {                                                                        *
  718. *     IDMTgtItemHandle                                                         *
  719. *       item = tgtOperation->item( i );                                        *
  720. *     // If item is C code, then this handler can accept it...                 *
  721. *     if ( item->trueType() == IDragItem::cCode )                              *
  722. *       // Note: The following line is tentative and should be amended         *
  723. *       //       per the actual drag item protocol when it is completed.       *
  724. *       item -> enableDrop();                                                  *
  725. *     }                                                                        *
  726. *                                                                              *
  727. * This class has no members.  It is essentially a synonym for the type         *
  728. * IReference< IDMTargetItem >.                                                 *
  729. *******************************************************************************/
  730. public:
  731.   IDMTgtItemHandle (IDMTargetItem *pIDMTgtItem);
  732.   ~IDMTgtItemHandle ( );
  733.  
  734. /*--------------------------------- Operators ---------------------------------+
  735. | Operators defined for IDMTgtItemHandle:                                      |
  736. |   == - Overload definition to handle comparisons of target drag item handles.|
  737. |   <  - Overload definition to handle comparisons of target drag item handles.|
  738. +-----------------------------------------------------------------------------*/
  739. Boolean
  740.   operator ==    ( const IDMTgtItemHandle &targetItem ) const,
  741.   operator <     ( const IDMTgtItemHandle &targetItem ) const;
  742.  
  743. }; // IDMTgtItemHandle
  744.  
  745. class IDMSrcRendererAssoc : public IRefCounted {
  746. typedef IBase
  747.   Inherited;
  748. /*******************************************************************************
  749. * Objects of this class are created by windows when a direct manipulation      *
  750. * operation commences on the source side.                                      *
  751. *                                                                              *
  752. * This class provides the support required to link source renderers with       *
  753. * with drag items based upon the drag item type(s).                            *
  754. *******************************************************************************/
  755. public:
  756.  
  757. /*------------------------- Constructors/Destructor ----------------------------
  758. | Objects of this class are constructed in the following manner:               |
  759. |   o By providing type and identifying the source renderer.                   |
  760. ------------------------------------------------------------------------------*/
  761.   IDMSrcRendererAssoc     (IString type,
  762.                            IDMSrcRendererHandle renderer);
  763.  
  764. virtual
  765.   ~IDMSrcRendererAssoc    ( );
  766.  
  767. /*-------------------------------- Accessors -----------------------------------
  768. | This function provides access to attributes of instances of this class:      |
  769. |   sourceRenderer  - Returns a handle to the source renderer.                 |
  770. ------------------------------------------------------------------------------*/
  771. virtual IDMSrcRendererHandle
  772.   sourceRenderer    ( ) const;
  773.  
  774. protected:
  775. private: /*------------------------ PRIVATE ----------------------------------*/
  776.  
  777. IString
  778.   strTypes;
  779.  
  780. IDMSrcRendererHandle
  781.   pSrcRenderer;
  782.  
  783. }; // class IDMSrcRendererAssoc
  784.  
  785. class IDMSrcRndrAssocHandle : public IReference< IDMSrcRendererAssoc > {
  786. /*******************************************************************************
  787. * Objects of this class provide access to IDMSrcRendererAssoc objects          *
  788. * associated with a direct manipulation event.  This "handle" class manages    *
  789. * references to the IDMSrcRendererAssoc object to ensure that it is not        *
  790. * deleted until the drag operation is completed.                               *
  791. *                                                                              *
  792. * This class provides a "->" operator that enables instances to be treated     *
  793. * just like a pointer to an IDMSrcRendererAssoc object.                        *
  794. *                                                                              *
  795. * Example:                                                                     *
  796. *                                                                              *
  797. * This class has no members.  It is essentially a synonym for the type         *
  798. * IReference< IDMSrcRendererAssoc >.                                           *
  799. *******************************************************************************/
  800. public:
  801.   IDMSrcRndrAssocHandle (IDMSrcRendererAssoc *pIDMSrcRendAssoc) :
  802.     IReference <IDMSrcRendererAssoc> (pIDMSrcRendAssoc) { };
  803.   ~IDMSrcRndrAssocHandle ( );
  804. }; // IDMSrcRndrAssocHandle
  805.  
  806.  
  807. class IDMTgtRendererAssoc : public IRefCounted {
  808. typedef IBase
  809.   Inherited;
  810. /*******************************************************************************
  811. * Objects of this class are created by windows during a direct manipulation    *
  812. * operation when the objects are dragged over or dropped on a target window.   *
  813. *                                                                              *
  814. * This class provides the support required to link target renderers with       *
  815. * with drag items based upon the drag item type(s).                            *
  816. *******************************************************************************/
  817. public:
  818.  
  819. /*------------------------- Constructors/Destructor ----------------------------
  820. | Objects of this class are constructed in the following manner:               |
  821. |   o By providing type and identifying the target renderer.                   |
  822. ------------------------------------------------------------------------------*/
  823.   IDMTgtRendererAssoc     (IString type,
  824.                            IDMTgtRendererHandle renderer);
  825.  
  826. virtual
  827.   ~IDMTgtRendererAssoc    ( );
  828.  
  829. /*-------------------------------- Accessors -----------------------------------
  830. | This function provides access to attributes of instances of this class:      |
  831. |   targetRenderer  - Returns a handle to the target renderer.                 |
  832. ------------------------------------------------------------------------------*/
  833. virtual IDMTgtRendererHandle
  834.   targetRenderer    ( ) const;
  835.  
  836. protected:
  837. private: /*------------------------ PRIVATE ----------------------------------*/
  838.  
  839. IString
  840.   strTypes;
  841.  
  842. IDMTgtRendererHandle
  843.   pTgtRenderer;
  844.  
  845. }; // class IDMTgtRendererAssoc
  846.  
  847.  
  848. class IDMTgtRndrAssocHandle : public IReference< IDMTgtRendererAssoc > {
  849. /*******************************************************************************
  850. * Objects of this class provide access to IDMTgtRendererAssoc objects          *
  851. * associated with a direct manipulation event.  This "handle" class manages    *
  852. * references to the IDMTgtRendererAssoc object to ensure that it is not        *
  853. * deleted until the drag operation is completed.                               *
  854. *                                                                              *
  855. * This class provides a "->" operator that enables instances to be treated     *
  856. * just like a pointer to an IDMTgtRendererAssoc object.                        *
  857. *                                                                              *
  858. * Example:                                                                     *
  859. *                                                                              *
  860. * This class has no members.  It is essentially a synonym for the type         *
  861. * IReference< IDMTgtRendererAssoc >.                                           *
  862. *******************************************************************************/
  863. public:
  864.   IDMTgtRndrAssocHandle (IDMTgtRendererAssoc *pIDMTgtRendAssoc) :
  865.     IReference <IDMTgtRendererAssoc> (pIDMTgtRendAssoc) { };
  866.   ~IDMTgtRndrAssocHandle ( );
  867. }; // IDMTgtRndrAssocHandle
  868.  
  869. #ifndef I_NO_INLINES
  870.   #include <idmitem.inl>
  871. #endif
  872.  
  873. #endif // _IDMITEM_
  874.