// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "dataobj.h"
#endif
#include "wx/dataobj.h"
#include "wx/app.h"
+#include "wx/utils.h"
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
#include <Xm/Xm.h>
-#include "wx/utils.h"
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
+
+#include "wx/motif/private.h"
//-------------------------------------------------------------------------
// global data
//-------------------------------------------------------------------------
Atom g_textAtom = 0;
-Atom g_pngAtom = 0;
+Atom g_bitmapAtom = 0;
Atom g_fileAtom = 0;
//-------------------------------------------------------------------------
m_format = g_textAtom;
else
if (m_type == wxDF_BITMAP)
- m_format = g_pngAtom;
+ m_format = g_bitmapAtom;
else
if (m_type == wxDF_FILENAME)
m_format = g_fileAtom;
if (m_format == g_textAtom)
m_type = wxDF_TEXT;
else
- if (m_format == g_pngAtom)
+ if (m_format == g_bitmapAtom)
m_type = wxDF_BITMAP;
else
if (m_format == g_fileAtom)
PrepareFormats();
m_type = wxDF_PRIVATE;
wxString tmp( id );
- m_format = XInternAtom( (Display*) wxGetDisplay(), wxMBSTRINGCAST tmp.mbc_str(), FALSE ); // what is the string cast for?
+ m_format = XInternAtom( wxGlobalDisplay(),
+ tmp.mbc_str(), FALSE );
}
void wxDataFormat::PrepareFormats()
{
if (!g_textAtom)
- g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
- if (!g_pngAtom)
- g_pngAtom = XInternAtom( (Display*) wxGetDisplay(), "image/png", FALSE );
+ g_textAtom = XInternAtom( wxGlobalDisplay(), "STRING", FALSE );
+ if (!g_bitmapAtom)
+ g_bitmapAtom = XInternAtom( wxGlobalDisplay(), "PIXMAP", FALSE );
if (!g_fileAtom)
- g_fileAtom = XInternAtom( (Display*) wxGetDisplay(), "file:ALL", FALSE );
+ g_fileAtom = XInternAtom( wxGlobalDisplay(), "file:ALL", FALSE );
}
-#if 0
-
// ----------------------------------------------------------------------------
-// wxPrivateDataObject
+// wxDataObject
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS( wxPrivateDataObject, wxDataObject )
-
-void wxPrivateDataObject::Free()
+wxDataObject::~wxDataObject()
{
- if ( m_data )
- free(m_data);
}
-wxPrivateDataObject::wxPrivateDataObject()
-{
- wxString id = wxT("application/");
- id += wxTheApp->GetAppName();
-
- m_format.SetId( id );
+// ----------------------------------------------------------------------------
+// wxBitmapDataObject
+// ----------------------------------------------------------------------------
- m_size = 0;
- m_data = (void *)NULL;
+size_t wxBitmapDataObject::GetDataSize() const
+{
+ return sizeof(Pixmap);
}
-void wxPrivateDataObject::SetData( const void *data, size_t size )
+bool wxBitmapDataObject::GetDataHere(void* buf) const
{
- Free();
+ if( !GetBitmap().Ok() )
+ return false;
- m_size = size;
- m_data = malloc(size);
+ (*(Pixmap*)buf) = (Pixmap)GetBitmap().GetDrawable();
- memcpy( m_data, data, size );
+ return true;
}
-void wxPrivateDataObject::WriteData( void *dest ) const
+bool wxBitmapDataObject::SetData(size_t len, const void* buf)
{
- WriteData( m_data, dest );
-}
+ if( len != sizeof(Pixmap) )
+ return false;
-size_t wxPrivateDataObject::GetSize() const
-{
- return m_size;
-}
+ WXPixmap pixmap = (WXPixmap)*(Pixmap*)buf;
-void wxPrivateDataObject::WriteData( const void *data, void *dest ) const
-{
- memcpy( dest, data, GetSize() );
-}
+ m_bitmap.Create( pixmap );
-#endif // 0
+ return true;
+}
#endif // wxUSE_CLIPBOARD