+#ifdef USE_METAFILES
+
+void DnDFrame::OnPasteMetafile(wxCommandEvent& WXUNUSED(event))
+{
+ if ( !wxTheClipboard->Open() )
+ {
+ wxLogError(_T("Can't open clipboard."));
+
+ return;
+ }
+
+ if ( !wxTheClipboard->IsSupported(wxDF_METAFILE) )
+ {
+ wxLogWarning(_T("No metafile on clipboard"));
+ }
+ else
+ {
+ wxMetaFileDataObject data;
+ if ( !wxTheClipboard->GetData(data) )
+ {
+ wxLogError(_T("Can't paste metafile from the clipboard"));
+ }
+ else
+ {
+ const wxMetaFile& mf = data.GetMetafile();
+
+ wxLogMessage(_T("Metafile %dx%d pasted from the clipboard"),
+ mf.GetWidth(), mf.GetHeight());
+
+ ShowMetaFile(mf);
+ }
+ }
+
+ wxTheClipboard->Close();
+}
+
+#endif // USE_METAFILES
+
+// ----------------------------------------------------------------------------
+// file clipboard
+// ----------------------------------------------------------------------------
+
+void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event))
+{
+#ifdef __WXMSW__
+ wxFileDialog dialog(this, "Select a file to copy", "", "",
+ "All files (*.*)|*.*", 0);
+
+ wxArrayString filenames;
+ while ( dialog.ShowModal() == wxID_OK )
+ {
+ filenames.Add(dialog.GetPath());
+ }
+
+ if ( !filenames.IsEmpty() )
+ {
+ wxFileDataObject *dobj = new wxFileDataObject;
+ size_t count = filenames.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ dobj->AddFile(filenames[n]);
+ }
+
+ wxClipboardLocker locker;
+ if ( !locker )
+ {
+ wxLogError("Can't open clipboard");
+ }
+ else
+ {
+ if ( !wxTheClipboard->AddData(dobj) )
+ {
+ wxLogError("Can't copy file(s) to the clipboard");
+ }
+ else
+ {
+ wxLogStatus(this, "%d file%s copied to the clipboard",
+ count, count == 1 ? "" : "s");
+ }
+ }
+ }
+ else
+ {
+ wxLogStatus(this, "Aborted");
+ }
+#else // !MSW
+ wxLogError("Sorry, not implemented");
+#endif // MSW/!MSW
+}
+