Caution: This version of this document is no longer maintained. For the latest documentation, see


Structure that defines data types a widget accepts from a drag-and-drop event


typedef struct ptdndfetch PtDndFetch_t;

struct ptdndfetch {
    char              *type_name;
    char              *description;
    int unsigned       transport;
    int unsigned       select_flags;
    void              *user_data;
    PtSelectFunc_t    *select_cb;
    PtRequestFunc_t   *request_cb;
    TransportMalloc_t *transport_malloc;
    void              *transport_malloc_cb_data;


The PtDndFetch_t structure is used to define the data types a widget accepts from a drag-and-drop event. It contains at least the following members:

A string that must match the type string in the data being dropped.
A regular expression that's compared with the description of the data being dropped. A description of NULL is a “don't care” and matches all descriptions.
Indicates the acceptable transport methods to get the data. A value of ~0 means that any method is acceptable. See <PhTransport.h> for the defined transport types.
Flags that control various aspects of data selection and interaction in a drag-and-drop operation:
A convenient place to keep a reference. An index into the PtDndFetch_t array is provided to the Pt_CB_DND callback when invoked due to a drop, which makes finding user_data easy.
If provided, this callback is invoked and its return value is used to determine if a piece of the data being dragged should be selected for drop acceptance or not. The return value of the function must be a transport type to select the data, or 0 to prevent that data from being unpacked on a drop event. See <PhTransport.h> for the defined transport types.
An optional callback that's called before asking the source for data. The parameters of the data request can be modified in the callback, or the request can be canceled altogether.
An optional allocation function that's called when unpacking drag-and-drop data. It's useful for placing portions of unpacking data into shared memory areas and so on.
Data that's passed to the transport_malloc function.



See also:

PtCreateTransportCtrl(), PtDndSelect(), PtInitDnd(), PtTransportType()

Drag and Drop chapter of the Photon Programmer's Guide