This is the simplest possible implementation of the DataObject class. The data object of (a class derived from) this class only supports one format, so the number of virtual functions to be implemented is reduced.
Notice that this is still an abstract base class and cannot be used but should be derived from.
The objects supporting rendering the data must override get_data_size and get_data_here while the objects which may be set must override set_data. Of course, the objects supporting both operations must override all three methods.
Clipboard and drag and drop overview, DnD sample, FileDataObject, TextDataObject, BitmapDataObject
DataObjectSimple.new(DataFormat format = FormatInvalid)
Constructor accepts the supported format (none by default) which may also be set later with set_format.
DataFormat get_format()
Returns the (one and only one) format supported by this object. It is supposed that the format is supported in both directions.
set_format(DataFormat format)
Sets the supported format.
Integer get_data_size()
Gets the size of our data. Must be implemented in the derived class if the object supports rendering its data.
Boolean get_data_here((arg-type) buf)
Copy the data to the buffer, return true on success. Must be implemented in the derived class if the object supports rendering its data.
Boolean set_data(Integer len, (arg-type) buf)
Copy the data from the buffer, return true on success. Must be implemented in the derived class if the object supports setting its data.
[This page automatically generated from the Textile source at Wed Sep 09 02:21:04 +0100 2009]