See the Input samples and documentation for more information on using interactors and on handling mouse events.
The supported enablers directory contains a templatized version of TScrapItem, TScrapItemOn<>, which facilitates the creation of new scrap items; and a derived class of TDragAndDropItem, TSimpleDragAndDropItem, which illustrates how to support multiple scrap item types with one drag-and-drop item.
TSingleDragAndDropItem is defined in SingleDragAndDropItem.h and SingleDragAndDropItem.C. It inherits from TDragAndDropItem and overrides CopyAvailableTypes and FindItemMatchingDescription. It holds a single scrap item and implements these member functions to access and query the type information of that scrap item.
TColorAcceptorView is defined in ColorAcceptorView.h and ColorAcceptorView.C It inherits from MDropAcceptor and overrides ChoosePreferredType and AcceptDrop to indicate which scrap item types it accepts and to take specific action when a drop occurs. It only accepts the type exported by TColorScrapItem. When it accepts a drop of this type, it sets the color to the color contained by that item.
TColorSourceView is defined in ColorSourceView.h and ColorSourceView.C. It inherits from MMouseEventHandler and overrides MouseButtonDown to start the drag interaction. (For more information on writing views that handle mouse input, see the Input samples and documentation). TColorSourceView instantiates a TColorScrapItem with its color, and instantiates a TSingleDragAndDropItem, handing it the item it created. This item and a graphic to be displayed while dragging are handed to an instance of TMouseDragAndDropInteractor, which is then passed to the input system via TEvent::StartInteractor.