// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "dataobj.h"
#endif
#include "wx/msw/private.h" // includes <windows.h>
+#ifdef __WXWINCE__
+#include <winreg.h>
+#endif
+
// for some compilers, the entire ole2.h must be included, not only oleauto.h
-#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
+#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__) || defined(__WXWINCE__)
#include <ole2.h>
#endif
wxCHECK_MSG( !IsStandard(), s,
wxT("name of predefined format cannot be retrieved") );
- int len = ::GetClipboardFormatName(m_format, s.GetWriteBuf(max), max);
- s.UngetWriteBuf();
+ int len = ::GetClipboardFormatName(m_format, wxStringBuffer(s, max), max);
if ( !len )
{
pmedium->tymed = TYMED_ENHMF;
break;
+#ifndef __WXWINCE__
case wxDF_METAFILE:
pmedium->hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE,
sizeof(METAFILEPICT));
}
pmedium->tymed = TYMED_MFPICT;
break;
-
+#endif
default:
// alloc memory
size_t size = m_pDataObject->GetDataSize(format);
break;
#endif
case CF_BITMAP:
+#ifndef __WXWINCE__
case CF_HDROP:
// these formats don't use size at all, anyhow (but
// pass data by handle, which is always a single DWORD)
size = 0;
break;
+#endif
case CF_DIB:
// the handler will calculate size itself (it's too
size = 0;
break;
+#ifndef __WXWINCE__
case CF_METAFILEPICT:
size = sizeof(METAFILEPICT);
break;
-
+#endif
default:
{
// we suppose that the size precedes the data
switch ( format ) {
case CF_TEXT: return wxT("CF_TEXT");
case CF_BITMAP: return wxT("CF_BITMAP");
- case CF_METAFILEPICT: return wxT("CF_METAFILEPICT");
case CF_SYLK: return wxT("CF_SYLK");
case CF_DIF: return wxT("CF_DIF");
case CF_TIFF: return wxT("CF_TIFF");
case CF_RIFF: return wxT("CF_RIFF");
case CF_WAVE: return wxT("CF_WAVE");
case CF_UNICODETEXT: return wxT("CF_UNICODETEXT");
+#ifndef __WXWINCE__
+ case CF_METAFILEPICT: return wxT("CF_METAFILEPICT");
case CF_ENHMETAFILE: return wxT("CF_ENHMETAFILE");
- case CF_HDROP: return wxT("CF_HDROP");
case CF_LOCALE: return wxT("CF_LOCALE");
+ case CF_HDROP: return wxT("CF_HDROP");
+#endif
default:
if ( !::GetClipboardFormatName(format, s_szBuf, WXSIZEOF(s_szBuf)) )
// wxBitmapDataObject supports CF_DIB format
// ----------------------------------------------------------------------------
+// TODO: support CF_DIB under Windows CE as well
+
size_t wxBitmapDataObject::GetDataSize() const
{
+#if wxUSE_WXDIB && !defined(__WXWINCE__)
return wxDIB::ConvertFromBitmap(NULL, GetHbitmapOf(GetBitmap()));
+#else
+ return 0;
+#endif
}
bool wxBitmapDataObject::GetDataHere(void *buf) const
{
+#if wxUSE_WXDIB && !defined(__WXWINCE__)
BITMAPINFO * const pbi = (BITMAPINFO *)buf;
return wxDIB::ConvertFromBitmap(pbi, GetHbitmapOf(GetBitmap())) != 0;
+#else
+ return FALSE;
+#endif
}
bool wxBitmapDataObject::SetData(size_t WXUNUSED(len), const void *buf)
{
+#if wxUSE_WXDIB && !defined(__WXWINCE__)
const BITMAPINFO * const pbmi = (const BITMAPINFO *)buf;
HBITMAP hbmp = wxDIB::ConvertToBitmap(pbmi);
SetBitmap(bitmap);
return TRUE;
+#else
+ return FALSE;
+#endif
}
// ----------------------------------------------------------------------------
bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *pData)
{
+#ifndef __WXWINCE__
m_filenames.Empty();
// the documentation states that the first member of DROPFILES structure is
// +1 for terminating NUL
len = ::DragQueryFile(hdrop, n, NULL, 0) + 1;
- UINT len2 = ::DragQueryFile(hdrop, n, str.GetWriteBuf(len), len);
- str.UngetWriteBuf();
+ UINT len2 = ::DragQueryFile(hdrop, n, wxStringBuffer(str, len), len);
m_filenames.Add(str);
if ( len2 != len - 1 ) {
}
return TRUE;
+#else
+ return FALSE;
+#endif
}
void wxFileDataObject::AddFile(const wxString& file)
size_t wxFileDataObject::GetDataSize() const
{
+#ifndef __WXWINCE__
// size returned will be the size of the DROPFILES structure,
// plus the list of filesnames (null byte separated), plus
// a double null at the end
return 0;
// inital size of DROPFILES struct + null byte
- size_t sz = sizeof(DROPFILES) + 1;
+ size_t sz = sizeof(DROPFILES) + (1 * sizeof(wxChar));
size_t count = m_filenames.GetCount();
for ( size_t i = 0; i < count; i++ )
{
// add filename length plus null byte
- sz += m_filenames[i].Len() + 1;
+ sz += (m_filenames[i].Len() + 1) * sizeof(wxChar);
}
return sz;
+#else
+ return 0;
+#endif
}
bool wxFileDataObject::GetDataHere(void *pData) const
{
+#ifndef __WXWINCE__
// pData points to an externally allocated memory block
// created using the size returned by GetDataSize()
{
// copy filename to pbuf and add null terminator
size_t len = m_filenames[i].Len();
- memcpy(pbuf, m_filenames[i], len);
+ memcpy(pbuf, m_filenames[i], len*sizeof(wxChar));
pbuf += len;
*pbuf++ = wxT('\0');
}
*pbuf = wxT('\0');
return TRUE;
+#else
+ return FALSE;
+#endif
}
// ----------------------------------------------------------------------------
return TRUE;
}
+ virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
+ void *buf) const
+ { return GetDataHere(buf); }
#endif
+
+ DECLARE_NO_COPY_CLASS(CFSTR_SHELLURLDataObject)
};
size_t len = m_dataObjectLast->GetDataSize();
- m_dataObjectLast->GetDataHere(url.GetWriteBuf(len));
- url.UngetWriteBuf();
+ m_dataObjectLast->GetDataHere(wxStringBuffer(url, len));
return url;
}
// wxDataObject
// ----------------------------------------------------------------------------
+#if wxUSE_DATAOBJ
+
wxDataObject::wxDataObject()
{
}
#endif
+#endif
+