- WindowRef window = MacGetRootWindow() ;
- Rect rect = {0, 0 , m_height , m_width } ;
- RgnHandle updateRgn = GetUpdateRegion().GetWXHRGN() ;
- SetClip( event.GetDC()->MacGetCurrentClipRgn() ) ;
-
- if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE) )
- {
- SetThemeWindowBackground( window , kThemeBrushDocumentWindowBackground , false ) ;
- }
- else if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE ) )
- {
- // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
- // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
- // either a non gray background color or a non control window
-
- wxWindowMac* parent = GetParent() ;
- while( parent )
- {
- if ( parent->MacGetRootWindow() != window )
- {
- // we are in a different window on the mac system
- parent = NULL ;
- break ;
- }
- //if( parent->IsKindOf( CLASSINFO( wxControl ) ) && ((wxControl*)parent)->GetMacControl() )
- {
- if ( parent->m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE )
- && parent->m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE) )
- {
- // if we have any other colours in the hierarchy
- RGBBackColor( &parent->m_backgroundColour.GetPixel()) ;
- break ;
- }
- // if we have the normal colours in the hierarchy but another control etc. -> use it's background
- if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
- {
- Rect box ;
- GetRegionBounds( updateRgn , &box) ;
- ::ApplyThemeBackground(kThemeBackgroundTabPane, &box , kThemeStateActive,8,true);
- break ;
- }
- }
- /*
- else
- {
- // we have arrived at a non control item
- parent = NULL ;
- break ;
- }
- */
- parent = parent->GetParent() ;
- }
- if ( !parent )
- {
- // if there is nothing special -> use default
- SetThemeWindowBackground( window , kThemeBrushDialogBackgroundActive , false ) ;
- }
- }
- else
- {
- RGBBackColor( &m_backgroundColour.GetPixel()) ;
- }
- EraseRect( &rect ) ;