wxMotif compilation fixes for wxDataObject and PROCESS_EVENTS (wxSocket)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/clipbrd.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// wxClipboardBase
|
||||
|
@@ -45,11 +45,11 @@
|
||||
#include "wx/socket.h"
|
||||
|
||||
|
||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||
#define PROCESS_EVENTS() wxYield()
|
||||
#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMOTIF__)
|
||||
#define PROCESS_EVENTS() wxYield()
|
||||
#elif defined(__WXGTK__)
|
||||
#include <gtk/gtk.h>
|
||||
#define PROCESS_EVENTS() gtk_main_iteration()
|
||||
#include <gtk/gtk.h>
|
||||
#define PROCESS_EVENTS() gtk_main_iteration()
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -275,30 +275,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;
|
||||
@@ -312,25 +318,26 @@ void wxClipboard::Close()
|
||||
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( 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;
|
||||
}
|
||||
@@ -343,7 +350,7 @@ bool wxClipboard::GetData( wxDataObject *data )
|
||||
case wxDF_DIB:
|
||||
{
|
||||
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
|
||||
wxBitmap* bitmap = (wxBitmap*) wxGetClipboardData(data->GetFormat());
|
||||
wxBitmap* bitmap = (wxBitmap*) wxGetClipboardData(data->GetType());
|
||||
if (bitmap)
|
||||
{
|
||||
bitmapDataObject->SetBitmap(* bitmap);
|
||||
|
@@ -25,14 +25,12 @@
|
||||
// global data
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
Atom g_textAtom = 0;
|
||||
Atom g_textAtom = 0;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDataFormat
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxDataFormat, wxObject)
|
||||
|
||||
wxDataFormat::wxDataFormat()
|
||||
{
|
||||
if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
|
||||
@@ -122,16 +120,6 @@ void wxDataFormat::SetType( wxDataFormatId type )
|
||||
m_hasAtom = FALSE;
|
||||
}
|
||||
|
||||
wxDataFormatId wxDataFormat::GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
wxString wxDataFormat::GetId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void wxDataFormat::SetId( const wxChar *id )
|
||||
{
|
||||
m_type = wxDF_PRIVATE;
|
||||
@@ -176,83 +164,7 @@ Atom wxDataFormat::GetAtom()
|
||||
return m_atom;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDataObject
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS( wxDataObject, wxObject )
|
||||
|
||||
wxDataObject::wxDataObject()
|
||||
{
|
||||
}
|
||||
|
||||
wxDataObject::~wxDataObject()
|
||||
{
|
||||
}
|
||||
|
||||
wxDataFormat &wxDataObject::GetFormat()
|
||||
{
|
||||
return m_format;
|
||||
}
|
||||
|
||||
wxDataFormatId wxDataObject::GetFormatType() const
|
||||
{
|
||||
return m_format.GetType();
|
||||
}
|
||||
|
||||
wxString wxDataObject::GetFormatId() const
|
||||
{
|
||||
return m_format.GetId();
|
||||
}
|
||||
|
||||
Atom wxDataObject::GetFormatAtom() const
|
||||
{
|
||||
Atom ret = ((wxDataObject*) this)->m_format.GetAtom();
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextDataObject
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( wxTextDataObject, wxDataObject )
|
||||
|
||||
wxTextDataObject::wxTextDataObject()
|
||||
{
|
||||
m_format.SetType( wxDF_TEXT );
|
||||
}
|
||||
|
||||
wxTextDataObject::wxTextDataObject( const wxString& data )
|
||||
{
|
||||
m_format.SetType( wxDF_TEXT );
|
||||
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
void wxTextDataObject::SetText( const wxString& data )
|
||||
{
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
wxString wxTextDataObject::GetText() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
void wxTextDataObject::WriteData( void *dest ) const
|
||||
{
|
||||
WriteString( m_data, dest );
|
||||
}
|
||||
|
||||
size_t wxTextDataObject::GetSize() const
|
||||
{
|
||||
return m_data.Len() + 1;
|
||||
}
|
||||
|
||||
void wxTextDataObject::WriteString( const wxString &str, void *dest ) const
|
||||
{
|
||||
memcpy( dest, str.mb_str(), str.Len()+1 );
|
||||
}
|
||||
#if 0
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPrivateDataObject
|
||||
@@ -302,4 +214,6 @@ void wxPrivateDataObject::WriteData( const void *data, void *dest ) const
|
||||
memcpy( dest, data, GetSize() );
|
||||
}
|
||||
|
||||
#endif // 0
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
Reference in New Issue
Block a user