IDragAndDropMgr Class Reference

#include <idraganddrop.h>

Class Description

Manager class for Drag and Drop The Drag and Drop system is managed through a Core FP interface (DND_MGR_INTERFACE), defined by this class.

It provides control over the drag and drop system, manages handler registration and exposes some useful utility methods for downloading URL's, simulating drops, etc.

The DragAndDropMgr supports multiple DragAndDropHandler's registered against a single HWND window. This allows new components and 3rd-party developers to incrementally add handlers for new dropTypes to common windows such as viewports, that the default handlers don't know how to handle.

The IDragAndDropMgr::EnableDandD(HWND hwnd, BOOL flag, DragAndDropHandler* handler) method can be called multiple times on the same window with different handler instances. The drag and drop manager keeps track of all the DragAndDropHandlers on each window and will call their drag and drop event methods as needed, in order of registration, until one of them returns S_OK. For example, on a viewport, the DefaultDragAndDropHandler is registered by default. The event methods (such as DragEnter, DragOver, Drop, etc.) return E_FAIL if the dropping IDataObject or DropType is not recognized by them. Then, if a new component registers its own handler to deal with some new droptype, the default handler will fail to recognize the new droptype and so the new handler will be called to process the new drop type.

Note that this means DragAndDropHandler event methods must correctly return S_OK or E_FAIL depending on whether they handle the IDataObject or DropType currently dropping, so that the appropriate handler is found and called by the DnDMgr.

Note
In Max 2011, the management of DragAndDropHandler memory lifetime was changed. In previous versions, it was up to 3rd party developers to 'unregister' (Passing in FALSE to IDragAndDropMgr::EnableDandD) their drag and drop handlers (DragAndDropHandler*), before max was shutdown. If they didn't max would crash on shutdown. Now, unitialization has been moved up before 3rd party plugins are unloaded. Now, the manager automatically 'unregisters' all DragAndDropHandler pointers during a broadcast of NOTIFY_SYSTEM_SHUTDOWN. This means that the manager calls DragAndDropHandler::Release on all DragAndDropHandler pointers registered with it. After the manager cleans up during the NOTIFY_SYSTEM_SHUTDOWN broadcast, any subsequent calls to register a drag and drop handler will return FALSE. Also any subsequent calls to 'unregister' a handler will just silently do nothing.
See also
Class FPStaticInterface, Class DragAndDropHandler, Class URLTab
+ Inheritance diagram for IDragAndDropMgr:

Public Member Functions

virtual void EnableDandD (BOOL flag)=0
 Globally enables or disables the drag and drop interface. More...
 
virtual BOOL IsEnabled ()=0
 returns TRUE if the global drag and drop interface is enabled, otherwise FALSE. More...
 
virtual BOOL EnableDandD (HWND hwnd, BOOL flag, DragAndDropHandler *handler=NULL)=0
 Enables drag and drop for a given window (and its children). More...
 
virtual BOOL DropPackage (HWND hwnd, POINT &point, URLTab &package)=0
 This method allows the simulation of a package of files into a window at a given point. More...
 
virtual BOOL DownloadPackage (URLTab &package, const MCHAR *directory, HWND hwnd=NULL, bool showProgress=false)=0
 Used to download a package of URLs to the specified directory. More...
 
virtual const MCHARGetDownloadDirectory ()=0
 Returns the fully-specified path to the directory in which package drops are downloaded. More...
 
virtual int NumHandlers (HWND hwnd)=0
 Gets the number of handlers associated with the given window. More...
 
virtual DragAndDropHandlerGetHandler (HWND hwnd, int i)=0
 Returns a pointer to a specified drag and drop hander of a specified window. More...
 
virtual bool DownloadUrlToDisk (HWND hwnd, const MCHAR *url, const MCHAR *fileName, DWORD dlgflags=0)=0
 Downloads the file referenced by the URL to disk. More...
 
virtual INodeImportContextNode ()=0
 Returns a pointer to the import context node. More...
 
- Public Member Functions inherited from FPInterfaceDesc
CoreExport FPInterfaceDesc ()
 
CoreExport FPInterfaceDesc (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, ULONG flag,...)
 
CoreExport ~FPInterfaceDesc ()
 
virtual void Init ()
 
LifetimeType LifetimeControl ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
CoreExport void LoadDescriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *pCD, ULONG flag,...)
 
CoreExport void AppendFunction (int id,...)
 Add a new function to this interface descriptor. More...
 
CoreExport void AppendProperty (int id,...)
 Add a new property to this interface descriptor. More...
 
CoreExport void AppendEnum (int id,...)
 Add a new enum to this interface descriptor. More...
 
CoreExport void SetClassDesc (ClassDesc *i_cd)
 
CoreExport va_list check_fn (va_list ap, int id)
 
CoreExport va_list scan_fn (va_list ap, int id, int index)
 
CoreExport va_list check_prop (va_list ap, int id)
 
CoreExport va_list scan_prop (va_list ap, int id, int index)
 
CoreExport va_list check_enum (va_list ap, EnumID id)
 
CoreExport va_list scan_enum (va_list ap, EnumID id, int index)
 
