### IDMOperation

  The IDMOperation class represents a drag operation in a direct manipulation. The drag operation is commonly known as a source or target operation. Objects of this class provide general-purpose information about a drag operation.

  Objects of this class have the following attributes in addition to those inherited from its base class:

  - The type of drag operation (for example, copy, move, or link)
  - The position of the pointing device within the source or target window
  - The source of the operation (pointing device versus keyboard)
  - The number of associated drag items, IDMItems
  - A pointer to the collection of IDMItems
  - A collection of IDMItem objects, one object for each item being manipulated during this drag operation

  This class manages a drag item collection that associates drag items with this class.

  This is the base class for all drag operations classes. Your programs should only deal with objects of either of the derived classes: IDMSourceOperation and IDMTargetOperation.

#### OS/2 Considerations

  The IDMOperation class is a wrapper for the DRAGINFO structure.

### IDMOperation - Member Functions and Data by Group

### Constructors & Destructor

You can construct and destruct objects of this class. These members are used by derived classes.

~IDMOperation

      protected:
      virtual ~IDMOperation()

  This destructor deletes the drag item collection that manages associated drag items for this class.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IDMOperation

  Overload 1

      protected:
      IDMOperation(IDMSourceBeginEvent& event)

  event
    A reference to a source begin event.

  Use this function to construct an IDMOperation object by providing a reference to the source begin event.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      protected:
      IDMOperation(IDMTargetEnterEvent& event)

  event
    A reference to a target enter event.

  Use this function to construct an IDMOperation object by providing a reference to a target enter event.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Container Support

Use these members to support a container control in a direct manipulation.

containerObject

      public:
      IContainerObject* containerObject() const

  Returns a pointer to the container object that the hot spot of the pointing device is over during target enter event processing or the container object where the drop occurred. It returns 0 if one of the following conditions occur:

  - The target window is not a container.
  - The hot spot of the pointing device is positioned over container white space.
  - The drop occurred on container white space.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setContainerObject

      public:
      IDMOperation& setContainerObject(IContainerObject* object)

  Sets a pointer to the container object that the hot spot of the pointing device is over during target enter event processing or to the container object where the drop occurred.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setContainerRefreshOff

      public:
      IDMOperation&
        setContainerRefreshOff( IContainerControl* container )

  Sets the container refresh off for the given container by calling IContainerControl::setRefreshOff.

  When direct manipulation processing is finished or if it is canceled, container refresh is turned on again via IDMOperation::setRefreshOn.
  Note: The Open Class Library manages container refreshing by default.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setContainerRefreshOn

      public:
      IDMOperation& setContainerRefreshOn()

  Sets the container refresh on by calling IContainerControl::setRefreshOn. for the container that was identified in the previous call to IDMOperation::setContainerRefreshOff. The container is also refreshed via the member function, IContainerControl::refresh.

  The container is also refreshed.
  Note: The Open Class Library manages container refreshing by default.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Diagnostics

Use these members to indicate the level of debug support for a direct manipulation.

debugSupport

      public:
      static bool debugSupport()

  Returns a value indicating if full debug support is enabled. When true, screen locking during a direct manipulation is disabled. The default setting for this flag is false.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setDebugSupport

      public:
      static void setDebugSupport(bool debugSupport = true)

  Set this flag to true to enable full debug support. When set to true, this flag disables screen locking during a direct manipulation.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Drag Items

Use these members to add, remove, and query the IDMItem objects involved in a direct manipulation.

addItem

      public:
      IDMOperation& addItem(const IDMItem::Handle& newItem)

  Associates another drag item with the operation.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

item

      public:
      IDMItem::Handle item(unsigned position)

  Returns the drag item with a given position. If the position is not valid, 0 is returned.
  Note: Positions are 1-based.

Exception

  IInvalidRequest | The drag item handle was not returned. The specified index is not within the valid range.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

numberOfItems

      public:
      unsigned numberOfItems()

  Returns the number of items involved in a direct manipulation. This number is the same as the number of drag items added to the operation's collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeItem

  Removes a drag item from the operation.

  Overload 1

      public:
      IDMOperation& removeItem(unsigned position)

  position
    A value that represents the position of the drag item to remove from the operation's collection.

  Use this version of the function to remove a drag item using a position.
  Note: Positions are 1-based.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      IDMOperation&
        removeItem( const IDMItem::Handle& itemToRemove )

  itemToRemove
    A reference to a handle of a drag item to remove from the operation's collection.

  Use this version of the function to remove a drag item using a reference to the drag item's handle.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

replaceItem

      public:
      IDMOperation&
        replaceItem( unsigned position,
                     const IDMItem::Handle& replacement )

  Replaces a given drag item with another specified drag item.
  Note: Positions are 1-based.

Exception

  IInvalidRequest | The drag item was not replaced. The specified index is not within the valid range.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Drag Operations

Use these members to set and query the default drag operation of the direct manipulation.

