CP_M_DragTarget provides methods to handle users dropping files.
CP_M_DragSource provides methods to handle supplying data when transferring information between CPLAT classes via drag and drop.
You can see drag and drop in operation by building and running the DragDrop demo in the demos folder.
When the flag is set, and a user drops an item onto one of your view objects, the method OnDragReceive() will be called with the items that have been dropped. In order for a view to indicate that an item is acceptable, it needs to override the OnCanAcceptDrag() method, and return true if the item is acceptable.
OnDragReceive() will pass in a CP_DragDrop object that contains a CP_DataStream object for the dropped item. The CP_DataStream in turn contains a list of CP_DataStreamItems, one for each of the dropped items in the drag and drop. The CP_DataStreamItem then contains the type of flavor and data for each individual flavor in the dropped item.
Some items may contain only a single item flavor, while others may contain multiple item flavors.
DragSourceView::HandleControlHitEvent( CPLAT::CP_Event_Base& inEvent )
{
CPLAT::CP_DragDrop dragDrop;
AddFlavor( dragDrop, kFlavorTypeColor, &swatchColor, sizeof(swatchColor) );
TrackDrag( dragDrop, inEvent );
}
The AddFlavor call is the method you use to supply data for the drag source item.