+wxDropTarget::wxDropTarget (
+ wxDataObject* pDataObject
+)
+{
+ m_dataObject = pDataObject;
+ m_pDropTarget = new CIDropTarget(this);
+} // end of wxDropTarget::wxDropTarget
+
+wxDropTarget::~wxDropTarget()
+{
+ Release();
+} // end of wxDropTarget::~wxDropTarget
+
+bool wxDropTarget::GetData ()
+{
+ wxDataFormat vFormat = GetSupportedFormat(m_pDropTarget->GetDataSource());
+
+ if (vFormat == wxDF_INVALID)
+ {
+ return false;
+ }
+ //
+ // Under OS/2 we already have the data via the attached DRAGITEM's
+ //
+ return true;
+} // end of wxDropTarget::GetData
+
+wxDataFormat wxDropTarget::GetSupportedFormat (
+ PDRAGINFO pDataSource
+) const
+{
+ PDRAGITEM pDragItem;
+ wxDataFormat vFormat;
+ wxDataFormat* pFormats;
+ ULONG ulFormats = m_dataObject->GetFormatCount(wxDataObject::Set);
+ ULONG ulItems = (ULONG)::DrgQueryDragitemCount(pDataSource);
+ ULONG i;
+ ULONG n;
+ wxString sMechanism;
+ wxString sFormat;
+ bool bValid = false;
+
+ pFormats = ulFormats == 1 ? &vFormat : new wxDataFormat[ulFormats];
+ m_dataObject->GetAllFormats( pFormats
+ ,wxDataObject::Set
+ );
+
+ for (n = 0; n < ulFormats; n++)
+ {
+ switch(pFormats[n].GetType())
+ {
+ case wxDF_TEXT:
+ case wxDF_FILENAME:
+ case wxDF_HTML:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_TEXT");
+ break;
+
+ case wxDF_OEMTEXT:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_OEMTEXT");
+ break;
+
+ case wxDF_BITMAP:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_BITMAP");
+ break;
+
+ case wxDF_METAFILE:
+ case wxDF_ENHMETAFILE:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_METAFILE");
+ break;
+
+ case wxDF_TIFF:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_TIFF");
+ break;
+
+ case wxDF_SYLK:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_SYLK");
+ break;
+
+ case wxDF_DIF:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_DIF");
+ break;
+
+ case wxDF_DIB:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_DIB");
+ break;
+
+ case wxDF_PALETTE:
+ case wxDF_PENDATA:
+ case wxDF_RIFF:
+ case wxDF_WAVE:
+ case wxDF_UNICODETEXT:
+ case wxDF_LOCALE:
+ sMechanism = wxT("DRM_OS2FILE");
+ sFormat = wxT("DRF_UNKNOWN");
+ break;
+
+ case wxDF_PRIVATE:
+ sMechanism = wxT("DRM_OBJECT");
+ sFormat = wxT("DRF_UNKNOWN");
+ break;
+ }
+ for (i = 0; i < ulItems; i++)
+ {
+ pDragItem = ::DrgQueryDragitemPtr(pDataSource, i);
+ if (::DrgVerifyRMF(pDragItem, sMechanism.c_str(), sFormat.c_str()))
+ {
+ bValid = true;
+ break;
+ }
+ }
+ if (bValid)
+ {
+ vFormat = pFormats[n];
+ break;
+ }
+ }
+ if (pFormats != &vFormat)
+ {
+ //
+ // Free memory if we allocated it
+ //
+ delete [] pFormats;
+ }
+ return (n < ulFormats ? vFormat : wxFormatInvalid);
+} // end of wxDropTarget::GetSupportedFormat
+
+bool wxDropTarget::IsAcceptedData (
+ PDRAGINFO pDataSource
+) const