operation

      public:
      virtual unsigned long operation() const

  Returns the default drag operation for the direct manipulation. The possible default drag operations include the following:

  - IDMOperation::copy
  - IDMOperation::drag
  - IDMOperation::link
  - IDMOperation::move
  - IDMOperation::unknown

  Application-defined drag operations are assigned a value greater than IDMOperation::unknown.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setOperation

      public:
      virtual IDMOperation& setOperation(unsigned long op)

  Sets the default drag operation for the direct manipulation. Use one of the following operations to identify the default drag operation:

  - IDMOperation::copy
  - IDMOperation::drag
  - IDMOperation::link
  - IDMOperation::move
  - IDMOperation::unknown

  Assign a value greater than IDMOperation::unknown when assigning an application-defined drag operation. Also, you must derive a new target renderer from IDMTargetRenderer and override IDMTargetRenderer::supportsOperation to support the new operation.
  Note: When one of the default operations is set to an operation other than IDMOperation::drag, that operation precludes the use of the augmentation key defined for the operation. For example, IDMOperation::copy allows the copy operation to function without the use of the copy augmentation key that is by default the Ctrl key.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

copy

      public:
      static const unsigned long copy

  Copy operation (the copy augmentation key is pressed).

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

drag

      public:
      static const unsigned long drag

  Drag operation (no augmentation keys are pressed). This is the default operation.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

link

      public:
      static const unsigned long link

  Link operation (the link augmentation keys are pressed).

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

move

      public:
      static const unsigned long move

  Move operation (the move augmentation key is pressed).

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

unknown

      public:
      static const unsigned long unknown

  Unknown operation (application-defined operation codes should be assigned values greater than this value).

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Drag Source Device

Use these members to set and query the type of device that is used to initiate a direct manipulation.

setSource

      public:
      virtual IDMOperation& setSource(Source source)

  Sets the type of the device that is the source of the direct manipulation.
  Note: Generally, you do not call this function. The operating system determines the source of a direct manipulation, and the Open Class Library uses this function to save that information.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

OS/2 Considerations

  The source of a direct manipulation is always the pointing device, IDM::pointingDevice.

source

      public:
      virtual Source source() const

  Returns the type of the device that is the source of the direct manipulation.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

OS/2 Considerations

  The source of a direct manipulation is always the pointing device, IDM::pointingDevice.

### Operation Services

Use these members for various utility services.

dragInfo

      protected:
      _DRAGINFO* dragInfo() const

  Returns the pointer to the drag information structure.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

OS/2 Considerations

  The return value is a pointer to the DRAGINFO structure.

dragWasInterrupted

      protected:
      bool dragWasInterrupted() const

  Returns true if the direct manipulation is interrupted. Interrupts can occur when you do one of the following:

  - Cancel the direct manipulation by pressing the Esc key
  - Request help while dragging over an object
  - Cancel the direct manipulation if the drop is rejected

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setDragInfo

      protected:
      IDMOperation& setDragInfo(_DRAGINFO* dragInfo)

  Sets the pointer to the drag information structure.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

OS/2 Considerations

  The parameter, dragInfo, is a pointer to the DRAGINFO structure.

setDragResult

      protected:
      IDMOperation& setDragResult(bool result)

  Sets the overall result of a direct manipulation. A result of true indicates a successful direct manipulation and false indicates one of the following conditions:

  - The direct manipulation is canceled by pressing the Esc key.
  - Help is requested while dragging over an object.
  - The direct manipulation is canceled if the drop is rejected.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Pointing Device Position

Use these members to set or query the pointing device's position.

position

      public:
      virtual IPoint position() const

  Returns the hot spot of the pointing device within the source or target window.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setPosition

      public:
      virtual IDMOperation& setPosition(IPoint position)

  Sets the hot spot of the pointing device within the source or target window.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Source and Target Window Support

Use these members to set and query the source and target windows.

setSourceWindowHandle

      public:
      virtual IDMOperation&
        setSourceWindowHandle( IWindowHandle window )

  Sets the source window handle for a direct manipulation.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setTargetWindowHandle

      public:
      virtual IDMOperation&
        setTargetWindowHandle( IWindowHandle window )

  Sets the target window handle for a direct manipulation.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

sourceWindow

      public:
      virtual IWindow* sourceWindow() const

  Returns a pointer to the source window for a direct manipulation. Returns 0 if the window is not valid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

sourceWindowHandle

      public:
      virtual IWindowHandle sourceWindowHandle() const

  Returns the handle of the source window for a direct manipulation. Returns IWindowHandle(0) if the window is not valid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

targetWindow

      public:
      virtual IWindow* targetWindow() const

  Returns a pointer to the target window for a direct manipulation. Returns 0 if the window is not valid. For example, if the source window attempts to access the target window before the target window is known, the window is not valid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

targetWindowHandle

      public:
      virtual IWindowHandle targetWindowHandle() const

  Returns the handle of the target window for a direct manipulation. Returns IWindowHandle(0) if the window is not valid. For example, if the source window attempts to access the target window before the target window is known, the window is not valid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IDMOperation - Inherited Member Functions and Data

#### Inherited Public Functions

  IMRefCounted

  -     void addRef()

  -     unsigned long count() const

  -     void removeRef()

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  IMRefCounted

  -     virtual ~IMRefCounted()

  -     IMRefCounted()

  -     IMRefCounted(const IMRefCounted&)

  -     IMRefCounted& operator =(const IMRefCounted&)

#### Inherited Protected Data

  - None