X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/37f214d588b02079a3ddf64c2e46585ca1657c1b..f90566f5c386e6e5d80deecad9052ec53a0394ba:/src/os2/clipbrd.cpp diff --git a/src/os2/clipbrd.cpp b/src/os2/clipbrd.cpp index ca6319b54f..9c0ed072cf 100644 --- a/src/os2/clipbrd.cpp +++ b/src/os2/clipbrd.cpp @@ -37,10 +37,6 @@ #include -#define INCL_DOS -#define INCL_PM -#include - #include "wx/os2/private.h" // wxDataObject is tied to OLE/drag and drop implementation, @@ -436,8 +432,6 @@ bool wxGetClipboardFormatName(wxDataFormat dataFormat, IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) -wxClipboard* wxTheClipboard = (wxClipboard *)NULL; - wxClipboard::wxClipboard() { } @@ -451,11 +445,22 @@ void wxClipboard::Clear() { } +bool wxClipboard::Flush() +{ + // TODO: + return FALSE; +} + bool wxClipboard::Open() { return wxOpenClipboard(); } +bool wxClipboard::IsOpened() const +{ + return wxIsClipboardOpened(); +} + bool wxClipboard::SetData( wxDataObject *data ) { (void)wxEmptyClipboard(); @@ -476,7 +481,7 @@ bool wxClipboard::AddData( wxDataObject *data ) #if wxUSE_DRAG_AND_DROP wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") ); -// wxDataFormat format = data->GetFormat(); +// wxDataFormat format = data->GetPreferredFormat(); // TODO: /* switch ( format ) @@ -494,7 +499,7 @@ bool wxClipboard::AddData( wxDataObject *data ) { wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data; wxBitmap bitmap(bitmapDataObject->GetBitmap()); - return wxSetClipboardData(data->GetFormat(), &bitmap); + return wxSetClipboardData(data->GetPreferredFormat(), &bitmap); } #if wxUSE_METAFILE @@ -515,6 +520,8 @@ bool wxClipboard::AddData( wxDataObject *data ) #else // !wxUSE_DRAG_AND_DROP */ return FALSE; +#else + return FALSE; #endif // wxUSE_DRAG_AND_DROP/!wxUSE_DRAG_AND_DROP } @@ -528,12 +535,12 @@ bool wxClipboard::IsSupported( 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 ) @@ -541,11 +548,11 @@ bool wxClipboard::GetData( wxDataObject *data ) 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; } @@ -556,11 +563,11 @@ bool wxClipboard::GetData( wxDataObject *data ) 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; } @@ -570,11 +577,11 @@ bool wxClipboard::GetData( wxDataObject *data ) #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; } @@ -589,7 +596,7 @@ bool wxClipboard::GetData( wxDataObject *data ) if ( buf ) { // FIXME this is for testing only!! - ((wxPrivateDataObject *)data)->SetData(buf, len); + ((wxPrivateDataObject &)data).SetData(buf, len); free(buf); return TRUE; @@ -601,28 +608,11 @@ bool wxClipboard::GetData( wxDataObject *data ) #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