The data provider (source) duties

The data provider is responsible for creating a wxDataObject containing the data to be transferred. Then it should either pass it to the clipboard using SetData function or to wxDropSource and call DoDragDrop function.

The only (but important) difference is that the object for the clipboard transfer must always be created on the heap (i.e. using new) and it will be freed by the clipboard when it is no longer needed (indeed, it is not known in advance when, if ever, the data will be pasted from the clipboard). On the other hand, the object for drag and drop operation must only exist while DoDragDrop executes and may be safely deleted afterwards and so can be created either on heap or on stack (i.e. as a local variable).

Another small difference is that in the case of clipboard operation, the application usually knows in advance whether it copies or cuts (i.e. copies and deletes) data - in fact, this usually depends on which menu item the user chose. But for drag and drop it can only know it after DoDragDrop returns (from its return value).

ymasuda 平成17年11月19日