Search for an entry in the data_array for an incoming drag-and-drop event.
int PtGetDndFetchIndex( const PtDndCallbackInfo_t * cbinfo, const PtDndFetch_t * data_array, unsigned array_size);
ph
This function determines if the drag-and-drop data from the event found in the PtDndCallbackInfo_t matches any of the transport types in the data_array.
In this example, we determine the index in the data_array for the incoming drag-and-drop event:
PtDndCallbackInfo_t *dndcb = cbinfo->cbdata; static PtDndFetch_t FetchTypes[] = { {"PhTransfiles", NULL, Ph_TRANSPORT_INLINE, }, }; /* * ARRAY_SIZE is defined as follows. */ #define ARRAY_SIZE ( m_array ) ( sizeof( m_array ) / sizeof( m_array[0] ) ) int dnd_callback( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo ) { switch( cbinfo->reason_subtype ) { case Ph_EV_DND_ENTER: num_matches = PtDndSelect( widget, FetchTypes, ARRAY_SIZE( FetchTypes ) ) break; case Ph_EV_DND_DROP: switch( PtGetDndFetchIndex( dndcb, FetchTypes, ARRAY_SIZE( FetchTypes ) ) ) { case 0: //file . . . break; } . . . break; } return( Pt_CONTINUE ); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PtDndFetch_t, PtDndSelect(), PtInitDnd(), PtReleaseTransportCtrl() PtTransportCtrl_t, PtTransportType()
Drag and Drop chapter of the Photon Programmer's Guide