FPInterfaceDescGetDesc ()
 
Interface_ID GetID ()
 
CoreExport FPFunctionDefGetFnDef (FunctionID fid)
 
ActionTableGetActionTable ()
 
CoreExport void EnableActions (BOOL onOff)
 
virtual CoreExport HINSTANCE HInstance ()
 
virtual CoreExport const MCHARGetRsrcString (StringResID id)
 
- Public Member Functions inherited from FPInterface
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t=0, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPParams *params)
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t, FPValue &result, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPValue &result, FPParams *params=NULL)
 
virtual CoreExport FunctionID FindFn (const MCHAR *name)
 
virtual CoreExport BOOL IsEnabled (FunctionID actionID)
 
virtual CoreExport BOOL IsChecked (FunctionID actionID)
 
virtual CoreExport BOOL IsVisible (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsEnabled (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsChecked (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsVisible (FunctionID actionID)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 
- Public Attributes inherited from FPInterfaceDesc
Interface_ID ID
 
MSTR internal_name
 
StringResID description
 
ClassDesccd
 
USHORT flags
 
Tab< FPFunctionDef * > functions
 
Tab< FPPropDef * > props
 
Tab< FPEnum * > enumerations
 
MSPluginClass * pc
 
Rolloutrollout
 
ActionTableaction_table
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPInterfaceDesc
CoreExport void load_descriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, USHORT flag, va_list ap)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 

Member Function Documentation

virtual void EnableDandD ( BOOL  flag)
pure virtual

Globally enables or disables the drag and drop interface.

Parameters
flag- TRUE to enable, FALSE to disable.
virtual BOOL IsEnabled ( )
pure virtual

returns TRUE if the global drag and drop interface is enabled, otherwise FALSE.

virtual BOOL EnableDandD ( HWND  hwnd,
BOOL  flag,
DragAndDropHandler handler = NULL 
)
pure virtual

Enables drag and drop for a given window (and its children).

If no custom DragAndDropHandler is supplied, a default one is used that will accept dropped scene files for opening and scripts for running. When the application is shutting down, it is prohibited to enable or disable a handler. Therefore after a NOTIFY_SYSTEM_SHUTDOWN broadcast this method will always return FALSE.

Parameters
hwnd- A handle to the window you wish to enable or disable drag and drop for.
flag- TRUE to enable, FALSE to disable.
handler- A pointer to a custom drag and drop handler, or NULL to accept a default one.
Returns
TRUE if the method was successful, otherwise FALSE.
virtual BOOL DropPackage ( HWND  hwnd,
POINT &  point,
URLTab package 
)
pure virtual

This method allows the simulation of a package of files into a window at a given point.

A package of files, specified as a list of URL strings is the common form of DropType data from iDrop sources and files dragged from the Windows desktop. The entire package is downloaded, as needed, but only the first file in the list is actually dropped into 3ds Max. The other files in the package are presumed to be support files, such as texmaps or xref sources, for the main drop file.

After the drop, the URL strings in the URLTab are converted to fully-specified path names to local file copies, if any had to be downloaded from the web.

Parameters
hwnd- A handle to the window. If this is set to NULL, the default 3ds Max window is used.
point- The point at which to drop.
package- A reference to the local copies of the URL strings.
Returns
TRUE if the drop was successful, otherwise FALSE.
virtual BOOL DownloadPackage ( URLTab package,
const MCHAR directory,
HWND  hwnd = NULL,
bool  showProgress = false 
)
pure virtual

Used to download a package of URLs to the specified directory.

If the hwnd argument is supplied, any progress or other messages are centered over that window.

Parameters
package- A reference to the local copies of the URL strings.
directory- The directory path string to download to.
hwnd- A handle to the window. If this is set to NULL, the default window is used.
showProgress- The download progress dialog can be displayed by passing true.
Returns
TRUE if the download was successful, otherwise FALSE.
virtual const MCHAR* GetDownloadDirectory ( )
pure virtual

Returns the fully-specified path to the directory in which package drops are downloaded.

virtual int NumHandlers ( HWND  hwnd)
pure virtual

Gets the number of handlers associated with the given window.

Parameters
hwnd- A handle to the window.
virtual DragAndDropHandler* GetHandler ( HWND  hwnd,
int  i 
)
pure virtual

Returns a pointer to a specified drag and drop hander of a specified window.

Parameters
hwnd- A handle to the window.
i- The I-th handler.
virtual bool DownloadUrlToDisk ( HWND  hwnd,
const MCHAR url,
const MCHAR fileName,
DWORD  dlgflags = 0 
)
pure virtual

Downloads the file referenced by the URL to disk.

Parameters
hwnd- A handle to the window.
url- The URL string of the file to download.
fileName- The filename string of the URL to store on disk.
dlgflags- Additional controls to the download behavior. Currently only one flag is supported, DOWNLOADDLG_NOPLACE, which hides an option in the progress dialog that allows the user to place (move) a dropped object immediately after being dropped.
Returns
TRUE if the download was successful, otherwise FALSE.
virtual INode* ImportContextNode ( )
pure virtual

Returns a pointer to the import context node.