+bool
+wxIDataObject::GetSystemData(wxDataFormat format, STGMEDIUM *pmedium) const
+{
+ for ( SystemData::const_iterator it = m_systemData.begin();
+ it != m_systemData.end();
+ ++it )
+ {
+ FORMATETC* formatEtc = (*it)->pformatetc;
+ if ( formatEtc->cfFormat == format )
+ {
+ wxCopyStgMedium((*it)->pmedium, pmedium);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool
+wxIDataObject::HasSystemData(wxDataFormat format) const
+{
+ for ( SystemData::const_iterator it = m_systemData.begin();
+ it != m_systemData.end();
+ ++it )
+ {
+ FORMATETC* formatEtc = (*it)->pformatetc;
+ if ( formatEtc->cfFormat == format )
+ return true;
+ }
+
+ return false;
+}
+
+// save system data
+HRESULT
+wxIDataObject::SaveSystemData(FORMATETC *pformatetc,
+ STGMEDIUM *pmedium,
+ BOOL fRelease)
+{
+ if ( pformatetc == NULL || pmedium == NULL )
+ return E_INVALIDARG;
+
+ // remove entry if already available
+ for ( SystemData::iterator it = m_systemData.begin();
+ it != m_systemData.end();
+ ++it )
+ {
+ if ( pformatetc->tymed & (*it)->pformatetc->tymed &&
+ pformatetc->dwAspect == (*it)->pformatetc->dwAspect &&
+ pformatetc->cfFormat == (*it)->pformatetc->cfFormat )
+ {
+ delete (*it);
+ m_systemData.erase(it);
+ break;
+ }
+ }
+
+ // create new format/medium
+ FORMATETC* pnewformatEtc = new FORMATETC;
+ STGMEDIUM* pnewmedium = new STGMEDIUM;
+
+ wxZeroMemory(*pnewformatEtc);
+ wxZeroMemory(*pnewmedium);
+
+ // copy format
+ *pnewformatEtc = *pformatetc;
+
+ // copy or take ownerschip of medium
+ if ( fRelease )
+ *pnewmedium = *pmedium;
+ else
+ wxCopyStgMedium(pmedium, pnewmedium);
+
+ // save entry
+ m_systemData.push_back(new SystemDataEntry(pnewformatEtc, pnewmedium));
+
+ return S_OK;
+}
+