clipboard
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19151 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9d1461a451
commit
9c3c584918
@ -23,10 +23,10 @@
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/mac/private.h"
|
||||
#ifndef __DARWIN__
|
||||
#include <Scrap.h>
|
||||
#endif
|
||||
#include "wx/mac/uma.h"
|
||||
|
||||
#define wxUSE_DATAOBJ 1
|
||||
|
||||
@ -55,6 +55,9 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
||||
|
||||
case wxDF_TEXT:
|
||||
break;
|
||||
case wxDF_BITMAP :
|
||||
case wxDF_METAFILE :
|
||||
break ;
|
||||
default:
|
||||
{
|
||||
wxLogError(_("Unsupported clipboard format."));
|
||||
@ -240,43 +243,38 @@ bool wxClipboard::AddData( wxDataObject *data )
|
||||
{
|
||||
mac = textDataObject->GetText() ;
|
||||
}
|
||||
#if !TARGET_CARBON
|
||||
err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
|
||||
#else
|
||||
ScrapRef scrap;
|
||||
err = GetCurrentScrap (&scrap);
|
||||
if ( !err )
|
||||
{
|
||||
err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
|
||||
}
|
||||
#endif
|
||||
err = UMAPutScrap( mac.Length() , 'TEXT' , (void*) mac.c_str() ) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
case wxDF_METAFILE:
|
||||
{
|
||||
wxMetafileDataObject* metaFileDataObject =
|
||||
wxMetafileDataObject* metaFileDataObject =
|
||||
(wxMetafileDataObject*) data;
|
||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||
HLock( (Handle) pict ) ;
|
||||
#if !TARGET_CARBON
|
||||
err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||
#else
|
||||
ScrapRef scrap;
|
||||
err = GetCurrentScrap (&scrap);
|
||||
if ( !err )
|
||||
{
|
||||
err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
|
||||
}
|
||||
#endif
|
||||
HUnlock( (Handle) pict ) ;
|
||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||
HLock( (Handle) pict ) ;
|
||||
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||
HUnlock( (Handle) pict ) ;
|
||||
}
|
||||
break ;
|
||||
#endif
|
||||
case wxDF_BITMAP:
|
||||
case wxDF_DIB:
|
||||
{
|
||||
bool created = false ;
|
||||
PicHandle pict = NULL ;
|
||||
|
||||
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
|
||||
pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
|
||||
|
||||
HLock( (Handle) pict ) ;
|
||||
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||
HUnlock( (Handle) pict ) ;
|
||||
if ( created )
|
||||
KillPicture( pict ) ;
|
||||
}
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
@ -375,8 +373,10 @@ bool wxClipboard::GetData( wxDataObject& data )
|
||||
|
||||
switch ( format.GetType() )
|
||||
{
|
||||
case wxDF_TEXT:
|
||||
case wxDF_OEMTEXT:
|
||||
case wxDF_TEXT :
|
||||
case wxDF_OEMTEXT :
|
||||
case wxDF_BITMAP :
|
||||
case wxDF_METAFILE :
|
||||
{
|
||||
long len ;
|
||||
char* s = (char*)wxGetClipboardData(format, &len );
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "wx/defs.h"
|
||||
#include "wx/dc.h"
|
||||
#include "wx/mac/uma.h"
|
||||
#include <MacTextEditor.h>
|
||||
|
||||
#ifndef __DARWIN__
|
||||
@ -15,6 +14,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __DARWIN__
|
||||
#include <Scrap.h>
|
||||
#endif
|
||||
#include "wx/mac/uma.h"
|
||||
|
||||
// since we have decided that we only support 8.6 upwards we are
|
||||
// checking for these minimum requirements in the startup code of
|
||||
// the application so all wxWindows code can safely assume that appearance 1.1
|
||||
@ -829,3 +833,19 @@ wxMacPortStateHelper::~wxMacPortStateHelper()
|
||||
}
|
||||
}
|
||||
|
||||
OSStatus UMAPutScrap( Size size , OSType type , void *data )
|
||||
{
|
||||
OSStatus err = noErr ;
|
||||
#if !TARGET_CARBON
|
||||
err = PutScrap( size , type , data ) ;
|
||||
#else
|
||||
ScrapRef scrap;
|
||||
err = GetCurrentScrap (&scrap);
|
||||
if ( !err )
|
||||
{
|
||||
err = PutScrapFlavor (scrap, type , 0, size, data);
|
||||
}
|
||||
#endif
|
||||
return err ;
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,10 @@
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include "wx/mac/private.h"
|
||||
#ifndef __DARWIN__
|
||||
#include <Scrap.h>
|
||||
#endif
|
||||
#include "wx/mac/uma.h"
|
||||
|
||||
#define wxUSE_DATAOBJ 1
|
||||
|
||||
@ -55,6 +55,9 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
||||
|
||||
case wxDF_TEXT:
|
||||
break;
|
||||
case wxDF_BITMAP :
|
||||
case wxDF_METAFILE :
|
||||
break ;
|
||||
default:
|
||||
{
|
||||
wxLogError(_("Unsupported clipboard format."));
|
||||
@ -240,43 +243,38 @@ bool wxClipboard::AddData( wxDataObject *data )
|
||||
{
|
||||
mac = textDataObject->GetText() ;
|
||||
}
|
||||
#if !TARGET_CARBON
|
||||
err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
|
||||
#else
|
||||
ScrapRef scrap;
|
||||
err = GetCurrentScrap (&scrap);
|
||||
if ( !err )
|
||||
{
|
||||
err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
|
||||
}
|
||||
#endif
|
||||
err = UMAPutScrap( mac.Length() , 'TEXT' , (void*) mac.c_str() ) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
case wxDF_METAFILE:
|
||||
{
|
||||
wxMetafileDataObject* metaFileDataObject =
|
||||
wxMetafileDataObject* metaFileDataObject =
|
||||
(wxMetafileDataObject*) data;
|
||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||
HLock( (Handle) pict ) ;
|
||||
#if !TARGET_CARBON
|
||||
err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||
#else
|
||||
ScrapRef scrap;
|
||||
err = GetCurrentScrap (&scrap);
|
||||
if ( !err )
|
||||
{
|
||||
err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
|
||||
}
|
||||
#endif
|
||||
HUnlock( (Handle) pict ) ;
|
||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||
HLock( (Handle) pict ) ;
|
||||
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||
HUnlock( (Handle) pict ) ;
|
||||
}
|
||||
break ;
|
||||
#endif
|
||||
case wxDF_BITMAP:
|
||||
case wxDF_DIB:
|
||||
{
|
||||
bool created = false ;
|
||||
PicHandle pict = NULL ;
|
||||
|
||||
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
|
||||
pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
|
||||
|
||||
HLock( (Handle) pict ) ;
|
||||
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||
HUnlock( (Handle) pict ) ;
|
||||
if ( created )
|
||||
KillPicture( pict ) ;
|
||||
}
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
@ -375,8 +373,10 @@ bool wxClipboard::GetData( wxDataObject& data )
|
||||
|
||||
switch ( format.GetType() )
|
||||
{
|
||||
case wxDF_TEXT:
|
||||
case wxDF_OEMTEXT:
|
||||
case wxDF_TEXT :
|
||||
case wxDF_OEMTEXT :
|
||||
case wxDF_BITMAP :
|
||||
case wxDF_METAFILE :
|
||||
{
|
||||
long len ;
|
||||
char* s = (char*)wxGetClipboardData(format, &len );
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "wx/defs.h"
|
||||
#include "wx/dc.h"
|
||||
#include "wx/mac/uma.h"
|
||||
#include <MacTextEditor.h>
|
||||
|
||||
#ifndef __DARWIN__
|
||||
@ -15,6 +14,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __DARWIN__
|
||||
#include <Scrap.h>
|
||||
#endif
|
||||
#include "wx/mac/uma.h"
|
||||
|
||||
// since we have decided that we only support 8.6 upwards we are
|
||||
// checking for these minimum requirements in the startup code of
|
||||
// the application so all wxWindows code can safely assume that appearance 1.1
|
||||
@ -829,3 +833,19 @@ wxMacPortStateHelper::~wxMacPortStateHelper()
|
||||
}
|
||||
}
|
||||
|
||||
OSStatus UMAPutScrap( Size size , OSType type , void *data )
|
||||
{
|
||||
OSStatus err = noErr ;
|
||||
#if !TARGET_CARBON
|
||||
err = PutScrap( size , type , data ) ;
|
||||
#else
|
||||
ScrapRef scrap;
|
||||
err = GetCurrentScrap (&scrap);
|
||||
if ( !err )
|
||||
{
|
||||
err = PutScrapFlavor (scrap, type , 0, size, data);
|
||||
}
|
||||
#endif
|
||||
return err ;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user