1wxDataObject(3)            Erlang Module Definition            wxDataObject(3)
2
3
4

NAME

6       wxDataObject - Functions for wxDataObject class
7

DESCRIPTION

9       A  wxDataObject represents data that can be copied to or from the clip‐
10       board, or dragged and dropped. The important thing  about  wxDataObject
11       is  that  this is a 'smart' piece of data unlike 'dumb' data containers
12       such as memory buffers or files. Being 'smart' here means that the data
13       object itself should know what data formats it supports and how to ren‐
14       der itself in each of its supported formats.
15
16       A supported format, incidentally, is exactly the format  in  which  the
17       data  can be requested from a data object or from which the data object
18       may be set. In the general case, an object may support  different  for‐
19       mats on 'input' and 'output', i.e. it may be able to render itself in a
20       given format but not be created from data on this format or vice versa.
21       wxDataObject  defines  the  wxDataObject::Direction (not implemented in
22       wx) enumeration type which distinguishes between them.
23
24       See wxDataFormat (not implemented in wx) documentation for  more  about
25       formats.
26
27       Not  surprisingly,  being 'smart' comes at a price of added complexity.
28       This is reasonable for the situations when you really need  to  support
29       multiple  formats, but may be annoying if you only want to do something
30       simple like cut and paste text.
31
32       To provide a solution for both  cases,  wxWidgets  has  two  predefined
33       classes  which derive from wxDataObject: wxDataObjectSimple (not imple‐
34       mented in wx) and wxDataObjectComposite (not implemented  in  wx).  wx‐
35       DataObjectSimple  (not  implemented in wx) is the simplest wxDataObject
36       possible and only holds data in a single format (such as HTML or  text)
37       and  wxDataObjectComposite  (not implemented in wx) is the simplest way
38       to implement a wxDataObject that does support multiple formats  because
39       it  achieves this by simply holding several wxDataObjectSimple (not im‐
40       plemented in wx) objects.
41
42       So, you have several solutions when you need a wxDataObject class  (and
43       you  need one as soon as you want to transfer data via the clipboard or
44       drag and drop):
45
46       Please note that the easiest way to use drag and drop and the clipboard
47       with  multiple  formats  is  by using wxDataObjectComposite (not imple‐
48       mented in wx), but it is not the most efficient one as  each  wxDataOb‐
49       jectSimple  (not implemented in wx) would contain the whole data in its
50       respective formats. Now imagine that you want to  paste  200  pages  of
51       text  in  your  proprietary format, as well as Word, RTF, HTML, Unicode
52       and plain text to the clipboard and even today's computers are in trou‐
53       ble.  For this case, you will have to derive from wxDataObject directly
54       and make it enumerate its formats and provide the data in the requested
55       format on demand.
56
57       Note  that  neither the GTK+ data transfer mechanisms for clipboard and
58       drag and drop, nor OLE data transfer, copies any data until another ap‐
59       plication actually requests the data. This is in contrast to the 'feel'
60       offered to the user of a program who would normally think that the data
61       resides in the clipboard after having pressed 'Copy' - in reality it is
62       only declared to be available.
63
64       You may also derive your own data object classes  from  wxCustomDataOb‐
65       ject  (not  implemented  in  wx)  for user-defined types. The format of
66       user-defined data is given as a mime-type string literal, such as  "ap‐
67       plication/word"  or "image/png". These strings are used as they are un‐
68       der Unix (so far only GTK+) to identify a  format  and  are  translated
69       into  their  Windows  equivalent under Win32 (using the OLE IDataObject
70       for data exchange to and from the clipboard and  for  drag  and  drop).
71       Note  that  the format string translation under Windows is not yet fin‐
72       ished.
73
74       Each class derived directly from wxDataObject must override and  imple‐
75       ment all of its functions which are pure virtual in the base class. The
76       data objects which only render their data or only set it (i.e. work  in
77       only  one direction), should return 0 from GetFormatCount() (not imple‐
78       mented in wx).
79
80       See:  Overview  dnd,  Examples,   wxFileDataObject,   wxTextDataObject,
81       wxBitmapDataObject, wxCustomDataObject (not implemented in wx), wxDrop‐
82       Target (not implemented in wx), wxDropSource (not implemented  in  wx),
83       wxTextDropTarget  (not implemented in wx), wxFileDropTarget (not imple‐
84       mented in wx)
85
86       wxWidgets docs: wxDataObject
87

DATA TYPES

89       wxDataObject() = wx:wx_object()
90
91
92
93wxWidgets team.                    wx 2.1.4                    wxDataObject(3)
Impressum