patch 1352744
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
90e572f1e5
commit
21ec3bf99c
@ -60,10 +60,8 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
case wxDF_METAFILE :
|
case wxDF_METAFILE :
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
{
|
// custom datatype
|
||||||
wxLogError(_("Unsupported clipboard format."));
|
break ;
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@ -226,12 +224,12 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
|
|
||||||
wxCHECK_MSG( data, false, wxT("data is invalid") );
|
wxCHECK_MSG( data, false, wxT("data is invalid") );
|
||||||
|
|
||||||
/* we can only store one wxDataObject */
|
// we can only store one wxDataObject
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
m_data = data;
|
m_data = data;
|
||||||
|
|
||||||
/* get formats from wxDataObjects */
|
// get formats from wxDataObjects
|
||||||
wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ];
|
wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ];
|
||||||
m_data->GetAllFormats( array );
|
m_data->GetAllFormats( array );
|
||||||
|
|
||||||
@ -272,6 +270,7 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
mactype = kScrapFlavorTypePicture ;
|
mactype = kScrapFlavorTypePicture ;
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
|
mactype = (OSType)(array[i].GetFormatId());
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
UMAPutScrap( sz , mactype , buf ) ;
|
UMAPutScrap( sz , mactype , buf ) ;
|
||||||
@ -297,7 +296,6 @@ void wxClipboard::Close()
|
|||||||
delete m_data;
|
delete m_data;
|
||||||
m_data = (wxDataObject*) NULL;
|
m_data = (wxDataObject*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
|
bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
|
||||||
@ -351,59 +349,59 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
|
|
||||||
if ( m_data )
|
if ( m_data )
|
||||||
{
|
{
|
||||||
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
||||||
{
|
{
|
||||||
wxDataFormat format = array[i] ;
|
wxDataFormat format = array[i] ;
|
||||||
if ( m_data->IsSupported( format ) )
|
if ( m_data->IsSupported( format ) )
|
||||||
{
|
{
|
||||||
int size = m_data->GetDataSize( format );
|
int size = m_data->GetDataSize( format );
|
||||||
transferred = true ;
|
transferred = true ;
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
data.SetData(format , 0 , 0 ) ;
|
data.SetData(format , 0 , 0 ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *d = new char[size];
|
||||||
|
m_data->GetDataHere( format , (void*) d );
|
||||||
|
data.SetData( format , size , d ) ;
|
||||||
|
delete[] d ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
char *d = new char[size];
|
|
||||||
m_data->GetDataHere( format , (void*) d );
|
|
||||||
data.SetData( format , size , d ) ;
|
|
||||||
delete[] d ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* get formats from wxDataObjects */
|
|
||||||
|
// get formats from wxDataObjects
|
||||||
if ( !transferred )
|
if ( !transferred )
|
||||||
{
|
{
|
||||||
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
||||||
{
|
{
|
||||||
wxDataFormat format = array[i] ;
|
wxDataFormat format = array[i] ;
|
||||||
|
|
||||||
switch ( format.GetType() )
|
switch ( format.GetType() )
|
||||||
{
|
{
|
||||||
case wxDF_TEXT :
|
// NOTE: this is usable for all data types
|
||||||
case wxDF_UNICODETEXT:
|
case wxDF_TEXT :
|
||||||
case wxDF_OEMTEXT :
|
case wxDF_UNICODETEXT:
|
||||||
case wxDF_BITMAP :
|
case wxDF_OEMTEXT :
|
||||||
case wxDF_METAFILE :
|
case wxDF_BITMAP :
|
||||||
{
|
case wxDF_METAFILE :
|
||||||
long len ;
|
default :
|
||||||
char* s = (char*)wxGetClipboardData(format, &len );
|
{
|
||||||
if ( s )
|
long len ;
|
||||||
{
|
char* s = (char*)wxGetClipboardData(format, &len );
|
||||||
data.SetData( format , len , s ) ;
|
if ( s )
|
||||||
delete [] s;
|
{
|
||||||
|
data.SetData( format , len , s ) ;
|
||||||
|
delete [] s;
|
||||||
|
|
||||||
transferred = true ;
|
transferred = true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
|
||||||
|
|
||||||
default :
|
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] array ;
|
delete[] array ;
|
||||||
|
Loading…
Reference in New Issue
Block a user