wxRuby Documentation Home

# Wx::DataObjectSimple

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.

## Virtual functions to override

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.

## Derived from

DataObject

## See also

Clipboard and drag and drop overview,
DnD sample,
FileDataObject,
TextDataObject,
BitmapDataObject

## Methods

- DataObjectSimple.new
- DataObjectSimple#get_format
- DataObjectSimple#set_format
- DataObjectSimple#get_data_size
- DataObjectSimple#get_data_here
- DataObjectSimple#set_data

### DataObjectSimple.new

DataObjectSimple.new(%(arg-type)DataFormat% format = FormatInvalid)

Constructor accepts the supported format (none by default) which may also be
set later with set_format.

### DataObjectSimple#get_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.

### DataObjectSimple#set_format

set_format(%(arg-type)DataFormat% format)

Sets the supported format.

### DataObjectSimple#get_data_size

Integer get_data_size()

Gets the size of our data. Must be implemented in the derived class if the
object supports rendering its data.

### DataObjectSimple#get_data_here

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.

### DataObjectSimple#set_data

Boolean set_data(%(arg-type)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 2023-06-09 00:45:31 +0000]