Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

PtGetDndFetchIndex()

Search for an entry in the data_array for an incoming drag-and-drop event.

Synopsis:

int PtGetDndFetchIndex(
       const PtDndCallbackInfo_t * cbinfo,
       const PtDndFetch_t * data_array,
       unsigned array_size);

Arguments:

dndcb
A pointer to the drag-and-drop callback data.
data_array
A pointer to an array of transport types that the widget accepts in drag-and-drop events. For more information see PtDndFetch_t.
array_size
The number of items in data_array.

Library:

ph

Description:

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.

Returns:

The index in the data_array for drag-and-drop event
A match was found.
-1
No entry is found.

Examples:

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 );
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtDndFetch_t, PtDndSelect(), PtInitDnd(), PtReleaseTransportCtrl() PtTransportCtrl_t, PtTransportType()

Drag and Drop chapter of the Photon Programmer's Guide