File: wx.DataFormat.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (322 lines) | stat: -rw-r--r-- 9,653 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
.. wxPython Phoenix documentation

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

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

.. include:: headings.inc



.. _wx.DataFormat:

==========================================================================================================================================
|phoenix_title|  **wx.DataFormat**
==========================================================================================================================================

A :ref:`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  :ref:`wx.DataFormat`. The standard formats are: 



===================== ================================================================================================================ 
``wx.DF_INVALID``     An invalid format - used as default argument for functions taking a :ref:`wx.DataFormat`  argument sometimes.    
``wx.DF_TEXT``        Text format (:ref:`String`).                                                                                     
``wx.DF_BITMAP``      A bitmap (:ref:`wx.Bitmap`).                                                                                     
``wx.DF_METAFILE``    A metafile (:ref:`wx.Metafile`, Windows only).                                                                   
``wx.DF_FILENAME``    A list of filenames.                                                                                             
``wx.DF_HTML``        An HTML string. This is currently only valid on Mac and MSW.                                                     
===================== ================================================================================================================ 

|



As mentioned above, these standard formats may be passed to any function taking :ref:`wx.DataFormat`  argument because :ref:`wx.DataFormat`  has an implicit conversion from them (or, to be precise from the type  ``DataFormat::NativeFormat``   which is the type used by the underlying platform for data formats). 

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 :ref:`wx.DataFormat`  object corresponding to a given format name is created. The only implication of this is that you should avoid having global :ref:`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:: :ref:`Drag and Drop Overview <drag and drop overview>`, :ref:`Drag & Drop Sample <drag & drop sample>`, :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>DataFormat</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.DataFormat_inheritance.png" alt="Inheritance diagram of DataFormat" 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.DataFormat.html" title="wx.DataFormat" alt="" coords="5,5,123,35"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.DataFormat.__init__`                                                  Constructs a data format object for one of the standard data formats or an empty data object (use :meth:`~DataFormat.SetType`   or :meth:`~DataFormat.SetId`   later in this case).
:meth:`~wx.DataFormat.GetId`                                                     Returns the name of a custom format (this function will fail for a standard format).
:meth:`~wx.DataFormat.GetType`                                                   Returns the platform-specific number identifying the format.
:meth:`~wx.DataFormat.SetId`                                                     Sets the format to be the custom format identified by the given name.
:meth:`~wx.DataFormat.SetType`                                                   Sets the format to the given value, which should be one of ``DF_XXX`` constants.
:meth:`~wx.DataFormat.__ne__`                                                    Returns ``True`` if the formats are different.
:meth:`~wx.DataFormat.__eq__`                                                    Returns ``True`` if the formats are equal.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.DataFormat.Id`                                                        See :meth:`~wx.DataFormat.GetId` and :meth:`~wx.DataFormat.SetId`
:attr:`~wx.DataFormat.Type`                                                      See :meth:`~wx.DataFormat.GetType` and :meth:`~wx.DataFormat.SetType`
================================================================================ ================================================================================


|


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


.. class:: wx.DataFormat(object)

   **Possible constructors**::

       DataFormat(format=DF_INVALID)
       
       DataFormat(format)
       
   
   A DataFormat is an encapsulation of a platform-specific format
   handle which is used by the system for the clipboard and drag and drop
   operations.



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



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self, format=DF_INVALID)`
      
      Constructs a data format object for one of the standard data formats or an empty data object (use :meth:`SetType`   or :meth:`SetId`   later in this case).                  
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, format)`
      
      Constructs a data format object for a custom format identified by its name `format`.                  
      
      
      
      
      
      **~~~**






   .. method:: GetId(self)

      Returns the name of a custom format (this function will fail for a standard format).                  

      :rtype: `string`








   .. method:: GetType(self)

      Returns the platform-specific number identifying the format.                  

      :rtype: :ref:`wx.DataFormatId`








   .. method:: SetId(self, format)

      Sets the format to be the custom format identified by the given name.                  


      :param `format`: 
      :type `format`: string







   .. method:: SetType(self, type)

      Sets the format to the given value, which should be one of ``DF_XXX`` constants.                  


      :param `type`: 
      :type `type`: wx.DataFormatId







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

      Returns ``True`` if the formats are different.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **__ne__** `(self)`
      
      
      
      
      :param `format`: 
      :type `format`: wx.DataFormat
      
      
      
      
      
      
      **~~~**

      
      **__ne__** `(self)`
      
      
      
      
      :param `format`: 
      :type `format`: wx.DataFormatId
      
      
      
      
      
      
      **~~~**






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

      Returns ``True`` if the formats are equal.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **__eq__** `(self)`
      
      
      
      
      :param `format`: 
      :type `format`: wx.DataFormat
      
      
      
      
      
      
      **~~~**

      
      **__eq__** `(self)`
      
      
      
      
      :param `format`: 
      :type `format`: wx.DataFormatId
      
      
      
      
      
      
      **~~~**






   .. attribute:: Id

      See :meth:`~wx.DataFormat.GetId` and :meth:`~wx.DataFormat.SetId`


   .. attribute:: Type

      See :meth:`~wx.DataFormat.GetType` and :meth:`~wx.DataFormat.SetType`