+ }
+
+ // now we cannot rely on having its borders drawn by a window itself, as it does not
+ // get the updateRgn wide enough to always do so, so we do it from the parent
+ // this would also be the place to draw any custom backgrounds for native controls
+ // in Composited windowing
+ wxPoint clientOrigin = GetClientAreaOrigin() ;
+
+ 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
+#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
+#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
+ }