IDirectManipulationCompositor::AddContent method (directmanipulation.h)

Associates content (owned by the caller) with the compositor, assigns a composition device to the content, and specifies the position of the content in the composition tree relative to other composition visuals.

Syntax

HRESULT AddContent(
  [in]           IDirectManipulationContent *content,
  [in, optional] IUnknown                   *device,
  [in]           IUnknown                   *parentVisual,
  [in]           IUnknown                   *childVisual
);

Parameters

[in] content

The content to add to the composition tree.

content is placed between parentVisual and childVisual in the composition tree.

[in, optional] device

The device used to compose the content.

Note  device is created by the application.
 

[in] parentVisual

The parent visuals in the composition tree of the content being added.

parentVisual must also be a parent of childVisual in the composition tree.

[in] childVisual

The child visuals in the composition tree of the content being added.

parentVisual must also be a parent of childVisual in the composition tree.

Return value

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method inserts a small visual tree (owned by the Direct Manipulation device) between the parentVisual and the childVisual. Transforms can then be applied to the inserted content.

All content, regardless of type, must be added to the compositor. This can be primary content, obtained from the viewport by calling GetPrimaryContent, or secondary content, such as a panning indicator, created by calling CreateContent.

If the application uses a system-provided IDirectManipulationCompositor:

  • device must be an IDCompositionDevice object, and parent and child visuals must be IDCompositionVisual objects.
  • device, parentVisual, and childVisual cannot be NULL.
  • device, parentVisual, and childVisual objects are created and owned by the application.
  • When content is added to the composition tree using this method, the new composition visuals are inserted between parentVisual and childVisual. The new visuals should not be destroyed until they are disassociated from the compositor with RemoveContent.
If the application uses a custom implementation of IDirectManipulationCompositor:
  • device, parentVisual, and childVisual must be a valid type for the compositor. They do not have to be IDCompositionDevice or IDCompositionVisual objects.
  • device, parentVisual, and childVisual can be NULL, depending on the compositor.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header directmanipulation.h

See also

IDirectManipulationCompositor