wx.CustomDataObject is a specialization of wx.DataObjectSimple for some application-specific data in arbitrary (either custom or one of the standard ones).
The only restriction is that it is supposed that this data can be copied bitwise (i.e. with memcpy()
), so it would be a bad idea to make it contain a C++ object (though C struct is fine).
By default, wx.CustomDataObject stores the data inside in a buffer. To put the data into the buffer you may use either SetData
or TakeData
depending on whether you want the object to make a copy of data or not.
This class may be used as is, but if you don’t want store the data inside the object but provide it on demand instead, you should override GetSize
, GetData
and SetData
(or may be only the first two or only the last one if you only allow reading/writing the data).
See also
__init__ |
The constructor accepts a format argument which specifies the (single) format supported by this object. |
GetAllFormats |
Returns a list of wx.DataFormat objects which this data object |
GetData |
Returns a reference to the data buffer. |
GetSize |
Returns the data size in bytes. |
SetData |
Copies data from the provided buffer to this data object’s buffer |
wx.
CustomDataObject
(DataObjectSimple)¶Possible constructors:
CustomDataObject(format=FormatInvalid)
CustomDataObject(formatName)
CustomDataObject is a specialization of DataObjectSimple for some application-specific data in arbitrary (either custom or one of the standard ones).
__init__
(self, *args, **kw)¶__init__ (self, format=FormatInvalid)
The constructor accepts a format argument which specifies the (single) format supported by this object.
If it isn’t set here, wx.DataObjectSimple.SetFormat
should be used.
Parameters: | format (wx.DataFormat) – |
---|
__init__ (self, formatName)
GetAllFormats
(self, dir=DataObject.Get)¶Returns a list of wx.DataFormat objects which this data object supports transferring in the given direction.
GetData
(self)¶Returns a reference to the data buffer.
Return type: | PyObject |
---|
GetSize
(self)¶Returns the data size in bytes.
Return type: | int |
---|
SetData
(self, *args, **kw)¶SetData (self, buf)
Copies data from the provided buffer to this data object’s buffer
Return type: | bool |
---|
SetData (self, format, buf)
Return type: | bool |
---|
AllFormats
¶See GetAllFormats