TQWindowsMime Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQWindowsMime Class Reference

The TQWindowsMime class maps open-standard MIME to Window Clipboard formats. More...

`#include <ntqmime.h>`

List of all member functions.

## Public Members

- TQWindowsMime ()
- virtual ~TQWindowsMime ()
- virtual const char * convertorName () = 0
- virtual int countCf () = 0
- virtual int cf ( int index ) = 0
- virtual bool canConvert ( const char * mime, int cf ) = 0
- virtual const char * mimeFor ( int cf ) = 0
- virtual int cfFor ( const char * mime ) = 0
- virtual TQByteArray convertToMime ( TQByteArray data, const char * mime, int cf ) = 0
- virtual TQByteArray convertFromMime ( TQByteArray data, const char * mime, int cf ) = 0

## Static Public Members

- void initialize ()
- TQPtrList<TQWindowsMime> all ()
- TQWindowsMime * convertor ( const char * mime, int cf )
- const char * cfToMime ( int cf )

## Detailed Description

The TQWindowsMime class maps open-standard MIME to Window Clipboard formats.

TQt's drag-and-drop and clipboard facilities use the MIME standard. On X11, this maps trivially to the Xdnd protocol, but on Windows although some applications use MIME types to describe clipboard formats, others use arbitrary non-standardized naming conventions, or unnamed built-in formats of Windows.

By instantiating subclasses of TQWindowsMime that provide conversions between Windows Clipboard and MIME formats, you can convert proprietary clipboard formats to MIME formats.

TQt has predefined support for the following Windows Clipboard formats:

- CF_UNICODETEXT - converted to "text/plain;charset=ISO-10646-UCS-2" and supported by TQTextDrag.
- CF_TEXT - converted to "text/plain;charset=system" or "text/plain" and supported by TQTextDrag.
- CF_DIB - converted to "image/*", where * is a TQt image format, and supported by TQImageDrag.
- CF_HDROP - converted to "text/uri-list", and supported by TQUriDrag.

An example use of this class would be to map the Windows Metafile clipboard format (CF_METAFILEPICT) to and from the MIME type "image/x-wmf". This conversion might simply be adding or removing a header, or even just passing on the data. See the Drag-and-Drop documentation for more information on choosing and definition MIME types.

You can check if a MIME type is convertible using canConvert() and can perform conversions with convertToMime() and convertFromMime().

See also Drag And Drop Classes, Input/Output and Networking, and Miscellaneous Classes.

## Member Function Documentation

### TQWindowsMime::TQWindowsMime ()

Constructs a new conversion object, adding it to the globally accessed list of available convertors.

### TQWindowsMime::~TQWindowsMime ()`[virtual]`

Destroys a conversion object, removing it from the global list of available convertors.

### TQPtrList<TQWindowsMime> TQWindowsMime::all ()`[static]`

Returns a list of all currently defined TQWindowsMime objects.

### bool TQWindowsMime::canConvert ( const char * mime, int cf )`[pure virtual]`

Returns true if the convertor can convert (both ways) between mime and cf; otherwise returns false.

All subclasses must reimplement this pure virtual function.

### int TQWindowsMime::cf ( int index )`[pure virtual]`

Returns the Windows Clipboard format supported by this convertor that is ordinarily at position index. This means that cf(0) returns the first Windows Clipboard format supported, and cf(countCf()-1) returns the last. If index is out of range the return value is undefined.

All subclasses must reimplement this pure virtual function.

### int TQWindowsMime::cfFor ( const char * mime )`[pure virtual]`

Returns the Windows Clipboard type used for MIME type mime, or 0 if this convertor does not support mime.

All subclasses must reimplement this pure virtual function.

### const char * TQWindowsMime::cfToMime ( int cf )`[static]`

Returns a MIME type for cf, or 0 if none exists.

### TQByteArray TQWindowsMime::convertFromMime ( TQByteArray data, const char * mime, int cf )`[pure virtual]`

Returns data converted from MIME type mime to Windows Clipboard format cf.

Note that Windows Clipboard formats must all be self-terminating. The return value may contain trailing data.

All subclasses must reimplement this pure virtual function.

### TQByteArray TQWindowsMime::convertToMime ( TQByteArray data, const char * mime, int cf )`[pure virtual]`

Returns data converted from Windows Clipboard format cf to MIME type mime.

Note that Windows Clipboard formats must all be self-terminating. The input data may contain trailing data.

All subclasses must reimplement this pure virtual function.

### TQWindowsMime * TQWindowsMime::convertor ( const char * mime, int cf )`[static]`

Returns the most-recently created TQWindowsMime that can convert between the mime and cf formats. Returns 0 if no such convertor exists.

### const char * TQWindowsMime::convertorName ()`[pure virtual]`

Returns a name for the convertor.

All subclasses must reimplement this pure virtual function.

### int TQWindowsMime::countCf ()`[pure virtual]`

Returns the number of Windows Clipboard formats supported by this convertor.

All subclasses must reimplement this pure virtual function.

### void TQWindowsMime::initialize ()`[static]`

This is an internal function.

### const char * TQWindowsMime::mimeFor ( int cf )`[pure virtual]`

Returns the MIME type used for Windows Clipboard format cf, or 0 if this convertor does not support cf.

All subclasses must reimplement this pure virtual function.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.