C++ API Reference
MExternalDropData Class Reference

Drag-and-drop data, used with MExternalDropCallback. More...

#include <MExternalDropData.h>

Public Member Functions

bool hasText () const
 Query whether the drop contains text data. More...
 
MString text () const
 Obtain the text data contained in the drop, if any. More...
 
bool hasUrls () const
 Query whether the drop contains URL data. More...
 
MStringArray urls () const
 Obtain the URL data contained in the drop, if any. More...
 
bool hasHtml () const
 Query whether the drop contains html data. More...
 
MString html () const
 Obtain the html data contained in the drop, if any. More...
 
bool hasColor () const
 Query whether the drop contains color data. More...
 
MColor color () const
 Obtain the color data contained in the drop, if any. More...
 
bool hasImage () const
 Query whether the drop contains image data. More...
 
MImage image () const
 Obtain the image data contained in the drop, if any. More...
 
MStringArray formats () const
 Obtain the list of data formats contained in the drop. More...
 
bool hasFormat (const MString &format) const
 Query whether the drop contains data in a given format. More...
 
unsigned int dataSize (const MString &format) const
 Return the size (in bytes) of the data with the given format contained in the drop. More...
 
MStatus copyData (const MString &format, void *buffer, unsigned int bufferSize) const
 This method is not available in Python. More...
 
int keyboardModifiers () const
 Return the modifier state for this drop. More...
 

Protected Attributes

OPENMAYA_PRIVATE int mouseButtons
 Return the mouse button state for this drop. More...
 

Detailed Description

Drag-and-drop data, used with MExternalDropCallback.

MExternalDropData is the data that a drag-and-drop operation carries if dragging from an external application and dropping onto Maya.

It typically arrives from a MExternalDropCallback callback method.

Examples:
externalDropCallback/externalDropCallback.cpp.

Member Function Documentation

bool hasText ( ) const

Query whether the drop contains text data.

Returns
  • true the drop contains text data
  • false the drop does not contain text data
Examples:
externalDropCallback/externalDropCallback.cpp.
MString text ( ) const

Obtain the text data contained in the drop, if any.

Returns
the text data, as a string
Examples:
externalDropCallback/externalDropCallback.cpp.
bool hasUrls ( ) const

Query whether the drop contains URL data.

Returns
  • true the drop contains URL data
  • false the drop does not contain URL data
Examples:
externalDropCallback/externalDropCallback.cpp.
MStringArray urls ( ) const

Obtain the URL data contained in the drop, if any.

Returns
the URL data, as an array of strings
Examples:
externalDropCallback/externalDropCallback.cpp.
bool hasHtml ( ) const

Query whether the drop contains html data.

Returns
  • true the drop contains html data
  • false the drop does not contain html data
MString html ( ) const

Obtain the html data contained in the drop, if any.

Returns
the html data, as a string
bool hasColor ( ) const

Query whether the drop contains color data.

Returns
  • true the drop contains color data
  • false the drop does not contain color data
MColor color ( ) const

Obtain the color data contained in the drop, if any.

Returns
the color data, as an MColor
bool hasImage ( ) const

Query whether the drop contains image data.

Returns
  • true the drop contains image data
  • false the drop does not contain image data
MImage image ( ) const

Obtain the image data contained in the drop, if any.

Returns
the image data, as an MImage
MStringArray formats ( ) const

Obtain the list of data formats contained in the drop.

Returns
the formats, as an array of strings
Examples:
externalDropCallback/externalDropCallback.cpp.
bool hasFormat ( const MString format) const

Query whether the drop contains data in a given format.

The result will be true iff the format is contained in the result of the formats() method.

Parameters
[in]formatThe format to look for.
Returns
  • true the drop contains data with the given format
  • false the drop does not contain data with the given format
unsigned int dataSize ( const MString format) const

Return the size (in bytes) of the data with the given format contained in the drop.

Parameters
[in]formatThe format to look for.
Returns
the size of the data, in bytes (zero if the format is not present)
MStatus copyData ( const MString format,
void *  buffer,
unsigned int  bufferSize 
) const

This method is not available in Python.

Copy the data with the given format contained in the drop to a buffer.

Parameters
[in]formatThe format to look for.
[in]bufferThe buffer to which to copy the data.
[in]bufferSizeThe size of the buffer (in bytes).
Returns
status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed - the buffer was not large enough to contain the data
  • MS::kInvalidParameter the given format was not present
int keyboardModifiers ( ) const

Return the modifier state for this drop.

Use MExternalDropData::KeyboardModifiers bitmask to distinguish the states.

Returns
the modifier state

Member Data Documentation

int mouseButtons
protected

Return the mouse button state for this drop.

Use MExternalDropData::MouseButtons bitmask to distinguish the states.

Returns
the mouse button state

The documentation for this class was generated from the following files: