clipboard
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19151 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,10 +23,10 @@
|
|||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
#include "wx/mac/private.h"
|
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
#include <Scrap.h>
|
#include <Scrap.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
#define wxUSE_DATAOBJ 1
|
#define wxUSE_DATAOBJ 1
|
||||||
|
|
||||||
@@ -55,6 +55,9 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
|
|
||||||
case wxDF_TEXT:
|
case wxDF_TEXT:
|
||||||
break;
|
break;
|
||||||
|
case wxDF_BITMAP :
|
||||||
|
case wxDF_METAFILE :
|
||||||
|
break ;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxLogError(_("Unsupported clipboard format."));
|
wxLogError(_("Unsupported clipboard format."));
|
||||||
@@ -240,16 +243,7 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
{
|
{
|
||||||
mac = textDataObject->GetText() ;
|
mac = textDataObject->GetText() ;
|
||||||
}
|
}
|
||||||
#if !TARGET_CARBON
|
err = UMAPutScrap( mac.Length() , 'TEXT' , (void*) mac.c_str() ) ;
|
||||||
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
|
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
@@ -261,22 +255,26 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||||
HLock( (Handle) pict ) ;
|
HLock( (Handle) pict ) ;
|
||||||
#if !TARGET_CARBON
|
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||||
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 ) ;
|
HUnlock( (Handle) pict ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
#endif
|
#endif
|
||||||
case wxDF_BITMAP:
|
case wxDF_BITMAP:
|
||||||
case wxDF_DIB:
|
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:
|
default:
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
@@ -377,6 +375,8 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
{
|
{
|
||||||
case wxDF_TEXT :
|
case wxDF_TEXT :
|
||||||
case wxDF_OEMTEXT :
|
case wxDF_OEMTEXT :
|
||||||
|
case wxDF_BITMAP :
|
||||||
|
case wxDF_METAFILE :
|
||||||
{
|
{
|
||||||
long len ;
|
long len ;
|
||||||
char* s = (char*)wxGetClipboardData(format, &len );
|
char* s = (char*)wxGetClipboardData(format, &len );
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#include "wx/mac/uma.h"
|
|
||||||
#include <MacTextEditor.h>
|
#include <MacTextEditor.h>
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
@@ -15,6 +14,11 @@
|
|||||||
# endif
|
# endif
|
||||||
#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
|
// since we have decided that we only support 8.6 upwards we are
|
||||||
// checking for these minimum requirements in the startup code of
|
// checking for these minimum requirements in the startup code of
|
||||||
// the application so all wxWindows code can safely assume that appearance 1.1
|
// 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/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
#include "wx/mac/private.h"
|
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
#include <Scrap.h>
|
#include <Scrap.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
#define wxUSE_DATAOBJ 1
|
#define wxUSE_DATAOBJ 1
|
||||||
|
|
||||||
@@ -55,6 +55,9 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
|
|
||||||
case wxDF_TEXT:
|
case wxDF_TEXT:
|
||||||
break;
|
break;
|
||||||
|
case wxDF_BITMAP :
|
||||||
|
case wxDF_METAFILE :
|
||||||
|
break ;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxLogError(_("Unsupported clipboard format."));
|
wxLogError(_("Unsupported clipboard format."));
|
||||||
@@ -240,16 +243,7 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
{
|
{
|
||||||
mac = textDataObject->GetText() ;
|
mac = textDataObject->GetText() ;
|
||||||
}
|
}
|
||||||
#if !TARGET_CARBON
|
err = UMAPutScrap( mac.Length() , 'TEXT' , (void*) mac.c_str() ) ;
|
||||||
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
|
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
@@ -261,22 +255,26 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||||
HLock( (Handle) pict ) ;
|
HLock( (Handle) pict ) ;
|
||||||
#if !TARGET_CARBON
|
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||||
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 ) ;
|
HUnlock( (Handle) pict ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
#endif
|
#endif
|
||||||
case wxDF_BITMAP:
|
case wxDF_BITMAP:
|
||||||
case wxDF_DIB:
|
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:
|
default:
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
@@ -377,6 +375,8 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
{
|
{
|
||||||
case wxDF_TEXT :
|
case wxDF_TEXT :
|
||||||
case wxDF_OEMTEXT :
|
case wxDF_OEMTEXT :
|
||||||
|
case wxDF_BITMAP :
|
||||||
|
case wxDF_METAFILE :
|
||||||
{
|
{
|
||||||
long len ;
|
long len ;
|
||||||
char* s = (char*)wxGetClipboardData(format, &len );
|
char* s = (char*)wxGetClipboardData(format, &len );
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#include "wx/mac/uma.h"
|
|
||||||
#include <MacTextEditor.h>
|
#include <MacTextEditor.h>
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
@@ -15,6 +14,11 @@
|
|||||||
# endif
|
# endif
|
||||||
#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
|
// since we have decided that we only support 8.6 upwards we are
|
||||||
// checking for these minimum requirements in the startup code of
|
// checking for these minimum requirements in the startup code of
|
||||||
// the application so all wxWindows code can safely assume that appearance 1.1
|
// 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 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user