#include <string.h>
-#define INCL_DOS
-#define INCL_PM
-#include <os2.h>
-
#include "wx/os2/private.h"
// wxDataObject is tied to OLE/drag and drop implementation,
#if wxUSE_DRAG_AND_DROP
#include "wx/dataobj.h"
- static bool wxSetClipboardData(wxDataObject *data);
+// static bool wxSetClipboardData(wxDataObject *data);
#endif
// ===========================================================================
return FALSE;
}
+#if 0
#if wxUSE_DRAG_AND_DROP
static bool wxSetClipboardData(wxDataObject *data)
{
return TRUE;
}
#endif // wxUSE_DRAG_AND_DROP
+#endif
bool wxSetClipboardData(wxDataFormat dataFormat,
const void *data,
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
{
- void *retval = NULL;
+// void *retval = NULL;
// TODO:
/*
switch ( dataFormat )
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
-wxClipboard* wxTheClipboard = (wxClipboard *)NULL;
-
wxClipboard::wxClipboard()
{
}
{
}
+bool wxClipboard::Flush()
+{
+ // TODO:
+ return FALSE;
+}
+
bool wxClipboard::Open()
{
return wxOpenClipboard();
}
+bool wxClipboard::IsOpened() const
+{
+ return wxIsClipboardOpened();
+}
+
bool wxClipboard::SetData( wxDataObject *data )
{
(void)wxEmptyClipboard();
#if wxUSE_DRAG_AND_DROP
wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
-// wxDataFormat format = data->GetFormat();
+// wxDataFormat format = data->GetPreferredFormat();
// TODO:
/*
switch ( format )
{
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
wxBitmap bitmap(bitmapDataObject->GetBitmap());
- return wxSetClipboardData(data->GetFormat(), &bitmap);
+ return wxSetClipboardData(data->GetPreferredFormat(), &bitmap);
}
#if wxUSE_METAFILE
#else // !wxUSE_DRAG_AND_DROP
*/
return FALSE;
+#else
+ return FALSE;
#endif // wxUSE_DRAG_AND_DROP/!wxUSE_DRAG_AND_DROP
}
wxCloseClipboard();
}
-bool wxClipboard::IsSupported( wxDataFormat format )
+bool wxClipboard::IsSupported( const wxDataFormat& format )
{
return wxIsClipboardFormatAvailable(format);
}
-bool wxClipboard::GetData( wxDataObject *data )
+bool wxClipboard::GetData( wxDataObject& data )
{
wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
#if wxUSE_DRAG_AND_DROP
-// wxDataFormat format = data->GetFormat();
+// wxDataFormat format = data.GetPreferredFormat();
// TODO:
/*
switch ( format )
case wxDF_TEXT:
case wxDF_OEMTEXT:
{
- wxTextDataObject* textDataObject = (wxTextDataObject*) data;
+ wxTextDataObject& textDataObject = (wxTextDataObject&) data;
char* s = (char*) wxGetClipboardData(format);
if ( s )
{
- textDataObject->SetText(s);
+ textDataObject.SetText(s);
delete[] s;
return TRUE;
}
case wxDF_BITMAP:
case wxDF_DIB:
{
- wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject *)data;
- wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(data->GetFormat());
+ wxBitmapDataObject& bitmapDataObject = (wxBitmapDataObject &)data;
+ wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(data->GetPreferredFormat());
if (bitmap)
{
- bitmapDataObject->SetBitmap(* bitmap);
+ bitmapDataObject.SetBitmap(* bitmap);
delete bitmap;
return TRUE;
}
#if wxUSE_METAFILE
case wxDF_METAFILE:
{
- wxMetafileDataObject* metaFileDataObject = (wxMetafileDataObject *)data;
+ wxMetafileDataObject& metaFileDataObject = (wxMetafileDataObject &)data;
wxMetafile* metaFile = (wxMetafile *)wxGetClipboardData(wxDF_METAFILE);
if (metaFile)
{
- metaFileDataObject->SetMetafile(*metaFile);
+ metaFileDataObject.SetMetafile(*metaFile);
delete metaFile;
return TRUE;
}
if ( buf )
{
// FIXME this is for testing only!!
- ((wxPrivateDataObject *)data)->SetData(buf, len);
+ ((wxPrivateDataObject &)data).SetData(buf, len);
free(buf);
return TRUE;
#else
*/
return FALSE;
+#else
+ return FALSE;
#endif
}
-//-----------------------------------------------------------------------------
-// wxClipboardModule
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule,wxModule)
-
-bool wxClipboardModule::OnInit()
-{
- wxTheClipboard = new wxClipboard();
-
- return TRUE;
-}
-
-void wxClipboardModule::OnExit()
-{
- if (wxTheClipboard) delete wxTheClipboard;
- wxTheClipboard = (wxClipboard*) NULL;
-}
-
#else
#error "Please turn wxUSE_CLIPBOARD on to compile this file."
#endif // wxUSE_CLIPBOARD