- if (wxOpenClipboard()) {
- char **formats, *data;
- int i;
- int ftype;
- long size;
-
- formats = clipOwner->formats.ListToArray(FALSE);
- for (i = clipOwner->formats.Number(); i--; ) {
- ftype = FormatStringToID(formats[i]);
- data = clipOwner->GetData(formats[i], &size);
- if (!wxSetClipboardData(ftype, (wxObject *)data, size, 1)) {
- got_selection = FALSE;
- break;
- }
+ switch (data->GetFormat())
+ {
+ case wxDF_TEXT:
+ case wxDF_OEMTEXT:
+ {
+ wxTextDataObject* textDataObject = (wxTextDataObject*) data;
+ wxString str(textDataObject->GetText());
+ return wxSetClipboardData(data->GetFormat(), (wxObject*) (const char*) str);
+ break;
+ }
+ case wxDF_BITMAP:
+ case wxDF_DIB:
+ {
+ wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
+ wxBitmap bitmap(bitmapDataObject->GetBitmap());
+ return wxSetClipboardData(data->GetFormat(), & bitmap);
+ break;
+ }
+#if wxUSE_METAFILE
+ case wxDF_METAFILE:
+ {
+ wxMetafileDataObject* metaFileDataObject = (wxMetafileDataObject*) data;
+ wxMetafile metaFile = metaFileDataObject->GetMetafile();
+ return wxSetClipboardData(wxDF_METAFILE, & metaFile, metaFileDataObject->GetWidth(), metaFileDataObject->GetHeight());
+ break;
+ }
+#endif
+ default:
+ {
+ return FALSE;
+ }