3ds Max C++ API Reference
IDropPackageClipFmt Class Reference

#include <idraganddrop.h>

+ Inheritance diagram for IDropPackageClipFmt:

Public Member Functions

bool CheckClipFormat (IDataObject *pDataObject)
 
DropTypeParseDataObject (IDataObject *pDataObject)
 
- Public Member Functions inherited from DropClipFormat
 DropClipFormat ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Additional Inherited Members

- Static Public Member Functions inherited from DropClipFormat
static CoreExport DropClipFormatFindClipFormat (IDataObject *pDataObject)
 
- 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...
 
- Static Protected Attributes inherited from DropClipFormat
static CoreExport Tab< DropClipFormat * > clipFmts
 

Detailed Description

See also
Class DropClipFormat

Description:
This class represents the iDrop XML package.

Member Function Documentation

◆ CheckClipFormat()

bool CheckClipFormat ( IDataObject *  pDataObject)
virtual
Remarks
This method should be implemented by each subclass to detect the presence of its clipformat(s) in the given IDataObject. See ParseDataObject() below for a detailed example.
Parameters:
IDataObject* pDataObject

The data object.
Returns
TRUE if the data was queries successfully, otherwise FALSE.
Default Implementation:
{ return false; }

Reimplemented from DropClipFormat.

◆ ParseDataObject()

DropType* ParseDataObject ( IDataObject *  pDataObject)
virtual
Remarks
This method should be implemented by each subclass to parse its clipformat(s) in the given IDataObject into the corresponding DropType subclass instance. For example, the DropClipFormats that accept dropped files will typically return one of the FileDropType subclasses depending on the filename suffix. A list of built-in clipformats:

IDropPackageClipFmt iDrop XML package
VIZableClipFmt VIZable file URL
DropScriptClipFmt internal dropScript

Here's an example (simplified) VIZableClipFmt implementation, which accepts a custom CF_MAXURL clip format containing the URL of a file. CheckClipFormat() returns true if it finds the CF_MAXURL clipboard format present in the given IDataObject. Because this is a dropping file, ParseDataObject() clears the current droptype data (the FileDropType::Init(), extracts the file name from the IDataObject and installs it into the FileDropType current_package variable. It then asks the FileDropType class to recognize the actual file type being dropped and return the corresponding FileDropType subclass instance (using FileDropType::FindDropType()).

bool VIZableClipFmt::CheckClipFormat(IDataObject* pDataObject)
{
// accept CF_MAXURL clip formats
FORMATETC fmt = { NULL, NULL, DVASPECT_CONTENT, -1, NULL };
fmt.cfFormat = RegisterClipboardFormat(_M("CF_MAXURL"));
fmt.tymed = TYMED_HGLOBAL;
return SUCCEEDED(pDataObject->QueryGetData(&fmt)) ==
TRUE;
}
DropType* VIZableClipFmt::ParseDataObject(IDataObject* pDataObject)
{
// parse a CF_MAXURL clipformat into one of the FileDropTypes
&
// fill in the FileDropType::current_packge URLTab
HRESULT hr;
FORMATETC fmt = { NULL, NULL, DVASPECT_CONTENT, -1, NULL };
STGMEDIUM stg = { TYMED_NULL, NULL, NULL };
fmt.tymed = TYMED_HGLOBAL;
fmt.cfFormat = RegisterClipboardFormat(_M("CF_MAXURL"));
// clear out the file drop current data
// look for CF_MAXURL formats
hr = pDataObject->GetData(&fmt, &stg);
if(SUCCEEDED(hr)) {
// found, get the max file name
MCHAR szUrl[MAX_PATH];
ZeroMemory(szUrl, sizeof(szUrl));
wcstombs(szUrl,
reinterpret_cast<wchar_t*>(GlobalLock(stg.hGlobal)),
MAX_PATH-1);
GlobalUnlock(stg.hGlobal);
ReleaseStgMedium(&stg);
// add it to the current_package URLTab
}
// if we have a non-NULL package, get the appropriate
// FileDropType (usually based on file extension), by asking the
// utility DropType finder in FileDropType
else
return NULL;
}
#define NULL
Definition: autoptr.h:18
Definition: idraganddrop.h:757
static CoreExport FileDropType * FindDropType(const MCHAR *filename, IDataObject *pDataObject=NULL)
static void Init()
Definition: idraganddrop.h:910
static CoreExport URLTab current_package
Definition: idraganddrop.h:903
CoreExport void Add(const MCHAR *url)
bool CheckClipFormat(IDataObject *pDataObject)
DropType * ParseDataObject(IDataObject *pDataObject)
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67
#define MCHAR
MBCS/Unicode helper defines std::wofstream doesn't mix well with Unicode.
Definition: strbasic.h:42
Parameters:
IDataObject* pDataObject

The data object.
Returns
A pointer to the drop-type.
Default Implementation:
{ return NULL; }

Reimplemented from DropClipFormat.