focus and border refreshes etc corrected

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-08-29 10:04:36 +00:00
parent 3d11a79a94
commit 7ebf5540cc

View File

@@ -693,6 +693,39 @@ wxWindowMac::~wxWindowMac()
m_isBeingDeleted = TRUE; m_isBeingDeleted = TRUE;
if ( m_peer )
{
// deleting a window while it is shown invalidates the region occupied by border or
// focus
int outerBorder = MacGetLeftBorderSize() ;
if ( m_peer->NeedsFocusRect() && m_peer->HasFocus() )
outerBorder += 4 ;
if ( IsShown() && ( outerBorder > 0 ) )
{
// as the borders are drawn on the parent we have to properly invalidate all these areas
RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() , updateTotal = NewRgn() ;
Rect rect ;
m_peer->GetRect( &rect ) ;
RectRgn( updateInner , &rect ) ;
InsetRect( &rect , -outerBorder , -outerBorder ) ;
RectRgn( updateOuter , &rect ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
wxPoint parent(0,0);
GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
parent -= GetParent()->GetClientAreaOrigin() ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
CopyRgn( updateOuter , updateTotal ) ;
GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
DisposeRgn(updateOuter) ;
DisposeRgn(updateInner) ;
DisposeRgn(updateTotal) ;
}
}
#ifndef __WXUNIVERSAL__ #ifndef __WXUNIVERSAL__
// VS: make sure there's no wxFrame with last focus set to us: // VS: make sure there's no wxFrame with last focus set to us:
for ( wxWindow *win = GetParent(); win; win = win->GetParent() ) for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
@@ -1111,6 +1144,14 @@ bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
if ( adjustOrigin ) if ( adjustOrigin )
AdjustForParentClientOrigin( x , y ) ; AdjustForParentClientOrigin( x , y ) ;
#if TARGET_API_MAC_OSX
// this is in window relative coordinate, as this parent may have a border, its physical position is offset by this border
if ( ! GetParent()->IsTopLevel() )
{
x -= GetParent()->MacGetLeftBorderSize() ;
y -= GetParent()->MacGetTopBorderSize() ;
}
#endif
return true ; return true ;
} }
@@ -1597,21 +1638,11 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
{ {
// we don't adjust twice for the origin // we don't adjust twice for the origin
Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ; Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ;
#if TARGET_API_MAC_OSX
// this is in window relative coordinate, as this parent may have a border, its physical position is offset by this border
if ( ! GetParent()->IsTopLevel() )
{
r.left -= GetParent()->MacGetLeftBorderSize() ;
r.top -= GetParent()->MacGetTopBorderSize() ;
r.right -= GetParent()->MacGetLeftBorderSize() ;
r.bottom -= GetParent()->MacGetTopBorderSize() ;
}
#endif
bool vis = m_peer->IsVisible(); bool vis = m_peer->IsVisible();
int outerBorder = MacGetLeftBorderSize() ; int outerBorder = MacGetLeftBorderSize() ;
if ( m_peer->NeedsFocusRect() && m_peer->HasFocus() ) if ( m_peer->NeedsFocusRect() && m_peer->HasFocus() )
outerBorder = 4 ; outerBorder += 4 ;
if ( vis && ( outerBorder > 0 ) ) if ( vis && ( outerBorder > 0 ) )
{ {
@@ -1636,10 +1667,8 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
InsetRect( &rect , -outerBorder , -outerBorder ) ; InsetRect( &rect , -outerBorder , -outerBorder ) ;
RectRgn( updateOuter , &rect ) ; RectRgn( updateOuter , &rect ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ; DiffRgn( updateOuter , updateInner ,updateOuter ) ;
wxPoint parentorig(0,0);
GetParent()->MacWindowToRootWindow( &parentorig.x , &parentorig.y ) ; OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
parent -= GetParent()->GetClientAreaOrigin() ;
OffsetRgn( updateOuter , -parentorig.x , -parentorig.y ) ;
UnionRgn( updateOuter , updateTotal , updateTotal ) ; UnionRgn( updateOuter , updateTotal , updateTotal ) ;
GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ; GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
@@ -2169,7 +2198,9 @@ void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
} }
else else
#endif #endif
event.GetDC()->Clear() ; {
event.GetDC()->Clear() ;
}
} }
void wxWindowMac::OnNcPaint( wxNcPaintEvent& event ) void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
@@ -2813,8 +2844,9 @@ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time )
wxWindowDC dc(this) ; wxWindowDC dc(this) ;
dc.SetClippingRegion(wxRegion(updatergn)); dc.SetClippingRegion(wxRegion(updatergn));
wxMacPortSetter helper(&dc) ; wxMacPortSetter helper(&dc) ;
OffsetRect( &childRect , dc.m_macLocalOrigin.x , dc.m_macLocalOrigin.y ) ; Rect r = childRect ;
DrawThemeFocusRect( &childRect , true ) ; OffsetRect( &r , dc.m_macLocalOrigin.x , dc.m_macLocalOrigin.y ) ;
DrawThemeFocusRect( &r , true ) ;
} }
} }
} }