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:
- type_name
- A string that must match the type string in the data being dropped.
- description
- 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.
- transport
- 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.
- select_flags
- Flags that control various aspects of data selection and interaction
in a drag-and-drop operation:
- Pt_DND_SELECT_DATA_DUP
or Pt_DND_SELECT_DUP_DATA —
the entry is a different representation of the previous fetch array
element (e.g. a plain text version of HTML).
- Pt_DND_SELECT_MOTION — if this entry is selected
on a drag-and-drop enter, drag-and-drop motion events are received.
- Pt_DND_SELECT_MULTIPLE — select all data that
matches the criteria, not just the first match.
- user_data
- 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.
- select_cb
- 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.
- request_cb
- 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.
- transport_malloc
- 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.
- transport_malloc_cb_data
- Data that's passed to the transport_malloc function.
Photon
PtCreateTransportCtrl(),
PtDndSelect(),
PtInitDnd(),
PtTransportType()
Drag and Drop chapter
of the Photon Programmer's Guide