The Common Desktop Environment provides a drag-and-drop API, that is layered on top of the Motif 1.2 drag-and-drop API, to provide convenient, consistent, and interoperable drag and drop across the desktop. The Common Desktop Environment drag-and-drop API makes it easier for developers to implement drag and drop. With drag and drop, users can manipulate objects on the screen directly by grabbing them, dragging them around the display, and dropping them on other objects to change the object's location or perform a data transfer.
Motif 1.2 drag and drop provides low-level drag-and-drop mechanisms; Common Desktop Environment drag and drop incorporates policies for those mechanisms.
Common Desktop Environment drag and drop consists of an API and protocols to simplify the interface to Motif drag and drop. It implements policies such as the buffer transfer protocol and the drag cursors' appearances. Use the Common Desktop Environment drag-and-drop API, with its built-in policies, to ensure interoperability through consistency. Common Desktop Environment drag-and-drop policies are compatible with standard Motif 1.2 drag-and-drop protocols for text and file name transfers.
Common Desktop Environment drag and drop uses the X selection mechanism to transfer data. Suitable targets exist and are registered with the X Consortium. Two desktop applications can agree to transfer data through the text, file name, or data transfer protocols.
The existing Motif 1.2 API for drag and drop is flexible and, therefore, is somewhat difficult for nonexpert developers to use. The Common Desktop Environment drag-and-drop API provides some convenience functions that result in an API that is simpler and easier to use:
Manages the configuration and appearance of drag icons.
Common Desktop Environment drag and drop provides graphics for the default source, state, and operation icons that compose the drag icon in Motif 1.2.
Defines a buffer transfer protocol.
Motif 1.2 drag and drop defines protocols for file name and text string only.
Enables animation upon drop.
The drop zone can define an animation procedure that is called when the drop completes.
Provides enumeration of targets for TEXT and FILE_NAME transfers.
Provides dual registration.
You can register a text widget as a drop zone for data other than text, while preserving the ability to accept text drops.
Provides prioritized drop formats.
The order in which you specify protocols for the drop zone indicates the relative priority of the protocols desired.
The Desktop Services library, libDtSvc, provides access to many desktop APIs, including that for drag and drop. Include the Dt/Dt.h and Dt/Dnd.h header files to access the drag-and-drop API.
If your application uses any of the drag-and-drop APIs, it must first initialize the libDtSvc library by calling either DtInitialize() or DtAppInitialize(). Refer to the DtInitialize(3) or DtAppInitialize(3) man page for more information.
You can find the drag-and-drop demos in /usr/dt/examples/dtdnd. Read the README file for detailed information on the demos.
For more information on Common Desktop Environment drag and drop, see the relevant man pages and the Solaris Common Desktop Environment: Programmer's Guide.