adding protected inquiry function whether a child window belongs to the 'client' or the 'non-client' area, examples for the latter are toolbar, scrollbars etc
adding another cached clip rect for the real client area git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33233 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -251,6 +251,21 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
|
|||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxFrame::MacIsChildOfClientArea( const wxWindow* child ) const
|
||||||
|
{
|
||||||
|
#if wxUSE_STATUSBAR
|
||||||
|
if ( child == GetStatusBar() )
|
||||||
|
return false ;
|
||||||
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
|
#if wxUSE_TOOLBAR
|
||||||
|
if ( child == GetToolBar() )
|
||||||
|
return false ;
|
||||||
|
#endif // wxUSE_TOOLBAR
|
||||||
|
|
||||||
|
return wxFrameBase::MacIsChildOfClientArea( child ) ;
|
||||||
|
}
|
||||||
|
|
||||||
void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
|
void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
|
||||||
{
|
{
|
||||||
int currentclientwidth , currentclientheight ;
|
int currentclientwidth , currentclientheight ;
|
||||||
|
@@ -1440,11 +1440,11 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
|
|||||||
|
|
||||||
if (m_hScrollBar && m_hScrollBar->IsShown() )
|
if (m_hScrollBar && m_hScrollBar->IsShown() )
|
||||||
{
|
{
|
||||||
hh -= m_hScrollBar->GetSize().y ; // MAC_SCROLLBAR_SIZE ;
|
hh -= m_hScrollBar->GetSize().y ;
|
||||||
}
|
}
|
||||||
if (m_vScrollBar && m_vScrollBar->IsShown() )
|
if (m_vScrollBar && m_vScrollBar->IsShown() )
|
||||||
{
|
{
|
||||||
ww -= m_vScrollBar->GetSize().x ; // MAC_SCROLLBAR_SIZE;
|
ww -= m_vScrollBar->GetSize().x ;
|
||||||
}
|
}
|
||||||
if(x) *x = ww;
|
if(x) *x = ww;
|
||||||
if(y) *y = hh;
|
if(y) *y = hh;
|
||||||
@@ -1752,8 +1752,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
m_cachedClippedRectValid = false ;
|
m_cachedClippedRectValid = false ;
|
||||||
m_peer->SetRect( &r ) ;
|
m_peer->SetRect( &r ) ;
|
||||||
|
|
||||||
if ( doMove )
|
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
||||||
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
|
||||||
|
|
||||||
MacInvalidateBorders() ;
|
MacInvalidateBorders() ;
|
||||||
|
|
||||||
@@ -2735,6 +2734,12 @@ wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
|
|||||||
return win ;
|
return win ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wxRect& wxWindowMac::MacGetClippedClientRect() const
|
||||||
|
{
|
||||||
|
MacUpdateClippedRects() ;
|
||||||
|
return m_cachedClippedClientRect ;
|
||||||
|
}
|
||||||
|
|
||||||
const wxRect& wxWindowMac::MacGetClippedRect() const
|
const wxRect& wxWindowMac::MacGetClippedRect() const
|
||||||
{
|
{
|
||||||
MacUpdateClippedRects() ;
|
MacUpdateClippedRects() ;
|
||||||
@@ -2791,54 +2796,54 @@ void wxWindowMac::MacUpdateClippedRects() const
|
|||||||
rIncludingOuterStructures = r ;
|
rIncludingOuterStructures = r ;
|
||||||
InsetRect( &rIncludingOuterStructures , -4 , -4 ) ;
|
InsetRect( &rIncludingOuterStructures , -4 , -4 ) ;
|
||||||
|
|
||||||
if ( !IsTopLevel() )
|
wxRect cl = GetClientRect() ;
|
||||||
|
Rect rClient = { cl.y , cl.x , cl.y + cl.height , cl.x + cl.width } ;
|
||||||
|
|
||||||
|
const wxWindow* child = this ;
|
||||||
|
const wxWindow* parent = NULL ;
|
||||||
|
while( !child->IsTopLevel() && ( parent = child->GetParent() ) != NULL )
|
||||||
{
|
{
|
||||||
const wxWindow* child = this ;
|
int x , y ;
|
||||||
const wxWindow* parent = child->GetParent() ;
|
wxSize size ;
|
||||||
while( parent )
|
|
||||||
|
if ( parent->MacIsChildOfClientArea(child) )
|
||||||
{
|
{
|
||||||
int x , y ;
|
size = parent->GetClientSize() ;
|
||||||
wxSize size ;
|
wxPoint origin = parent->GetClientAreaOrigin() ;
|
||||||
// we have to find a better clipping algorithm here, in order not to clip things
|
x = origin.x ;
|
||||||
// positioned like status and toolbar
|
y = origin.y ;
|
||||||
if ( 1 /* parent->IsTopLevel() && child->IsKindOf( CLASSINFO( wxToolBar ) ) */ )
|
|
||||||
{
|
|
||||||
size = parent->GetSize() ;
|
|
||||||
x = y = 0 ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
size = parent->GetClientSize() ;
|
|
||||||
wxPoint origin = parent->GetClientAreaOrigin() ;
|
|
||||||
x = origin.x ;
|
|
||||||
y = origin.y ;
|
|
||||||
}
|
|
||||||
parent->MacWindowToRootWindow( &x, &y ) ;
|
|
||||||
MacRootWindowToWindow( &x , &y ) ;
|
|
||||||
|
|
||||||
Rect rparent = {
|
|
||||||
y + parent->MacGetTopBorderSize() , x + parent->MacGetLeftBorderSize() ,
|
|
||||||
y + size.y - parent->MacGetBottomBorderSize() ,
|
|
||||||
x + size.x - parent->MacGetRightBorderSize() } ;
|
|
||||||
|
|
||||||
// the content will always be clipped
|
|
||||||
SectRect( &r , &rparent , &r ) ;
|
|
||||||
|
|
||||||
// the structure only at 'hard' borders
|
|
||||||
if ( parent->MacClipChildren() ||
|
|
||||||
( parent->GetParent() && parent->GetParent()->MacClipGrandChildren() ) )
|
|
||||||
{
|
|
||||||
SectRect( &rIncludingOuterStructures , &rparent , &rIncludingOuterStructures ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( parent->IsTopLevel() )
|
|
||||||
break ;
|
|
||||||
child = parent ;
|
|
||||||
parent = child->GetParent() ;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// this will be true for scrollbars, toolbars etc.
|
||||||
|
size = parent->GetSize() ;
|
||||||
|
y = parent->MacGetTopBorderSize() ;
|
||||||
|
x = parent->MacGetLeftBorderSize() ;
|
||||||
|
size.x -= parent->MacGetLeftBorderSize() + parent->MacGetRightBorderSize() ;
|
||||||
|
size.y -= parent->MacGetTopBorderSize() + parent->MacGetBottomBorderSize() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent->MacWindowToRootWindow( &x, &y ) ;
|
||||||
|
MacRootWindowToWindow( &x , &y ) ;
|
||||||
|
|
||||||
|
Rect rparent = { y , x , y + size.y , x + size.x } ;
|
||||||
|
|
||||||
|
// the wxwindow and client rects will always be clipped
|
||||||
|
SectRect( &r , &rparent , &r ) ;
|
||||||
|
SectRect( &rClient , &rparent , &rClient ) ;
|
||||||
|
|
||||||
|
// the structure only at 'hard' borders
|
||||||
|
if ( parent->MacClipChildren() ||
|
||||||
|
( parent->GetParent() && parent->GetParent()->MacClipGrandChildren() ) )
|
||||||
|
{
|
||||||
|
SectRect( &rIncludingOuterStructures , &rparent , &rIncludingOuterStructures ) ;
|
||||||
|
}
|
||||||
|
child = parent ;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cachedClippedRect = wxRect( r.left , r.top , r.right - r.left , r.bottom - r.top ) ;
|
m_cachedClippedRect = wxRect( r.left , r.top , r.right - r.left , r.bottom - r.top ) ;
|
||||||
|
m_cachedClippedClientRect = wxRect( rClient.left , rClient.top ,
|
||||||
|
rClient.right - rClient.left , rClient.bottom - rClient.top ) ;
|
||||||
m_cachedClippedRectWithOuterStructure = wxRect(
|
m_cachedClippedRectWithOuterStructure = wxRect(
|
||||||
rIncludingOuterStructures.left , rIncludingOuterStructures.top ,
|
rIncludingOuterStructures.left , rIncludingOuterStructures.top ,
|
||||||
rIncludingOuterStructures.right - rIncludingOuterStructures.left ,
|
rIncludingOuterStructures.right - rIncludingOuterStructures.left ,
|
||||||
@@ -2846,6 +2851,7 @@ void wxWindowMac::MacUpdateClippedRects() const
|
|||||||
|
|
||||||
m_cachedClippedRegionWithOuterStructure = wxRegion( m_cachedClippedRectWithOuterStructure ) ;
|
m_cachedClippedRegionWithOuterStructure = wxRegion( m_cachedClippedRectWithOuterStructure ) ;
|
||||||
m_cachedClippedRegion = wxRegion( m_cachedClippedRect ) ;
|
m_cachedClippedRegion = wxRegion( m_cachedClippedRect ) ;
|
||||||
|
m_cachedClippedClientRegion = wxRegion( m_cachedClippedClientRect ) ;
|
||||||
|
|
||||||
m_cachedClippedRectValid = true ;
|
m_cachedClippedRectValid = true ;
|
||||||
}
|
}
|
||||||
@@ -3015,6 +3021,14 @@ void wxWindowMac::MacCreateScrollBars( long style )
|
|||||||
MacRepositionScrollBars() ; // we might have a real position shift
|
MacRepositionScrollBars() ; // we might have a real position shift
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxWindowMac::MacIsChildOfClientArea( const wxWindow* child ) const
|
||||||
|
{
|
||||||
|
if ( child != NULL && ( child == m_hScrollBar || child == m_vScrollBar ) )
|
||||||
|
return false ;
|
||||||
|
else
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
void wxWindowMac::MacRepositionScrollBars()
|
void wxWindowMac::MacRepositionScrollBars()
|
||||||
{
|
{
|
||||||
if ( !m_hScrollBar && !m_vScrollBar )
|
if ( !m_hScrollBar && !m_vScrollBar )
|
||||||
|
Reference in New Issue
Block a user