Class DropType
See Also: Class DropClipFormat, Class FileDropType, Class DropScriptDropType , List of DropTypes
class DropType : public IDropSource, public IDataObject
Description:
This class is available in release 4.0 and later only.
This is the base class for droppable content types. Distinguished instances of subclasses represent different types of drop content, such as a file distinguished by file suffix or a scene object The active DropClipFormat parses dropped IDataObject into one of these dropped types, filling its data members with appropriate guff from the data object.
Each DropClipFormat can encompass multiple possible types of dropped data. For example, the iDrop package can drop max files, image files, script files, etc. The DropClipFormat classes parse raw dropped clipboard data into one of the DropType family of classes. These contain recognizer predicates, extracted data from the current drop, and utilities for working with the data, such as URL downloads, script compile & execution, etc. Custom drop-types can be created by subclassing one of the DropType base classes. The built-in DropTypes are listed in the List of DropTypes
Data Members:
protected:
static IDragAndDropMgr* dndMgr;
Cached pointer to the DnD manager.
static bool dragging;
The drop source state.
static POINT startPt;
The drag and drop starting point.
static WPARAM startKeyState;
They starting state of the keyboard.
static HWND startWnd;
The handle to the starting window.
static bool loaded;
Flags if the current packages is already downloaded.
public:
static IDataObject* current_dataobject;
Currently dropping IDataObject. Filled in by the low-level DragEnter() code.
Methods:
public:
Prototype:
DropType();
Remarks:
Constructor.
Prototype:
static void Init();
Remarks:
This method clears the currently-parsed drop data.
Default Implementation:
{ current_dataobject = NULL; loaded = false; }
Prototype:
virtual int TypeCode()=0;
Remarks:
This method returns the typecode of the DropType.
Prototype:
virtual bool IsDropType(int code);
Remarks:
This method returns TRUE if the DropType is of the specified DropType code, otherwise FALSE.
Each DropType subclass is given a unique integer code that can be used for type-testing, switching, etc. The TypeCode() method must be implemented to return this code and isDropType() to test against the given code (this is provided to that intermediate DropType base classes with codes can effectively support superclass testing). The codes for the built-in DropTypes are given by the following defined symbols which are listed in the List of DropTypes
Parameters:
int code
The DropType code.
Default Implementation:
{ return code == TypeCode(); }
Prototype:
virtual bool Load(bool showProgress = true);
Remarks:
Subclasses should implement this method if they need to perform any droptype-specific loading prior to clipformat data use. For example, the URL package types all download any web-resident files in this method. Control any implemented progress dialog with the showProgress parameter.
Parameters:
bool showProgress = true
The download progress dialog can be displayed by passing true.
Default Implementation:
{ return true; }
Prototype:
virtual DWORD DropEffect();
Remarks:
This method returns the dropeffect currently supported by the accepted dropping type.
Default Implementation:
{ return DROPEFFECT_MOVE; }