1wxTextDataObject(3) Erlang Module Definition wxTextDataObject(3)
2
3
4
6 wxTextDataObject - Functions for wxTextDataObject class
7
9 wxTextDataObject is a specialization of wxDataObjectSimple (not imple‐
10 mented in wx) for text data. It can be used without change to paste
11 data into the wxClipboard or a wxDropSource (not implemented in wx). A
12 user may wish to derive a new class from this class for providing text
13 on-demand in order to minimize memory consumption when offering data in
14 several formats, such as plain text and RTF because by default the text
15 is stored in a string in this class, but it might as well be generated
16 when requested. For this, getTextLength/1 and getText/1 will have to be
17 overridden.
18
19 Note that if you already have the text inside a string, you will not
20 achieve any efficiency gain by overriding these functions because copy‐
21 ing wxStrings is already a very efficient operation (data is not actu‐
22 ally copied because wxStrings are reference counted).
23
24 See: Overview dnd, wxDataObject, wxDataObjectSimple (not implemented in
25 wx), wxFileDataObject, wxBitmapDataObject
26
27 This class is derived (and can use functions) from: wxDataObject
28
29 wxWidgets docs: wxTextDataObject
30
32 wxTextDataObject() = wx:wx_object()
33
35 new() -> wxTextDataObject()
36
37 new(Options :: [Option]) -> wxTextDataObject()
38
39 Types:
40
41 Option = {text, unicode:chardata()}
42
43 Constructor, may be used to initialise the text (otherwise set‐
44 Text/2 should be used later).
45
46 getTextLength(This) -> integer()
47
48 Types:
49
50 This = wxTextDataObject()
51
52 Returns the data size.
53
54 By default, returns the size of the text data set in the con‐
55 structor or using setText/2. This can be overridden to provide
56 text size data on-demand. It is recommended to return the text
57 length plus 1 for a trailing zero, but this is not strictly re‐
58 quired.
59
60 getText(This) -> unicode:charlist()
61
62 Types:
63
64 This = wxTextDataObject()
65
66 Returns the text associated with the data object.
67
68 You may wish to override this method when offering data on-de‐
69 mand, but this is not required by wxWidgets' internals. Use this
70 method to get data in text form from the wxClipboard.
71
72 setText(This, StrText) -> ok
73
74 Types:
75
76 This = wxTextDataObject()
77 StrText = unicode:chardata()
78
79 Sets the text associated with the data object.
80
81 This method is called when the data object receives the data
82 and, by default, copies the text into the member variable. If
83 you want to process the text on the fly you may wish to override
84 this function.
85
86 destroy(This :: wxTextDataObject()) -> ok
87
88 Destroys the object.
89
90
91
92wxWidgets team. wx 2.2.1 wxTextDataObject(3)