************* wx.DataFormat ************* Inheritance diagram for `wx.DataFormat`: | .. inheritance-diagram:: wx.DataFormat | Description =========== A `wx.DataFormat` is an encapsulation of a platform-specific format handle which is used by the system for the clipboard and drag and drop operations. The applications are usually only interested in, for example, pasting data from the clipboard only if the data is in a format the program understands and a data format is something which uniquely identifies this format. On the system level, a data format is usually just a number (``CLIPFORMAT`` under Windows or ``Atom`` under X11, for example) and the standard formats are, indeed, just numbers which can be implicitly converted to `wx.DataFormat`. The standard formats are: ====================== ========================================== Format Flag Description ====================== ========================================== ``wx.DF_INVALID`` An invalid format - used as default argument for functions taking a `wx.DataFormat` argument sometimes ``wx.DF_TEXT`` Text format (string) ``wx.DF_BITMAP`` A bitmap (`wx.Bitmap `_) ``wx.DF_METAFILE`` A metafile (Windows only) ``wx.DF_FILENAME`` A list of filenames ``wx.DF_HTML`` An HTML string. ====================== ========================================== As mentioned above, these standard formats may be passed to any function taking `wx.DataFormat` argument because `wx.DataFormat` has an implicit conversion from them. Aside the standard formats, the application may also use custom formats which are identified by their names (strings) and not numeric identifiers. Although internally custom format must be created (or *registered*) first, you shouldn't care about it because it is done automatically the first time the `wx.DataFormat` object corresponding to a given format name is created. The only implication of this is that you should avoid having global `wx.DataFormat` objects with non-default constructor because their constructors are executed before the program has time to perform all necessary initialisations and so an attempt to do clipboard format registration at this time will usually lead to a crash! .. seealso:: `wx.DataObject `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `GetId <#GetId>`_ * `GetType <#GetType>`_ * `SetId <#SetId>`_ * `SetType <#SetType>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Id <#Id>`_ * `Type <#Type>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(type) Constructs a data format object for one of the standard data formats or an empty data object (use `SetType <#SetType>`_ or `SetId <#SetId>`_ later in this case) **Parameters:** * `type` (int) | **Returns:** `wx.DataFormat `_ -------- .. method:: GetId() Returns the name of a custom format (this function will fail for a standard format). | **Returns:** `string` -------- .. method:: GetType() Returns the platform-specific number identifying the format. | **Returns:** `int` -------- .. method:: SetId(format) Sets the format to be the custom format identified by the given name. **Parameters:** * `format` (string) -------- .. method:: SetType(format) Sets the format to the given value, which should be one of ``wx.DF_XXX`` constants. **Parameters:** * `format` (int) -------- Properties ^^^^^^^^^^ .. attribute:: Id See `GetId <#GetId>`_ and `SetId <#SetId>`_ .. attribute:: Type See `GetType <#GetType>`_ and `SetType <#SetType>`_