previous up next     contents index
Next: Global Data: Headers and Up: Encoding Snips Previous: Snip Classes

Buffer Data

 

    While a snip belongs to a buffer, the buffer may store extra information about a snip in some specialized way. When the snip is to be encoded, this extra information needs to be put into a buffer data object so that the extra information can be encoded as well. In an editor buffer, extra information can be associated with ranges of items, as well as snips.

Just as a snip must be associated with a snip class to be decoded (see Snip Classes (section gif)), a buffer data object needs a buffer data class for decoding. Every buffer data class object should be added to the global buffer data class list, wxTheBufferDataClassList.

To store and load information about a snip or region in a buffer:

  1. derive new classes from wxBufferData and wxBufferDataClass.
  2. derive a new class from the wxMediaEdit or wxMediaPasteboard class, and override the GetSnipData and SetSnipData methods and/or the GetRegionData and SetRegionData methods.

When deriving the new wxBufferDataClass class, pick a new unique name to identify the encoded data. All names beginning with ``wx'' are reserved for internal use. By tagging extra data with a unique name, the normal buffer content can be safely decoded in a buffer that does not support the extra data.



PLT