.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.CustomDataObject:

==========================================================================================================================================
|phoenix_title|  **wx.CustomDataObject**
==========================================================================================================================================

:ref:`wx.CustomDataObject`  is a specialization of :ref:`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, :ref:`wx.CustomDataObject`  stores the data inside in a buffer. To put the data into the buffer you may use either :meth:`~wx.CustomDataObject.SetData`  or :meth:`~wx.CustomDataObject.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 :meth:`~wx.CustomDataObject.GetSize`, :meth:`~wx.CustomDataObject.GetData`  and :meth:`~wx.CustomDataObject.SetData`  (or may be only the first two or only the last one if you only allow reading/writing the data). 







         



.. seealso:: :ref:`wx.DataObject`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>CustomDataObject</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.CustomDataObject_inheritance.png" alt="Inheritance diagram of CustomDataObject" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.DataObjectSimple.html" title="wx.DataObjectSimple" alt="" coords="7,83,165,112"/> <area shape="rect" id="node3" href="wx.CustomDataObject.html" title="wx.CustomDataObject" alt="" coords="5,160,168,189"/> <area shape="rect" id="node2" href="wx.DataObject.html" title="wx.DataObject" alt="" coords="29,5,144,35"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.CustomDataObject.__init__`                                            The constructor accepts a `format`  argument which specifies the (single) format supported by this object.
:meth:`~wx.CustomDataObject.GetAllFormats`                                       Returns a list of wx.DataFormat objects which this data object
:meth:`~wx.CustomDataObject.GetData`                                             Returns a reference to the data buffer.
:meth:`~wx.CustomDataObject.GetSize`                                             Returns the data size in bytes.
:meth:`~wx.CustomDataObject.SetData`                                             Copies data from the provided buffer to this data object's buffer
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.CustomDataObject.AllFormats`                                          See :meth:`~wx.CustomDataObject.GetAllFormats`
:attr:`~wx.CustomDataObject.Data`                                                See :meth:`~wx.CustomDataObject.GetData` and :meth:`~wx.CustomDataObject.SetData`
:attr:`~wx.CustomDataObject.Size`                                                See :meth:`~wx.CustomDataObject.GetSize`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: 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).



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__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, :meth:`wx.DataObjectSimple.SetFormat`   should be used.                  
      
      
      :param `format`: 
      :type `format`: wx.DataFormat
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, formatName)`
      
      
      
      
      
      **~~~**






   .. method:: GetAllFormats(self, dir=DataObject.Get)

                              Returns a list of wx.DataFormat objects which this data object
                              supports transferring in the given direction.  





   .. method:: GetData(self)

      Returns a reference to the data buffer. 

      :rtype: :ref:`PyObject`








   .. method:: GetSize(self)

      Returns the data size in bytes.                  

      :rtype: `int`








   .. method:: SetData(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **SetData** `(self, buf)`
      
      Copies data from the provided buffer to this data object's buffer 
      
      :rtype: `bool`
      
      
      
      
      
      
      
      **~~~**

      
      **SetData** `(self, format, buf)`
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      **~~~**






   .. attribute:: AllFormats

      See :meth:`~wx.CustomDataObject.GetAllFormats`


   .. attribute:: Data

      See :meth:`~wx.CustomDataObject.GetData` and :meth:`~wx.CustomDataObject.SetData`


   .. attribute:: Size

      See :meth:`~wx.CustomDataObject.GetSize`

