X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d120f8391920145647ec10e84629bc21fa9f1bb..aaf765a54931a3add43bcf68cec8c80f0b66b18a:/src/motif/clipbrd.cpp diff --git a/src/motif/clipbrd.cpp b/src/motif/clipbrd.cpp index 8156b69bc7..41afb324d3 100644 --- a/src/motif/clipbrd.cpp +++ b/src/motif/clipbrd.cpp @@ -14,6 +14,10 @@ #pragma implementation "clipbrd.h" #endif +#include "wx/defs.h" + +#if wxUSE_CLIPBOARD + #include "wx/app.h" #include "wx/frame.h" #include "wx/bitmap.h" @@ -22,15 +26,19 @@ #include "wx/clipbrd.h" #include "wx/dataobj.h" +#ifdef __VMS__ +#pragma message disable nosimpint +#endif #include #include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif #include -#if !USE_SHARED_LIBRARY // IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) // IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject) -#endif static bool gs_clipboardIsOpen = FALSE; @@ -91,7 +99,7 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) return TRUE; } -bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int height) +bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int WXUNUSED(width), int WXUNUSED(height)) { if (dataFormat != wxDF_TEXT) return FALSE; @@ -203,19 +211,19 @@ wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len) wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat) { // Only wxDF_TEXT supported - if (dataFormat == (wxDataFormat) 0) + if (dataFormat == wxDF_TEXT) return wxDF_TEXT; else - return (wxDataFormat) 0; + return wxDF_INVALID; } -wxDataFormat wxRegisterClipboardFormat(char *formatName) +wxDataFormat wxRegisterClipboardFormat(char *WXUNUSED(formatName)) { // Not supported - return (wxDataFormat) 0; + return (wxDataFormat) wxDF_INVALID; } -bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount) +bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int WXUNUSED(maxCount)) { // Only wxDF_TEXT supported if (dataFormat == wxDF_TEXT) @@ -233,8 +241,6 @@ bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int max IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject) -wxClipboard* wxTheClipboard = (wxClipboard*) NULL; - wxClipboard::wxClipboard() { m_open = FALSE; @@ -271,28 +277,36 @@ bool wxClipboard::SetData( wxDataObject *data ) wxCHECK_MSG( data, FALSE, "data is invalid" ); wxCHECK_MSG( m_open, FALSE, "clipboard not open" ); - switch (data->GetFormat()) + Clear(); + + return AddData( data ); +} + +bool wxClipboard::AddData( wxDataObject *data ) +{ + wxCHECK_MSG( data, FALSE, "data is invalid" ); + wxCHECK_MSG( m_open, FALSE, "clipboard not open" ); + + wxDataFormat::NativeFormat format = data->GetPreferredFormat().GetType(); + switch ( format ) { case wxDF_TEXT: case wxDF_OEMTEXT: { wxTextDataObject* textDataObject = (wxTextDataObject*) data; wxString str(textDataObject->GetText()); - return wxSetClipboardData(data->GetFormat(), (wxObject*) (const char*) str); - break; + return wxSetClipboardData(format, (wxObject*) (const char*) str); } +#if 0 case wxDF_BITMAP: case wxDF_DIB: { wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data; wxBitmap bitmap(bitmapDataObject->GetBitmap()); - return wxSetClipboardData(data->GetFormat(), & bitmap); + return wxSetClipboardData(data->GetType(), & bitmap); break; } - default: - { - return FALSE; - } +#endif // 0 } return FALSE; @@ -306,25 +320,26 @@ void wxClipboard::Close() wxCloseClipboard(); } -bool wxClipboard::IsSupportedFormat( wxDataFormat format, const wxString& WXUNUSED(id) ) +bool wxClipboard::IsSupported( const wxDataFormat& format) { return wxIsClipboardFormatAvailable(format); } -bool wxClipboard::GetData( wxDataObject *data ) +bool wxClipboard::GetData( wxDataObject& data ) { wxCHECK_MSG( m_open, FALSE, "clipboard not open" ); - switch (data->GetFormat()) + wxDataFormat::NativeFormat format = data.GetPreferredFormat().GetType(); + switch ( format ) { case wxDF_TEXT: case wxDF_OEMTEXT: { - wxTextDataObject* textDataObject = (wxTextDataObject*) data; - char* s = (char*) wxGetClipboardData(data->GetFormat()); + wxTextDataObject& textDataObject = (wxTextDataObject &) data; + char* s = (char*) wxGetClipboardData(format); if (s) { - textDataObject->SetText(s); + textDataObject.SetText(s); delete[] s; return TRUE; } @@ -332,11 +347,12 @@ bool wxClipboard::GetData( wxDataObject *data ) return FALSE; break; } +/* case wxDF_BITMAP: case wxDF_DIB: { wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data; - wxBitmap* bitmap = (wxBitmap*) wxGetClipboardData(data->GetFormat()); + wxBitmap* bitmap = (wxBitmap*) wxGetClipboardData(data->GetType()); if (bitmap) { bitmapDataObject->SetBitmap(* bitmap); @@ -347,6 +363,7 @@ bool wxClipboard::GetData( wxDataObject *data ) return FALSE; break; } +*/ default: { return FALSE; @@ -355,26 +372,6 @@ bool wxClipboard::GetData( wxDataObject *data ) return FALSE; } -//----------------------------------------------------------------------------- -// wxClipboardModule -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule,wxModule) - -bool wxClipboardModule::OnInit() -{ - wxTheClipboard = new wxClipboard(); - - return TRUE; -} - -void wxClipboardModule::OnExit() -{ - if (wxTheClipboard) delete wxTheClipboard; - wxTheClipboard = (wxClipboard*) NULL; -} - - #if 0 /* @@ -525,3 +522,4 @@ char *wxClipboard::GetClipboardData(char *format, long *length, long time) } #endif +#endif // wxUSE_CLIPBOARD