#endif
#if wxOSX_USE_COCOA_OR_IPHONE
-extern CGContextRef wxOSXGetContextFromCurrentNSContext() ;
+extern CGContextRef wxOSXGetContextFromCurrentContext() ;
+#if wxOSX_USE_COCOA
extern bool wxOSXLockFocus( WXWidget view) ;
extern void wxOSXUnlockFocus( WXWidget view) ;
#endif
+#endif
#if 1 // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
kATSUSizeTag ,
kATSUColorTag ,
};
- ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
+ ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
{
sizeof( Fixed ) ,
sizeof( RGBColor ) ,
};
- ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
+ ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
{
&atsuSize ,
&atsuColor ,
};
status = ::ATSUSetAttributes(
- m_macATSUIStyle, sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
+ m_macATSUIStyle, WXSIZEOF(atsuTags),
atsuTags, atsuSizes, atsuValues);
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
#if wxOSX_USE_COCOA_OR_IPHONE
m_view = window->GetHandle();
- if ( !((wxWidgetCocoaImpl*) window->GetPeer())->IsFlipped() )
+#if wxOSX_USE_COCOA
+ if ( ! window->GetPeer()->IsFlipped() )
{
m_windowTransform = CGAffineTransformMakeTranslation( 0 , m_height );
m_windowTransform = CGAffineTransformScale( m_windowTransform , 1 , -1 );
}
else
+#endif
{
m_windowTransform = CGAffineTransformIdentity;
}
if (m_invisible)
return false;
-#if wxOSX_USE_COCOA_OR_IPHONE
+#if wxOSX_USE_COCOA
if ( wxOSXLockFocus(m_view) )
{
- m_cgContext = wxOSXGetContextFromCurrentNSContext();
- wxASSERT_MSG( m_cgContext != NULL, _T("Unable to retrieve drawing context from View"));
+ m_cgContext = wxOSXGetContextFromCurrentContext();
+ wxASSERT_MSG( m_cgContext != NULL, wxT("Unable to retrieve drawing context from View"));
}
else
{
m_invisible = true;
}
#endif
+#if wxOSX_USE_IPHONE
+ m_cgContext = wxOSXGetContextFromCurrentContext();
+ if ( m_cgContext == NULL )
+ {
+ m_invisible = true;
+ }
+#endif
#if wxOSX_USE_CARBON
OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
if ( status != noErr )
CGContextConcatCTM( m_cgContext, m_windowTransform );
CGContextSaveGState( m_cgContext );
m_contextSynthesized = true;
+#if wxOSX_USE_COCOA_OR_CARBON
if ( m_clipRgn.get() )
{
// the clip region is in device coordinates, so we convert this again to user coordinates
CGContextClip( m_cgContext );
}
}
+#endif
CGContextSaveGState( m_cgContext );
#if 0 // turn on for debugging of clientdc
#if wxOSX_USE_CARBON
QDEndCGContext( GetWindowPort( m_windowRef ) , &m_cgContext);
#endif
-#if wxOSX_USE_COCOA_OR_IPHONE
+#if wxOSX_USE_COCOA
wxOSXUnlockFocus(m_view);
#endif
}
{
kATSULineRotationTag ,
};
- ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
+ ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
{
sizeof( Fixed ) ,
};
- ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
+ ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
{
&atsuAngle ,
};
- status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags) / sizeof(ATSUAttributeTag),
+ status = ::ATSUSetLayoutControls(atsuLayout , WXSIZEOF(atsuTags),
atsuTags, atsuSizes, atsuValues );
}
{
kATSUCGContextTag ,
};
- ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
+ ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
{
sizeof( CGContextRef ) ,
};
- ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
+ ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
{
&m_cgContext ,
};
- status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags) / sizeof(ATSUAttributeTag),
+ status = ::ATSUSetLayoutControls(atsuLayout , WXSIZEOF(atsuTags),
atsuTags, atsuSizes, atsuValues );
}