+ for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext())
+ {
+ wxWindowMac *child = node->GetData();
+ if (child == m_vScrollBar) continue;
+ if (child == m_hScrollBar) continue;
+ if (child->IsTopLevel()) continue;
+ if (!child->IsShown()) continue;
+
+ int x,y;
+ child->GetPosition( &x, &y );
+ int w,h;
+ child->GetSize( &w, &h );
+ Rect childRect = { y , x , y + h , x + w } ;
+ OffsetRect( &childRect , clientOrigin.x , clientOrigin.y ) ;
+ if ( child->MacGetTopBorderSize() )
+ {
+ if ( RectInRgn( &childRect , updatergn ) )
+ {
+#if wxMAC_USE_CORE_GRAPHICS
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
+ if ( HIThemeDrawFrame )
+ {
+ Rect srect = childRect ;
+ HIThemeFrameDrawInfo info ;
+ info.version = 0 ;
+ info.kind = 0 ;
+ info.state = IsEnabled() ? kThemeStateActive : kThemeStateInactive ;
+ if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
+ {
+ SInt32 border = 0 ;
+ GetThemeMetric( kThemeMetricEditTextFrameOutset , &border ) ;
+ InsetRect( &srect , border , border );
+ info.kind = kHIThemeFrameTextFieldSquare ;
+ }
+ else if (HasFlag(wxSIMPLE_BORDER))
+ {
+ SInt32 border = 0 ;
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+ InsetRect( &srect , border , border );
+ info.kind = kHIThemeFrameListBox ;
+ }
+
+ CGRect rect = CGRectMake( srect.left , srect.top , srect.right - srect.left ,
+ srect.bottom - srect.top ) ;
+ HIThemeDrawFrame( &rect , &info , (CGContextRef) MacGetCGContextRef() , kHIThemeOrientationNormal ) ;
+ }
+#endif
+#else
+ // paint custom borders
+ wxNcPaintEvent eventNc( child->GetId() );
+ eventNc.SetEventObject( child );
+ if ( !child->GetEventHandler()->ProcessEvent( eventNc ) )
+ {
+ wxWindowDC dc(this) ;
+ dc.SetClippingRegion(wxRegion(updatergn));
+ wxMacPortSetter helper(&dc) ;
+ child->MacPaintBorders( dc.m_macLocalOrigin.x + childRect.left , dc.m_macLocalOrigin.y + childRect.top) ;
+ }
+#endif
+ }
+ }
+ if ( child->m_peer->NeedsFocusRect() && child->m_peer->HasFocus() )
+ {
+#if wxMAC_USE_CORE_GRAPHICS
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
+ if ( HIThemeDrawFocusRect )
+ {
+ CGRect rect = CGRectMake( childRect.left , childRect.top , childRect.right - childRect.left ,
+ childRect.bottom - childRect.top ) ;
+ HIThemeDrawFocusRect( &rect , true , (CGContextRef) MacGetCGContextRef() , kHIThemeOrientationNormal ) ;
+ }
+#endif
+#else
+ wxWindowDC dc(this) ;
+ dc.SetClippingRegion(wxRegion(updatergn));
+ wxMacPortSetter helper(&dc) ;
+ Rect r = childRect ;
+ OffsetRect( &r , dc.m_macLocalOrigin.x , dc.m_macLocalOrigin.y ) ;
+ DrawThemeFocusRect( &r , true ) ;
+#endif
+ }