Package wx :: Class TextDataObject
[frames | no frames]

Type TextDataObject

  object --+        
           |        
  DataObject --+    
               |    
DataObjectSimple --+
                   |
                  TextDataObject

Known Subclasses:
PyTextDataObject

wx.TextDataObject is a specialization of wx.DataObject for text data. It can be used without change to paste data into the wx.Clipboard or a wx.DropSource.

Alternativly, you may wish to derive a new class from the wx.PyTextDataObject class for providing text on-demand in order to minimize memory consumption when offering data in several formats, such as plain text and RTF, because by default the text is stored in a string in this class, but it might as well be generated on demand when requested. For this, GetTextLength and GetText will have to be overridden.


Method Summary
TextDataObject __init__(self, text)
Constructor, may be used to initialise the text (otherwise SetText should be used later).
  __repr__(self)
String GetText(self)
Returns the text associated with the data object.
size_t GetTextLength(self)
Returns the data size.
  SetText(self, text)
Sets the text associated with the data object.
    Inherited from DataObjectSimple
String GetDataHere(self)
Returns the data bytes from the data object as a string, returns None on failure.
size_t GetDataSize(self)
Get the size of our data.
DataFormat GetFormat(self)
Returns the (one and only one) format supported by this object.
bool SetData(self, data)
Copy the data value to the data object.
  SetFormat(self, format)
Sets the supported format.
    Inherited from DataObject
  __del__(self)
[formats] GetAllFormats(self, dir)
Returns a list of all the wx.DataFormats that this dataobject supports in the given direction.
size_t GetFormatCount(self, dir)
Returns the number of available formats for rendering or setting the data.
DataFormat GetPreferredFormat(self, dir)
Returns the preferred format for either rendering the data (if dir is Get, its default value) or for setting it.
bool IsSupported(self, format, dir)
Returns True if this format is supported.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Class Variable Summary
    Inherited from DataObject
int Both = 3                                                                     
int Get = 1                                                                     
int Set = 2                                                                     

Method Details

__init__(self, text=EmptyString)
(Constructor)

Constructor, may be used to initialise the text (otherwise SetText should be used later).

Parameters:
text
           (type=String)

Returns:
TextDataObject
Overrides:
wx.DataObjectSimple.__init__

GetText(self)

Returns the text associated with the data object.

Returns:
String

GetTextLength(self)

Returns the data size. By default, returns the size of the text data set in the constructor or using SetText. This can be overridden (via wx.PyTextDataObject) to provide text size data on-demand. It is recommended to return the text length plus 1 for a trailing zero, but this is not strictly required.

Returns:
size_t

SetText(self, text)

Sets the text associated with the data object. This method is called when the data object receives the data and, by default, copies the text into the member variable. If you want to process the text on the fly you may wish to override this function (via wx.PyTextDataObject.)

Parameters:
text
           (type=String)


Generated by Epydoc 2.1.20050511.rpd on Sat Jun 16 16:52:44 2007 http://epydoc.sf.net