+
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+
+OSStatus wxOSXRegionToRectsCounterCallback(
+ int message, HIShapeRef WXUNUSED(region), const CGRect *WXUNUSED(rect), void *data )
+{
+ long *m_numRects = (long*) data ;
+ if ( message == kHIShapeEnumerateInit )
+ {
+ (*m_numRects) = 0 ;
+ }
+ else if (message == kHIShapeEnumerateRect)
+ {
+ (*m_numRects) += 1 ;
+ }
+
+ return noErr;
+}
+
+OSStatus wxOSXRegionToRectsSetterCallback(
+ int message, HIShapeRef WXUNUSED(region), const CGRect *rect, void *data )
+{
+ if (message == kHIShapeEnumerateRect)
+ {
+ RegionToRectsCallbackData *cb = (RegionToRectsCallbackData*) data ;
+ cb->m_rects[cb->m_current++] = wxRect( rect->origin.x , rect->origin.y , rect->size.width , rect->size.height ) ;
+ }
+
+ return noErr;
+}
+