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

  1. #ifndef _IDMITEM_
  2. #define _IDMITEM_
  3. /*******************************************************************************
  4. * FILE NAME: idmitem.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IDMItem - Generic direct manipulation item 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 _IWINDOW_
  24.   #include <iwindow.hpp>
  25. #endif
  26.  
  27. #ifndef _IDMCOMM_
  28.   #include <idmcomm.hpp>
  29. #endif
  30.  
  31. #ifndef _ISTRING_
  32.   #include <istring.hpp>
  33. #endif
  34.  
  35. /*----------------------------------------------------------------------------*/
  36. /* Align classes on four byte boundary.                                       */
  37. /*----------------------------------------------------------------------------*/
  38. #pragma pack(4)
  39.  
  40. /* Forward Declarations */
  41. struct _DRAGITEM;
  42. struct _HSTR;
  43. class IDMSourceRenderEvent;
  44. class IDMSourcePrepareEvent;
  45. class IDMSourceEndEvent;
  46. class IDMSourceDiscardEvent;
  47. class IDMSourcePrintEvent;
  48. class IDMTargetDropEvent;
  49. class IDMTargetEndEvent;
  50. class IDMSourceOperation;
  51. class IDMTargetOperation;
  52. class IDMOperation;
  53. class IDMRenderer;
  54. class IDMSourceRenderer;
  55. class IDMTargetRenderer;
  56. class IDMImage;
  57.  
  58.  
  59. class IDMItem : public IRefCounted {
  60. typedef IRefCounted
  61.   Inherited;
  62. typedef IDM::DropIndicator
  63.   DropIndicator;
  64. /*******************************************************************************
  65. * Objects of this class represent generic items being dragged or dropped       *
  66. * during a direct manipulation operation.                                      *
  67. *                                                                              *
  68. * This class provides virtual functions that implement the base ICLUI support  *
  69. * for direct manipulation item objects.  (Direct manipulation is also referred *
  70. * to by the term drag/drop.)  Windows create derived classes to support        *
  71. * specific drag item objects such as text item objects and container item      *
  72. * objects when an application end-user begins a direct manipulation operation. *
  73. *                                                                              *
  74. * Objects of this class possess the following attributes in addition to        *
  75. * those inherited from its base class:                                         *
  76. *   o Source window handle                                                     *
  77. *   o Types of the dragged object (true and additional)                        *
  78. *   o RMFs (Rendering Mechanisms and Formats) of the dragged object (native    *
  79. *     and additional)                                                          *
  80. *   o Container name at the source of the drag                                 *
  81. *   o Source name                                                              *
  82. *   o Suggested target name                                                    *
  83. *   o Item image which visually represents the item being dragged.             *
  84. *   o Relative position of the corresponding item image in the drag pointer    *
  85. *   o Source flags providing instructions on how to render an object, etc.     *
  86. *   o Generic IString buffer contents to hold a various assortment of bytes    *
  87. *   o Generic object pointer to hold a pointer to an object.                   *
  88. *   o Association with a source or target drag operation object (see           *
  89. *     IDMSourceOperation or IDMTargetOperation)                                *
  90. *   o Association(s) with a selected source or target drag renderer object     *
  91. *     see IDMSourceRenderer or IDMTargetRenderer), which are created by the    *
  92. *     source handler (see IDMSourceHandler) and target handler (see            *
  93. *     IDMTargetRenderer), respectively.                                        *
  94. *                                                                              *
  95. *******************************************************************************/
  96. public:
  97. /*------------------------------ IDMItem::Handle -------------------------------
  98. | IDMItem::Handle provides access to the IDMItem objects associated with a     |
  99. | direct manipulation operation.  The handle manages the references to the     |
  100. | IDMItem object and ensures that this object is not deleted until the direct  |
  101. | manipulation operation is completed.                                         |
  102. |                                                                              |
  103. | Use Handle to reference an item handle within this class and IDMItem::Handle |
  104. | externally.                                                                  |
  105. |                                                                              |
  106. | The handle provides a "->" operator, which enables instances to be treated   |
  107. | just like a pointer to an IDMItem object.                                    |
  108. ------------------------------------------------------------------------------*/
  109. typedef IReference< IDMItem > Handle;
  110.  
  111. /*-------------------------- Constructors/Destructor ---------------------------
  112. | You can construct generic objects of this class by providing one of the      |
  113. | following items:                                                             |
  114. |   o A pointer to the drag source operation, types, supported operations      |
  115. |     and attributes                                                           |
  116. |   o A pointer to the drag target operation and drag item structure           |
  117. |   o A copy constructor                                                       |
  118. |   o An item handle (for example, a copy constructor)                         |
  119. ------------------------------------------------------------------------------*/
  120.   IDMItem    ( IDMSourceOperation       *sourceOperation,
  121.                const IString            &types,
  122.                const unsigned long      supportedOperations = unknown,
  123.                const unsigned long      attributes = none);
  124.  
  125.   IDMItem    ( IDMTargetOperation       *targetOperation,
  126.                _DRAGITEM                *dragItem );
  127.  
  128.   IDMItem    ( const IDMItem            &dragItem );
  129.  
  130.   IDMItem    ( const Handle             &item );
  131.  
  132. virtual
  133.  ~IDMItem    ( );
  134.  
  135. /*--------------------------------- Operators ---------------------------------+
  136. | The following functions allow assignments of IDMItems:                       |
  137. |   operator =  - Replaces the contents of an IDMItem.                         |
  138. +-----------------------------------------------------------------------------*/
  139.   operator = ( const IDMItem &item );
  140.   operator = ( const Handle  &item );
  141.  
  142. /*----------------------  Supported Operations Flags  --------------------------
  143.   The following static members define a drag object's supported
  144.   operations flags.  The valid supported operations are:
  145.  
  146.     unknown   - No supported drag operations are available.
  147.     copyable  - The source object that is being dragged can be copied to
  148.                 the specified drop location.
  149.     moveable  - The source object that is being dragged can be moved to
  150.                 the specified drop location.
  151.     linkable  - The source object that is being dragged can be linked to
  152.                 the specified object.
  153.  
  154.   Note:  These static members represent bit masks, patterns of characters used
  155.   to control portions of another pattern of characters. Any user defined values
  156.   must be greater than the linkable value.
  157. ------------------------------------------------------------------------------*/
  158. static const unsigned long
  159.   unknown,
  160.   copyable,
  161.   moveable,
  162.   linkable;
  163.  
  164. /*----------------------------  Attributes Flags  ------------------------------
  165.   The following static members define the drag object's attribute flags.  The
  166.   valid attributes of dragged objects are:
  167.  
  168.     none             - No attributes are defined.
  169.     open             - The source object is open
  170.     reference        - The source object is a reference to another object
  171.     group            - The source object is a group of objects
  172.     container        - The source object is a container of other objects
  173.     prepare          - The source object requires preparation before it
  174.                          establishes a data transfer conversation
  175.     removableMedia   - The source object is on removable media, or the source
  176.                          object cannot be recovered after a move operation
  177.  
  178.   Note:  These static members represent bit masks, patterns of characters used
  179.   to control portions of another pattern of characters. Any user defined values
  180.   must be greater than the removableMedia value.
  181. ----------------------------------------------------------------------------*/
  182. static const unsigned long
  183.   none,
  184.   open,
  185.   reference,
  186.   group,
  187.   container,
  188.   prepare,
  189.   removableMedia;
  190.  
  191. /*-------------------------------- Accessors -----------------------------------
  192. | Instances of the IDMItem class have attributes that can be accessed by the   |
  193. | following functions:                                                         |
  194. |   sourceWindowHandle    - Returns the handle of the source window for this   |
  195. |                           item.                                              |
  196. |   sourceWindow          - Returns a pointer to the source window for this    |
  197. |                           item.                                              |
  198. |   containerName         - Returns the source container name                  |
  199. |   sourceName            - Returns the source object name                     |
  200. |   targetName            - Returns the suggested target object name           |
  201. |   attributes            - Returns the control attributes for this item       |
  202. |   supportedOperations   - Returns the operations supported by this item      |
  203. |   imageOffset           - Returns the offset of the image origin             |
  204. |                           from the pointer hotspot.                          |
  205. |   setSourceWindowHandle - Sets the source window handle for this item.       |
  206. |   setContainerName      - Sets the source container name.                    |
  207. |   setTargetName         - Sets the suggested target object "name".           |
  208. |   setSourceName         - Sets the source object "name".                     |
  209. ------------------------------------------------------------------------------*/
  210. virtual IWindowHandle
  211.   sourceWindowHandle     ( ) const;
  212.  
  213. virtual IWindow
  214.  *sourceWindow           ( ) const;
  215.  
  216. virtual IString
  217.   containerName          ( ) const,
  218.   sourceName             ( ) const,
  219.   targetName             ( ) const;
  220.  
  221. virtual unsigned long
  222.   attributes             ( ) const,
  223.   supportedOperations    ( ) const;
  224.  
  225. virtual ISize
  226.   imageOffset            ( ) const;
  227.  
  228. IDMItem
  229.  &setSourceWindowHandle  ( IWindowHandle window ),
  230.  &setContainerName       ( const char    *containerName ),
  231.  &setTargetName          ( const char    *targetName ),
  232.  &setSourceName          ( const char    *sourceName );
  233.  
  234. /*-------------------------------- Attributes ----------------------------------
  235. | These functions permit the setting/testing of a variety of drag item         |
  236. | "attribute" flags:                                                           |
  237. |   isOpen                 - Indicates whether the dragged object is "open".   |
  238. |   isReference            - Indicates whether the dragged object is a         |
  239. |                            "reference" to another object.                    |
  240. |   isGroup                - Indicates whether the item is a group of objects. |
  241. |   isContainer            - Indicates whether the item is a container of other|
  242. |                            objects.                                          |
  243. |   isOnRemovableMedia     - Indicates whether the item is on removable media  |
  244. |                            or cannot be recovered after a move operation.    |
  245. |   requiresPreparation    - Indicates whether the source requires preparation |
  246. |                            prior to rendering.                               |
  247. |   setRequiresPreparation - Set/reset the "requiresPreparation" flag.         |
  248. |   setOpen                - Set/reset the "isOpen" flag.                      |
  249. |   setReference           - Set/reset the "isReference" flag.                 |
  250. |   setGroup               - Set/reset the "isGroup" flag.                     |
  251. |   setContainer           - Set/reset the "isContainer" flag.                 |
  252. |   setOnRemovableMedia    - Set/reset the "isOnRemovableMedia" flag.          |
  253. ------------------------------------------------------------------------------*/
  254. virtual Boolean
  255.   isOpen                    ( ) const,
  256.   isReference               ( ) const,
  257.   isGroup                   ( ) const,
  258.   isContainer               ( ) const,
  259.   isOnRemovableMedia        ( ) const,
  260.   requiresPreparation       ( ) const;
  261.  
  262. virtual IDMItem
  263.  &setRequiresPreparation    ( Boolean requiresPrep     = true ),
  264.  &setOpen                   ( Boolean open             = true ),
  265.  &setReference              ( Boolean reference        = true ),
  266.  &setGroup                  ( Boolean group            = true ),
  267.  &setContainer              ( Boolean container        = true ),
  268.  &setOnRemovableMedia       ( Boolean onRemovableMedia = true );
  269.  
  270. /*-------------------------------- Operations ----------------------------------
  271. | These functions permit the setting/querying of the supported direct          |
  272. | manipulation operations for this class:                                      |
  273. |   canBeCopied  - Indicates whether a copy operation is supported.            |
  274. |   canBeLinked  - Indicates whether a link operation is supported.            |
  275. |   canBeMoved   - Indicates whether a move operation is supported.            |
  276. |   enableCopy   - Enables or disables copy operation for the item.            |
  277. |   enableLink   - Enables or disables link operation for the item.            |
  278. |   enableMove   - Enables or disables move operation for the item.            |
  279. |   supportedOperationsFor - Returns operations this item supports using the   |
  280. |                            specified RMFs.                                   |
  281. ------------------------------------------------------------------------------*/
  282. virtual Boolean
  283.   canBeCopied    ( ) const,
  284.   canBeLinked    ( ) const,
  285.   canBeMoved     ( ) const;
  286.  
  287. virtual IDMItem
  288.  &enableCopy       ( Boolean copyable = true ),
  289.  &enableLink       ( Boolean linkable = true ),
  290.  &enableMove       ( Boolean moveable = true );
  291.  
  292. virtual unsigned long
  293.   supportedOperationsFor ( const IString &selectedRMFs ) const;
  294.  
  295. /*------------------------------- Object Type ----------------------------------
  296. | These functions provide means for setting/querying the "type(s)" of the      |
  297. | item:                                                                        |
  298. |   trueType    - Returns the "true type" of the item.                         |
  299. |   types       - Returns all types for the item.  Individual types are        |
  300. |                 separated by a comma.                                        |
  301. |   hasType     - Indicates whether the item supports a particular type.       |
  302. |   setTrueType - Sets the "true type" of the item.                            |
  303. |   setTypes    - Sets the types for the item.  Issue setTypes("") to remove   |
  304. |                 all types for the item.                                      |
  305. |   addType     - Adds an additional type or types (i.e. "type1,type2")        |
  306. |   removeType  - Removes a type from this item.                               |
  307. |   replaceType - Replaces a type for this item.                               |
  308. ------------------------------------------------------------------------------*/
  309. virtual IString
  310.   trueType          ( ) const,
  311.   types             ( ) const;
  312.  
  313. virtual Boolean
  314.   hasType           ( const char  *aType ) const;
  315.  
  316. virtual IDMItem
  317.  &setTrueType       ( const char  *aType ),
  318.  &setTypes          ( const char  *types ),
  319.  &addType           ( const char  *aType ),
  320.  &removeType        ( const char  *aType );
  321.  
  322. /*-----------------------  Rendering Mechanisms/Formats  -----------------------
  323. | These functions provide means for querying or setting the rendering          |
  324. | mechanism and/or format of the item:                                         |
  325. |   nativeRMF    - Returns the "native" rendering mechanism and format of      |
  326. |                  the item.                                                   |
  327. |   nativeRM     - Returns the "native" rendering mechanism of the item.       |
  328. |   nativeRF     - Returns the "native" rendering format of the item.          |
  329. |   rmfs         - Returns all rendering mechanisms and formats of the item.   |
  330. |   supportsRMF  - Indicates whether the item supports a specific rendering    |
  331. |                  mechanism and format.                                       |
  332. |   setNativeRMF - Sets the "native" RMF to the argument type.                 |
  333. |   setRMFs      - Sets the RMFs for the item.  Issue setRMFs("") to remove    |
  334. |                  all RMFs for the item.                                      |
  335. |   addRMF       - Adds an additional RMF or RMFs (i.e. "<rm1,rf1>,<rm2,rf2>") |
  336. |   removeRMF    - Removes a RMF from this item.                               |
  337. |                                                                              |
  338. | Note:  Functions that get and set RMFs use the following RMF notation:       |
  339. |        "<rm1,rf1>,<rm2,rf2>"   - Ordered pair form                           |
  340. |        "(rm1,rm2)x(rf1)"       - Cross product form                          |
  341. ------------------------------------------------------------------------------*/
  342. virtual IString
  343.   nativeRMF       ( ) const,
  344.   nativeRM        ( ) const,
  345.   nativeRF        ( ) const,
  346.   rmfs            ( ) const;
  347.  
  348. virtual Boolean
  349.   supportsRMF     ( const IString &rmf ),
  350.   supportsRMF     ( const IString &rm,
  351.                     const IString &rf );
  352.  
  353. virtual IDMItem
  354.  &setNativeRMF    ( const IString &rmf ),
  355.  &setNativeRMF    ( const IString &rm,
  356.                     const IString &rf ),
  357.  &setRMFs         ( const IString &rmfs ),
  358.  &addRMF          ( const IString &rmf ),
  359.  &addRMF          ( const IString &rm,
  360.                     const IString &rf ),
  361.  &removeRMF       ( const IString &rmf ),
  362.  &removeRMF       ( const IString &rm,
  363.                     const IString &rf );
  364.  
  365. /*-------------------  Rendering Mechanisms/Formats Utilities  -----------------
  366. | These static functions provide means for constructing/querying the rendering |
  367. | mechanism and/or format:                                                     |
  368. |   appendRMF        - Appends another rmf to an rmf string, separated by a    |
  369. |                      comma, if required.                                     |
  370. |   compressRMFs     - Returns a compressed version of the argument rmf        |
  371. |                      string with all possible cross products converted       |
  372. |                      to cross-product form.                                  |
  373. |   deleteRMF        - Deletes a particular rmf from an rmf string.            |
  374. |   matchingRMFs     - Returns the intersection of the two rmf strings.  An    |
  375. |                      optional argument indicates that only the first         |
  376. |                      matching rmf is required.                               |
  377. |   rfForThisProcess - Returns DRF_PROCESS=pid where pid is the current        |
  378. |                      process identifier.                                     |
  379. |   rfFrom           - Returns the rendering format from an rmf.               |
  380. |   rmfFrom          - Constructs a rendering mechanism and format ordered     |
  381. |                      pair (i.e. "<rm,rf>").  If multiple rm's or rf's are    |
  382. |                      included, you should use rmfsFrom, instead.             |
  383. |   rmFrom           - Returns the rendering mechanism from an rmf.            |
  384. |   rmfsFrom         - Returns a full rmf string from either a single rmf      |
  385. |                      string, or separate rm/rf strings.  The result will     |
  386. |                      have all cross-products expanded.                       |
  387. ------------------------------------------------------------------------------*/
  388. static void
  389.   appendRMF           ( IString &rmfs, const IString &rmf ),
  390.   deleteRMF           ( IString &rmfs, const IString &rmf );
  391.  
  392. static IString
  393.   compressedRMFs      ( const IString &rmfs ),
  394.   matchingRMFs        ( const IString &rmfs1,
  395.                         const IString &rmfs2,
  396.                         Boolean        firstOnly = false ),
  397.   rfForThisProcess    ( ),
  398.   rfFrom              ( const IString &rmf ),
  399.   rmfFrom             ( const IString &rm,
  400.                         const IString &rf ),
  401.   rmFrom              ( const IString &rmf ),
  402.   rmfsFrom            ( const IString &rmfs ),
  403.   rmfsFrom            ( const IString &rm,
  404.                         const IString &rf );
  405.  
  406. /*---------------------------- Selected Renderer -------------------------------
  407. | These functions provide support to set/get the renderer that was selected    |
  408. | for this item.  Also, functions are provided to set/get the rendering        |
  409. | mechanism and format (RMF) that was selected from those supported within     |
  410. | the renderer:                                                                |
  411. |   renderer       - Returns the position of the selected renderer for this    |
  412. |                    item.                                                     |
  413. |   setRenderer    - Sets the position of the selected renderer for this item. |
  414. |   selectedRMF    - Returns selected RMF for this item in ordered pair        |
  415. |                    (i.e. "<rm,rf>") or cross product (i.e. "(rm)x(rf1,rf2)") |
  416. |                    format.                                                   |
  417. |   setSelectedRMF - Sets selected RMF for this item.  Expects the argument    |
  418. |                    to be in ordered pair or cross product format.            |
  419. ------------------------------------------------------------------------------*/
  420. unsigned
  421.   renderer          ( ) const;
  422.  
  423. IString
  424.   selectedRMF       ( ) const;
  425.  
  426. IDMItem
  427.  &setRenderer       ( unsigned   position ),
  428.  &setSelectedRMF    ( const IString &rmf );
  429.  
  430. /*------------------------------- Drop Status ----------------------------------
  431. | These functions provide support to set/get the drop status for this item:    |
  432. |   dropStatus    - Returns drop status for this item.                         |
  433. |   setDropStatus - Sets drop status for this item.                            |
  434. ------------------------------------------------------------------------------*/
  435. DropIndicator
  436.   dropStatus       ( ) const;
  437.  
  438. IDMItem
  439.  &setDropStatus    ( DropIndicator status );
  440.  
  441. /*---------------------- Source Renderering (Callbacks) ------------------------
  442. | These functions provide source renderering support:                          |
  443. |   sourceRender  - Called to give the item opportunity to acquire the data    |
  444. |                   that will be transferred to the target.                    |
  445. |   sourcePrepare - Called to give the item opportunity to acquire             |
  446. |                   information needed by the target, perform a task           |
  447. |                   required by a target prior to target renderering, or       |
  448. |                   perform setup required by a source renderer.               |
  449. |   sourceEnd     - Called by the source handler when the target has informed  |
  450. |                   it that the target has finished processing the data that   |
  451. |                   was associated with the dropped item.  Source cleanup for  |
  452. |                   the item should occur here.                                |
  453. |   sourceDiscard - Called by the IDMSourceRenderer::sourceDiscard()           |
  454. |                   function when it was indicated that the source window has  |
  455. |                   responsibility for discarding the item.                    |
  456. |   sourcePrint   - Called by the IDMSourceRenderer::sourcePrint()             |
  457. |                   function when it was indicated that the source window has  |
  458. |                   responsibility for printing the item.                      |
  459. ------------------------------------------------------------------------------*/
  460. virtual Boolean
  461.   sourceRender     ( IDMSourceRenderEvent  &event ),
  462.   sourcePrepare    ( IDMSourcePrepareEvent &event ),
  463.   sourceEnd        ( IDMSourceEndEvent     &event ),
  464.   sourceDiscard    ( IDMSourceDiscardEvent &event ),
  465.   sourcePrint      ( IDMSourcePrintEvent   &event );
  466.  
  467. /*---------------------- Target Rendering (Callbacks) --------------------------
  468. | These functions provide target renderering support:                          |
  469. |   targetDrop - Called to give the item the opportunity to "write" the        |
  470. |                data that was transferred to the target window.  Target       |
  471. |                cleanup for the item should occur here.                       |
  472. |   targetEnd  - Called by the target handler when the source has informed     |
  473. |                it that the source has finished rendering the data that       |
  474. |                was associated with the dropped item.                         |
  475. ------------------------------------------------------------------------------*/
  476. virtual Boolean
  477.   targetDrop    ( IDMTargetDropEvent &event ),
  478.   targetEnd     ( IDMTargetEndEvent  &event );
  479.  
  480. /*---------------------------- Drag Image Support ------------------------------
  481. | These functions provide drag image support:                                  |
  482. |   image    - Returns the drag image for this item, or 0 if none.             |
  483. |   setImage - Sets or removes this item's drag image                          |
  484. |   hasImage - Returns true if item has an image.                              |
  485. ------------------------------------------------------------------------------*/
  486. virtual IDMImage
  487.  &image       ( );
  488.  
  489. virtual IDMItem
  490.  &setImage    ( IDMImage &image );
  491.  
  492. Boolean
  493.   hasImage    ( ) const;
  494.  
  495. /*------------------------------ Source Items ----------------------------------
  496. | This function generates source items:                                        |
  497. |   generateSourceItems - Generates generic items.                             |
  498. ------------------------------------------------------------------------------*/
  499. static Boolean
  500.   generateSourceItems    ( IDMSourceOperation *sourceOperation );
  501.  
  502. /*------------------------------ Drag Operation --------------------------------
  503. | These functions provide access to the drag operations:                       |
  504. |   sourceOperation - Returns the source operation for this item, or 0         |
  505. |                     if request was made by target.                           |
  506. |   targetOperation - Returns the target operation for this item, or 0         |
  507. |                     if request was made by source.                           |
  508. ------------------------------------------------------------------------------*/
  509. virtual IDMSourceOperation
  510.  *sourceOperation    ( );
  511.  
  512. virtual IDMTargetOperation
  513.  *targetOperation    ( );
  514.  
  515. /*---------------------------- Associated Object -------------------------------
  516. | These functions provide read/write access to data associated with the        |
  517. | direct manipulation operation.  The contents functions are used with         |
  518. | the rendering mechanism IDM::rmLibrary.  The object functions are used       |
  519. | with the rendering format IDM::rfProcess:                                    |
  520. |   contents     - Returns the contents of the drag item.                      |
  521. |   contentsSize - Returns the size of the contents of the drag item.          |
  522. |   setContents  - Sets contents of the drag item.  Derived class should       |
  523. |                  override to provide specific implementation based upon      |
  524. |                  characteristics of the window.                              |
  525. |   object       - Returns the pointer to the object.                          |
  526. |   setObject    - Sets the pointer to the object.                             |
  527. ------------------------------------------------------------------------------*/
  528. virtual IString
  529.   contents        ( ) const;
  530.  
  531. virtual unsigned long
  532.   contentsSize    ( ) const;
  533.  
  534. virtual Boolean
  535.   setContents     ( const IString &data );
  536.  
  537. virtual void
  538.  *object          ( ) const;
  539.  
  540. virtual IDMItem
  541.  &setObject       ( void          *pointerToObject );
  542.  
  543. /*-------------------------------- Utilities -----------------------------------
  544. | This function provides utility services used to implement this class:        |
  545. |   sourceItemFor - Retrieves the source item handle based upon the target     |
  546. |                   item if and only if we're in the same process, and         |
  547. |                   the parameter is a target item.  Otherwise, 0 is returned. |
  548. ------------------------------------------------------------------------------*/
  549. static Handle
  550.   sourceItemFor    ( const Handle &targetItem );
  551.  
  552.  
  553. protected:
  554. /*------------------------------- Implementation -------------------------------
  555. | The following function/data membe provide implement features for this class: |
  556. |   generateSourceName - Generates the source name for the implementation of   |
  557. |                        the IDM::rfText renderering format.                   |
  558. |   strContents - Holds data (contents) of the drag item.  This data member is |
  559. |                 protected to allow derived classes to either return the      |
  560. |                 contents of it via the contents() function or allow the      |
  561. |                 object() function to return a pointer to it per a derived    |
  562. |                 implementation.                                              |
  563. ------------------------------------------------------------------------------*/
  564. IString
  565.   generateSourceName  ( );
  566.  
  567. IString
  568.   strContents;
  569.  
  570.  
  571. private: /*------------------------ PRIVATE ----------------------------------*/
  572. friend class IDMSourceOperation;
  573. friend class IDMTargetOperation;
  574. friend class IDMSourceRenderEvent;
  575. friend class IDMSourceRenderer;
  576. friend class IDMTargetRenderer;
  577. friend class IDMTargetEndEvent;
  578. friend class IDMItemUtilities;
  579.  
  580. unsigned long
  581.   dragSupOps,
  582.   dragAttrs;
  583.  
  584. IWindowHandle
  585.   sourceWndh;
  586.  
  587. IDMImage
  588.  *pIDMImage;
  589.  
  590. ISize
  591.   sizeImageOffset;
  592.  
  593. IString
  594.   strContainerName,
  595.   strSourceName,
  596.   strTargetName,
  597.   strTypes,
  598.   strRMFs,
  599.   strSelectedRMF;
  600.  
  601. IDMSourceOperation
  602.  *pDMSrcOperation;
  603.  
  604. IDMTargetOperation
  605.  *pDMTgtOperation;
  606.  
  607. unsigned
  608.   rendererPosition;
  609.  
  610. DropIndicator
  611.   drpStatus;
  612.  
  613. void
  614.  *pObject;
  615.  
  616. _DRAGITEM
  617.  *pPMDragItem;
  618.  
  619. _DRAGITEM
  620.  *PMDragItem    ( );
  621.  
  622. void
  623.  setPMDragItem  ( _DRAGITEM *pDragItem );
  624.  
  625. void
  626.   asPMDragItem  ( _DRAGITEM *pDragItem );
  627.  
  628. static IString
  629.   stringFromHandle (const IStringHandle& hstr);
  630.  
  631. IStringHandle
  632.   handleFromString (IString inputStr);
  633.  
  634. static IString
  635.   nextRMOrRFFrom ( const IString &rmfs,
  636.                    unsigned      &position );
  637. static void
  638.   setHSTR ( unsigned long       &oldHSTR,
  639.             const IStringHandle &newHSTR );
  640. }; // IDMItem
  641.  
  642. /*----------------------------------------------------------------------------*/
  643. /* Resume compiler default packing.                                           */
  644. /*----------------------------------------------------------------------------*/
  645. #pragma pack()
  646.  
  647. #ifndef I_NO_INLINES
  648.   #include <idmitem.inl>
  649. #endif
  650.  
  651. #endif // _IDMITEM_
  652.