cleanup, going private with platform specific that is only needed at one place
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50309 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -606,17 +606,6 @@ PicHandle wxBitmapRefData::GetPictHandle()
|
|||||||
return m_pictHandle ;
|
return m_pictHandle ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t size);
|
|
||||||
|
|
||||||
void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t WXUNUSED(size))
|
|
||||||
{
|
|
||||||
wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ;
|
|
||||||
|
|
||||||
wxASSERT( data == membuf->GetData() ) ;
|
|
||||||
|
|
||||||
delete membuf ;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGImageRef wxBitmapRefData::CreateCGImage() const
|
CGImageRef wxBitmapRefData::CreateCGImage() const
|
||||||
{
|
{
|
||||||
wxASSERT( m_ok ) ;
|
wxASSERT( m_ok ) ;
|
||||||
@@ -644,16 +633,15 @@ CGImageRef wxBitmapRefData::CreateCGImage() const
|
|||||||
int w = m_width ;
|
int w = m_width ;
|
||||||
int h = m_height ;
|
int h = m_height ;
|
||||||
CGImageAlphaInfo alphaInfo = kCGImageAlphaNoneSkipFirst ;
|
CGImageAlphaInfo alphaInfo = kCGImageAlphaNoneSkipFirst ;
|
||||||
wxMemoryBuffer* membuf = NULL ;
|
wxMemoryBuffer membuf;
|
||||||
|
|
||||||
if ( m_bitmapMask )
|
if ( m_bitmapMask )
|
||||||
{
|
{
|
||||||
alphaInfo = kCGImageAlphaFirst ;
|
alphaInfo = kCGImageAlphaFirst ;
|
||||||
membuf = new wxMemoryBuffer( imageSize ) ;
|
unsigned char *destalphastart = (unsigned char*) membuf.GetWriteBuf( imageSize ) ;
|
||||||
memcpy( membuf->GetData() , dataBuffer , imageSize ) ;
|
memcpy( destalphastart , dataBuffer , imageSize ) ;
|
||||||
unsigned char *sourcemaskstart = (unsigned char *) m_bitmapMask->GetRawAccess() ;
|
unsigned char *sourcemaskstart = (unsigned char *) m_bitmapMask->GetRawAccess() ;
|
||||||
int maskrowbytes = m_bitmapMask->GetBytesPerRow() ;
|
int maskrowbytes = m_bitmapMask->GetBytesPerRow() ;
|
||||||
unsigned char *destalphastart = (unsigned char *) membuf->GetData() ;
|
|
||||||
for ( int y = 0 ; y < h ; ++y , destalphastart += m_bytesPerRow, sourcemaskstart += maskrowbytes)
|
for ( int y = 0 ; y < h ; ++y , destalphastart += m_bytesPerRow, sourcemaskstart += maskrowbytes)
|
||||||
{
|
{
|
||||||
unsigned char *sourcemask = sourcemaskstart ;
|
unsigned char *sourcemask = sourcemaskstart ;
|
||||||
@@ -663,6 +651,7 @@ CGImageRef wxBitmapRefData::CreateCGImage() const
|
|||||||
*destalpha = 0xFF - *sourcemask ;
|
*destalpha = 0xFF - *sourcemask ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
membuf.UngetWriteBuf( imageSize );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -675,35 +664,37 @@ CGImageRef wxBitmapRefData::CreateCGImage() const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
membuf = new wxMemoryBuffer( m_memBuf ) ;
|
membuf = m_memBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGDataProviderRef dataProvider = NULL ;
|
CGDataProviderRef dataProvider = NULL ;
|
||||||
if ( m_depth == 1 )
|
if ( m_depth == 1 )
|
||||||
{
|
{
|
||||||
wxMemoryBuffer* maskBuf = new wxMemoryBuffer( m_width * m_height );
|
// TODO CHECK ALIGNMENT
|
||||||
unsigned char * maskBufData = (unsigned char *) maskBuf->GetData();
|
wxMemoryBuffer maskBuf;
|
||||||
unsigned char * bufData = (unsigned char *) membuf->GetData() ;
|
unsigned char * maskBufData = (unsigned char*) maskBuf.GetWriteBuf( m_width * m_height );
|
||||||
|
unsigned char * bufData = (unsigned char *) membuf.GetData() ;
|
||||||
// copy one color component
|
// copy one color component
|
||||||
for( int i = 0 ; i < m_width * m_height ; ++i )
|
size_t i = 0;
|
||||||
maskBufData[i] = bufData[i*4+3];
|
for( int y = 0 ; y < m_height ; bufData+= m_bytesPerRow, ++y )
|
||||||
|
{
|
||||||
|
unsigned char *bufDataIter = bufData+3;
|
||||||
|
for ( int x = 0 ; x < m_width ; bufDataIter += 4, ++x, ++i )
|
||||||
|
{
|
||||||
|
maskBufData[i] = *bufDataIter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maskBuf.UngetWriteBuf( m_width * m_height );
|
||||||
|
|
||||||
dataProvider =
|
dataProvider =
|
||||||
CGDataProviderCreateWithData(
|
wxMacCGDataProviderCreateWithMemoryBuffer( maskBuf );
|
||||||
maskBuf , (const void *) maskBufData , m_width * m_height,
|
|
||||||
wxMacMemoryBufferReleaseProc );
|
|
||||||
// as we are now passing the mask buffer to the data provider, we have
|
|
||||||
// to release the membuf ourselves
|
|
||||||
delete membuf ;
|
|
||||||
|
|
||||||
image = ::CGImageMaskCreate( w, h, 8, 8, m_width , dataProvider, NULL, false );
|
image = ::CGImageMaskCreate( w, h, 8, 8, m_width , dataProvider, NULL, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CGColorSpaceRef colorSpace = wxMacGetGenericRGBColorSpace();
|
CGColorSpaceRef colorSpace = wxMacGetGenericRGBColorSpace();
|
||||||
dataProvider =
|
dataProvider = wxMacCGDataProviderCreateWithMemoryBuffer( membuf );
|
||||||
CGDataProviderCreateWithData(
|
|
||||||
membuf , (const void *)membuf->GetData() , imageSize,
|
|
||||||
wxMacMemoryBufferReleaseProc );
|
|
||||||
image =
|
image =
|
||||||
::CGImageCreate(
|
::CGImageCreate(
|
||||||
w, h, 8 , 32 , m_bytesPerRow , colorSpace, alphaInfo ,
|
w, h, 8 , 32 , m_bytesPerRow , colorSpace, alphaInfo ,
|
||||||
|
@@ -2221,3 +2221,67 @@ wxGraphicsFont wxMacCoreGraphicsRenderer::CreateFont( const wxFont &font , const
|
|||||||
return wxNullGraphicsFont;
|
return wxNullGraphicsFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// CoreGraphics Helper Methods
|
||||||
|
//
|
||||||
|
|
||||||
|
// Data Providers and Consumers
|
||||||
|
|
||||||
|
size_t UMAPutBytesCFRefCallback( void *info, const void *bytes, size_t count )
|
||||||
|
{
|
||||||
|
CFMutableDataRef data = (CFMutableDataRef) info;
|
||||||
|
if ( data )
|
||||||
|
{
|
||||||
|
CFDataAppendBytes( data, (const UInt8*) bytes, count );
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacReleaseCFDataProviderCallback(void *info,
|
||||||
|
const void *WXUNUSED(data),
|
||||||
|
size_t WXUNUSED(count))
|
||||||
|
{
|
||||||
|
if ( info )
|
||||||
|
CFRelease( (CFDataRef) info );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacReleaseCFDataConsumerCallback( void *info )
|
||||||
|
{
|
||||||
|
if ( info )
|
||||||
|
CFRelease( (CFDataRef) info );
|
||||||
|
}
|
||||||
|
|
||||||
|
CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data )
|
||||||
|
{
|
||||||
|
if ( data == NULL )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return CGDataProviderCreateWithCFData( data );
|
||||||
|
}
|
||||||
|
|
||||||
|
CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data )
|
||||||
|
{
|
||||||
|
if ( data == NULL )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return CGDataConsumerCreateWithCFData( data );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacReleaseMemoryBufferProviderCallback(void *info, const void *data, size_t WXUNUSED(size))
|
||||||
|
{
|
||||||
|
wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ;
|
||||||
|
|
||||||
|
wxASSERT( data == membuf->GetData() ) ;
|
||||||
|
|
||||||
|
delete membuf ;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf )
|
||||||
|
{
|
||||||
|
wxMemoryBuffer* b = new wxMemoryBuffer( buf );
|
||||||
|
if ( b->GetDataLen() == 0 )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return CGDataProviderCreateWithData( b , (const void *) b->GetData() , b->GetDataLen() ,
|
||||||
|
wxMacReleaseMemoryBufferProviderCallback );
|
||||||
|
}
|
@@ -48,6 +48,37 @@ static const int IDM_WINDOWICONS = 4003;
|
|||||||
static const int IDM_WINDOWNEXT = 4004;
|
static const int IDM_WINDOWNEXT = 4004;
|
||||||
static const int IDM_WINDOWTILEVERT = 4005;
|
static const int IDM_WINDOWTILEVERT = 4005;
|
||||||
|
|
||||||
|
// others
|
||||||
|
|
||||||
|
void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
||||||
|
{
|
||||||
|
#if 1 // TODO REMOVE
|
||||||
|
if ( inWindowRef )
|
||||||
|
{
|
||||||
|
// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
|
||||||
|
// if ( inActivate != isHighlighted )
|
||||||
|
#ifndef __LP64__
|
||||||
|
GrafPtr port ;
|
||||||
|
GetPort( &port ) ;
|
||||||
|
SetPortWindowPort( inWindowRef ) ;
|
||||||
|
#endif
|
||||||
|
HiliteWindow( inWindowRef , inActivate ) ;
|
||||||
|
ControlRef control = NULL ;
|
||||||
|
::GetRootControl( inWindowRef , &control ) ;
|
||||||
|
if ( control )
|
||||||
|
{
|
||||||
|
if ( inActivate )
|
||||||
|
::ActivateControl( control ) ;
|
||||||
|
else
|
||||||
|
::DeactivateControl( control ) ;
|
||||||
|
}
|
||||||
|
#ifndef __LP64__
|
||||||
|
SetPort( port ) ;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Parent frame
|
// Parent frame
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -100,7 +100,7 @@ wxMetafileRefData::wxMetafileRefData( int width, int height)
|
|||||||
|
|
||||||
CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0);
|
CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0);
|
||||||
m_data.reset(data);
|
m_data.reset(data);
|
||||||
CGDataConsumerRef dataConsumer = UMACGDataConsumerCreateWithCFData(data);
|
CGDataConsumerRef dataConsumer = wxMacCGDataConsumerCreateWithCFData(data);
|
||||||
m_context = CGPDFContextCreate( dataConsumer, (width != 0 && height != 0) ? &r : NULL , NULL );
|
m_context = CGPDFContextCreate( dataConsumer, (width != 0 && height != 0) ? &r : NULL , NULL );
|
||||||
CGDataConsumerRelease( dataConsumer );
|
CGDataConsumerRelease( dataConsumer );
|
||||||
if ( m_context )
|
if ( m_context )
|
||||||
@@ -140,7 +140,7 @@ void wxMetafileRefData::Close()
|
|||||||
|
|
||||||
void wxMetafileRefData::UpdateDocumentFromData()
|
void wxMetafileRefData::UpdateDocumentFromData()
|
||||||
{
|
{
|
||||||
wxCFRef<CGDataProviderRef> provider(UMACGDataProviderCreateWithCFData(m_data));
|
wxCFRef<CGDataProviderRef> provider(wxMacCGDataProviderCreateWithCFData(m_data));
|
||||||
m_pdfDoc.reset(CGPDFDocumentCreateWithProvider(provider));
|
m_pdfDoc.reset(CGPDFDocumentCreateWithProvider(provider));
|
||||||
if ( m_pdfDoc != NULL )
|
if ( m_pdfDoc != NULL )
|
||||||
{
|
{
|
||||||
@@ -209,7 +209,7 @@ void wxMetafile::SetPICT(void* pictHandle)
|
|||||||
Handle picHandle = (Handle) pictHandle;
|
Handle picHandle = (Handle) pictHandle;
|
||||||
HLock(picHandle);
|
HLock(picHandle);
|
||||||
CFDataRef data = CFDataCreateWithBytesNoCopy( kCFAllocatorDefault, (const UInt8*) *picHandle, GetHandleSize(picHandle), kCFAllocatorNull);
|
CFDataRef data = CFDataCreateWithBytesNoCopy( kCFAllocatorDefault, (const UInt8*) *picHandle, GetHandleSize(picHandle), kCFAllocatorNull);
|
||||||
wxCFRef<CGDataProviderRef> provider(UMACGDataProviderCreateWithCFData(data));
|
wxCFRef<CGDataProviderRef> provider(wxMacCGDataProviderCreateWithCFData(data));
|
||||||
QDPictRef pictRef = QDPictCreateWithProvider(provider);
|
QDPictRef pictRef = QDPictCreateWithProvider(provider);
|
||||||
CGRect rect = QDPictGetBounds(pictRef);
|
CGRect rect = QDPictGetBounds(pictRef);
|
||||||
m_refData = new wxMetafileRefData(wx_static_cast(int, rect.size.width),
|
m_refData = new wxMetafileRefData(wx_static_cast(int, rect.size.width),
|
||||||
|
@@ -2398,7 +2398,7 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
|
|||||||
return ;
|
return ;
|
||||||
|
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
UMAGetControlBoundsInWindowCoords( m_controlRef, &bounds );
|
GetRectInWindowCoords( &bounds );
|
||||||
|
|
||||||
wxRect visRect = textctrl->MacGetClippedClientRect() ;
|
wxRect visRect = textctrl->MacGetClippedClientRect() ;
|
||||||
Rect visBounds = { visRect.y , visRect.x , visRect.y + visRect.height , visRect.x + visRect.width } ;
|
Rect visBounds = { visRect.y , visRect.x , visRect.y + visRect.height , visRect.x + visRect.width } ;
|
||||||
@@ -2826,7 +2826,7 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
|
||||||
|
|
||||||
// calculate the rectangles used by the control
|
// calculate the rectangles used by the control
|
||||||
UMAGetControlBoundsInWindowCoords( m_controlRef, &bounds );
|
GetRectInWindowCoords( &bounds );
|
||||||
|
|
||||||
m_txnControlBounds = bounds ;
|
m_txnControlBounds = bounds ;
|
||||||
m_txnVisBounds = bounds ;
|
m_txnVisBounds = bounds ;
|
||||||
|
@@ -390,59 +390,6 @@ void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlRef wxMacFindSubControl( wxTopLevelWindowMac* toplevelWindow, const Point& location , ControlRef superControl , ControlPartCode *outPart )
|
|
||||||
{
|
|
||||||
if ( superControl )
|
|
||||||
{
|
|
||||||
UInt16 childrenCount = 0 ;
|
|
||||||
ControlHandle sibling ;
|
|
||||||
Rect r ;
|
|
||||||
OSStatus err = CountSubControls( superControl , &childrenCount ) ;
|
|
||||||
if ( err == errControlIsNotEmbedder )
|
|
||||||
return NULL ;
|
|
||||||
|
|
||||||
wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ) ;
|
|
||||||
|
|
||||||
for ( UInt16 i = childrenCount ; i >=1 ; --i )
|
|
||||||
{
|
|
||||||
err = GetIndexedSubControl( superControl , i , & sibling ) ;
|
|
||||||
if ( err == errControlIsNotEmbedder )
|
|
||||||
return NULL ;
|
|
||||||
|
|
||||||
wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ) ;
|
|
||||||
if ( IsControlVisible( sibling ) )
|
|
||||||
{
|
|
||||||
UMAGetControlBoundsInWindowCoords( sibling , &r ) ;
|
|
||||||
if ( MacPtInRect( location , &r ) )
|
|
||||||
{
|
|
||||||
ControlHandle child = wxMacFindSubControl( toplevelWindow , location , sibling , outPart ) ;
|
|
||||||
if ( child )
|
|
||||||
{
|
|
||||||
return child ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Point testLocation = location ;
|
|
||||||
|
|
||||||
if ( toplevelWindow )
|
|
||||||
{
|
|
||||||
testLocation.h -= r.left ;
|
|
||||||
testLocation.v -= r.top ;
|
|
||||||
}
|
|
||||||
|
|
||||||
*outPart = TestControl( sibling , testLocation ) ;
|
|
||||||
|
|
||||||
return sibling ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define NEW_CAPTURE_HANDLING 1
|
#define NEW_CAPTURE_HANDLING 1
|
||||||
|
|
||||||
pascal OSStatus
|
pascal OSStatus
|
||||||
@@ -1068,9 +1015,9 @@ bool wxTopLevelWindowMac::SetBackgroundColour(const wxColour& col )
|
|||||||
if ( !wxTopLevelWindowBase::SetBackgroundColour(col) && m_hasBgCol )
|
if ( !wxTopLevelWindowBase::SetBackgroundColour(col) && m_hasBgCol )
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) )
|
if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) || col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDocumentWindowBackground)) )
|
||||||
SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDocumentWindowBackground, false ) ;
|
SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDocumentWindowBackground, false ) ;
|
||||||
else if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) )
|
else if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) || col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive)) )
|
||||||
SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDialogBackgroundActive, false ) ;
|
SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDialogBackgroundActive, false ) ;
|
||||||
// TODO BETTER THEME SUPPORT
|
// TODO BETTER THEME SUPPORT
|
||||||
return true;
|
return true;
|
||||||
|
@@ -57,32 +57,6 @@ void UMAInitToolbox( UInt16 WXUNUSED(inMoreMastersCalls),
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// process manager
|
|
||||||
long UMAGetProcessMode()
|
|
||||||
{
|
|
||||||
OSErr err ;
|
|
||||||
ProcessInfoRec processinfo;
|
|
||||||
ProcessSerialNumber procno ;
|
|
||||||
|
|
||||||
procno.highLongOfPSN = 0 ;
|
|
||||||
procno.lowLongOfPSN = kCurrentProcess ;
|
|
||||||
processinfo.processInfoLength = sizeof(ProcessInfoRec);
|
|
||||||
processinfo.processName = NULL;
|
|
||||||
#ifndef __LP64__
|
|
||||||
processinfo.processAppSpec = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
err = ::GetProcessInformation( &procno , &processinfo ) ;
|
|
||||||
wxASSERT( err == noErr ) ;
|
|
||||||
|
|
||||||
return processinfo.processMode ;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UMAGetProcessModeDoesActivateOnFGSwitch()
|
|
||||||
{
|
|
||||||
return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// menu manager
|
// menu manager
|
||||||
|
|
||||||
#if wxMAC_USE_COCOA == 0
|
#if wxMAC_USE_COCOA == 0
|
||||||
@@ -339,108 +313,4 @@ OSStatus UMAGetHelpMenuDontCreate(
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// window manager
|
|
||||||
|
|
||||||
#if wxMAC_USE_QUICKDRAW
|
|
||||||
|
|
||||||
void UMAActivateControl( ControlRef inControl )
|
|
||||||
{
|
|
||||||
::ActivateControl( inControl ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UMADeactivateControl( ControlRef inControl )
|
|
||||||
{
|
|
||||||
::DeactivateControl( inControl ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// others
|
|
||||||
|
|
||||||
void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
|
||||||
{
|
|
||||||
#if 1 // TODO REMOVE
|
|
||||||
if ( inWindowRef )
|
|
||||||
{
|
|
||||||
// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
|
|
||||||
// if ( inActivate != isHighlighted )
|
|
||||||
#ifndef __LP64__
|
|
||||||
GrafPtr port ;
|
|
||||||
GetPort( &port ) ;
|
|
||||||
SetPortWindowPort( inWindowRef ) ;
|
|
||||||
#endif
|
|
||||||
HiliteWindow( inWindowRef , inActivate ) ;
|
|
||||||
ControlRef control = NULL ;
|
|
||||||
::GetRootControl( inWindowRef , &control ) ;
|
|
||||||
if ( control )
|
|
||||||
{
|
|
||||||
if ( inActivate )
|
|
||||||
UMAActivateControl( control ) ;
|
|
||||||
else
|
|
||||||
UMADeactivateControl( control ) ;
|
|
||||||
}
|
|
||||||
#ifndef __LP64__
|
|
||||||
SetPort( port ) ;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Rect * UMAGetControlBoundsInWindowCoords( ControlRef theControl, Rect *bounds )
|
|
||||||
{
|
|
||||||
GetControlBounds( theControl , bounds ) ;
|
|
||||||
|
|
||||||
WindowRef tlwref = GetControlOwner( theControl ) ;
|
|
||||||
|
|
||||||
wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ;
|
|
||||||
if ( tlwwx != NULL )
|
|
||||||
{
|
|
||||||
ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ;
|
|
||||||
HIPoint hiPoint = CGPointMake( 0 , 0 ) ;
|
|
||||||
HIViewConvertPoint( &hiPoint , HIViewGetSuperview(theControl) , rootControl ) ;
|
|
||||||
OffsetRect( bounds , (short) hiPoint.x , (short) hiPoint.y ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bounds ;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t UMAPutBytesCFRefCallback( void *info, const void *bytes, size_t count )
|
|
||||||
{
|
|
||||||
CFMutableDataRef data = (CFMutableDataRef) info;
|
|
||||||
if ( data )
|
|
||||||
{
|
|
||||||
CFDataAppendBytes( data, (const UInt8*) bytes, count );
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UMAReleaseCFDataProviderCallback(void *info,
|
|
||||||
const void *WXUNUSED(data),
|
|
||||||
size_t WXUNUSED(count))
|
|
||||||
{
|
|
||||||
if ( info )
|
|
||||||
CFRelease( (CFDataRef) info );
|
|
||||||
}
|
|
||||||
|
|
||||||
void UMAReleaseCFDataConsumerCallback( void *info )
|
|
||||||
{
|
|
||||||
if ( info )
|
|
||||||
CFRelease( (CFDataRef) info );
|
|
||||||
}
|
|
||||||
|
|
||||||
CGDataProviderRef UMACGDataProviderCreateWithCFData( CFDataRef data )
|
|
||||||
{
|
|
||||||
if ( data == NULL )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return CGDataProviderCreateWithCFData( data );
|
|
||||||
}
|
|
||||||
|
|
||||||
CGDataConsumerRef UMACGDataConsumerCreateWithCFData( CFMutableDataRef data )
|
|
||||||
{
|
|
||||||
if ( data == NULL )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return CGDataConsumerCreateWithCFData( data );
|
|
||||||
}
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
@@ -823,7 +823,18 @@ void wxMacControl::GetRect( Rect *r )
|
|||||||
|
|
||||||
void wxMacControl::GetRectInWindowCoords( Rect *r )
|
void wxMacControl::GetRectInWindowCoords( Rect *r )
|
||||||
{
|
{
|
||||||
UMAGetControlBoundsInWindowCoords( m_controlRef , r );
|
GetControlBounds( m_controlRef , r ) ;
|
||||||
|
|
||||||
|
WindowRef tlwref = GetControlOwner( m_controlRef ) ;
|
||||||
|
|
||||||
|
wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ;
|
||||||
|
if ( tlwwx != NULL )
|
||||||
|
{
|
||||||
|
ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ;
|
||||||
|
HIPoint hiPoint = CGPointMake( 0 , 0 ) ;
|
||||||
|
HIViewConvertPoint( &hiPoint , HIViewGetSuperview(m_controlRef) , rootControl ) ;
|
||||||
|
OffsetRect( r , (short) hiPoint.x , (short) hiPoint.y ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::GetBestRect( Rect *r )
|
void wxMacControl::GetBestRect( Rect *r )
|
||||||
|
Reference in New Issue
Block a user