+
+OSStatus wxMacRegionToRectsCounterCallback (
+ UInt16 message, RgnHandle region, const Rect *rect, void *data)
+{
+ long *m_numRects = (long*) data ;
+ if ( message == kQDRegionToRectsMsgInit )
+ {
+ (*m_numRects) = 0 ;
+ }
+ else if (message == kQDRegionToRectsMsgParse)
+ {
+ (*m_numRects) += 1 ;
+ }
+ return noErr;
+}
+
+class RegionToRectsCallbackData
+{
+public :
+ wxRect* m_rects ;
+ long m_current ;
+} ;
+
+OSStatus wxMacRegionToRectsSetterCallback (
+ UInt16 message, RgnHandle region, const Rect *rect, void *data)
+{
+ if (message == kQDRegionToRectsMsgParse)
+ {
+ RegionToRectsCallbackData *cb = (RegionToRectsCallbackData*) data ;
+ cb->m_rects[cb->m_current++] = wxRect( rect->left , rect->top , rect->right - rect->left , rect->bottom - rect->top ) ;
+ }
+ return noErr;
+}
+