Applied #9076 (scrolling bars grow box fix)

By lillo


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62179 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2009-09-28 07:06:14 +00:00
parent 30fad74e44
commit 2ae3afa09f
2 changed files with 41 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
class WXDLLIMPEXP_FWD_CORE wxButton; class WXDLLIMPEXP_FWD_CORE wxButton;
class WXDLLIMPEXP_FWD_CORE wxScrollBar; class WXDLLIMPEXP_FWD_CORE wxScrollBar;
class WXDLLIMPEXP_FWD_CORE wxPanel;
class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow;
#if wxOSX_USE_CARBON #if wxOSX_USE_CARBON
@@ -275,6 +276,7 @@ protected:
wxScrollBar* m_vScrollBar ; wxScrollBar* m_vScrollBar ;
bool m_hScrollBarAlwaysShown; bool m_hScrollBarAlwaysShown;
bool m_vScrollBarAlwaysShown; bool m_vScrollBarAlwaysShown;
wxPanel* m_growBox ;
wxString m_label ; wxString m_label ;
// set to true if we do a sharp clip at the content area of this window // set to true if we do a sharp clip at the content area of this window

View File

@@ -126,6 +126,7 @@ void wxWindowMac::Init()
m_vScrollBar = NULL ; m_vScrollBar = NULL ;
m_hScrollBarAlwaysShown = false; m_hScrollBarAlwaysShown = false;
m_vScrollBarAlwaysShown = false; m_vScrollBarAlwaysShown = false;
m_growBox = NULL ;
m_macIsUserPane = true; m_macIsUserPane = true;
m_clipChildren = false ; m_clipChildren = false ;
@@ -264,6 +265,8 @@ void wxWindowMac::MacChildAdded()
m_vScrollBar->Raise() ; m_vScrollBar->Raise() ;
if ( m_hScrollBar ) if ( m_hScrollBar )
m_hScrollBar->Raise() ; m_hScrollBar->Raise() ;
if ( m_growBox )
m_growBox->Raise() ;
#endif #endif
} }
@@ -1319,6 +1322,7 @@ void wxWindowMac::MacPaintGrowBox()
#if wxUSE_SCROLLBAR #if wxUSE_SCROLLBAR
if ( MacHasScrollBarCorner() ) if ( MacHasScrollBarCorner() )
{ {
#if 0
CGContextRef cgContext = (CGContextRef) MacGetCGContextRef() ; CGContextRef cgContext = (CGContextRef) MacGetCGContextRef() ;
wxASSERT( cgContext ) ; wxASSERT( cgContext ) ;
@@ -1344,7 +1348,17 @@ void wxWindowMac::MacPaintGrowBox()
} }
CGContextFillRect( cgContext, cgrect ); CGContextFillRect( cgContext, cgrect );
CGContextRestoreGState( cgContext ); CGContextRestoreGState( cgContext );
#else
if (m_growBox)
{
if ( m_backgroundColour.Ok() )
m_growBox->SetBackgroundColour(m_backgroundColour);
else
m_growBox->SetBackgroundColour(*wxWHITE);
}
#endif
} }
#endif #endif
} }
@@ -1411,6 +1425,8 @@ void wxWindowMac::RemoveChild( wxWindowBase *child )
m_hScrollBar = NULL ; m_hScrollBar = NULL ;
if ( child == m_vScrollBar ) if ( child == m_vScrollBar )
m_vScrollBar = NULL ; m_vScrollBar = NULL ;
if ( child == m_growBox )
m_growBox = NULL ;
#endif #endif
wxWindowBase::RemoveChild( child ) ; wxWindowBase::RemoveChild( child ) ;
} }
@@ -1497,6 +1513,8 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
continue; continue;
if (child == m_hScrollBar) if (child == m_hScrollBar)
continue; continue;
if (child == m_growBox)
continue;
#endif #endif
if (child->IsTopLevel()) if (child->IsTopLevel())
continue; continue;
@@ -1888,6 +1906,8 @@ void wxWindowMac::MacPaintChildrenBorders()
continue; continue;
if (child == m_hScrollBar) if (child == m_hScrollBar)
continue; continue;
if (child == m_growBox)
continue;
#endif #endif
if (child->IsTopLevel()) if (child->IsTopLevel())
continue; continue;
@@ -2021,6 +2041,10 @@ void wxWindowMac::MacCreateScrollBars( long style )
m_hScrollBar = new wxScrollBar((wxWindow*)this, wxID_ANY, hPoint, hSize , wxHORIZONTAL); m_hScrollBar = new wxScrollBar((wxWindow*)this, wxID_ANY, hPoint, hSize , wxHORIZONTAL);
m_hScrollBar->SetMinSize( wxDefaultSize ); m_hScrollBar->SetMinSize( wxDefaultSize );
} }
wxPoint gPoint(width - scrlsize, height - scrlsize);
wxSize gSize(scrlsize, scrlsize);
m_growBox = new wxPanel((wxWindow *)this, wxID_ANY, gPoint, gSize, 0);
} }
// because the create does not take into account the client area origin // because the create does not take into account the client area origin
@@ -2033,7 +2057,7 @@ bool wxWindowMac::MacIsChildOfClientArea( const wxWindow* child ) const
{ {
bool result = ((child == NULL) bool result = ((child == NULL)
#if wxUSE_SCROLLBAR #if wxUSE_SCROLLBAR
|| ((child != m_hScrollBar) && (child != m_vScrollBar)) || ((child != m_hScrollBar) && (child != m_vScrollBar) && (child != m_growBox))
#endif #endif
); );
@@ -2065,6 +2089,20 @@ void wxWindowMac::MacRepositionScrollBars()
m_vScrollBar->SetSize( vPoint.x , vPoint.y, vSize.x, vSize.y , wxSIZE_ALLOW_MINUS_ONE ); m_vScrollBar->SetSize( vPoint.x , vPoint.y, vSize.x, vSize.y , wxSIZE_ALLOW_MINUS_ONE );
if ( m_hScrollBar ) if ( m_hScrollBar )
m_hScrollBar->SetSize( hPoint.x , hPoint.y, hSize.x, hSize.y, wxSIZE_ALLOW_MINUS_ONE ); m_hScrollBar->SetSize( hPoint.x , hPoint.y, hSize.x, hSize.y, wxSIZE_ALLOW_MINUS_ONE );
if ( m_growBox )
{
if ( MacHasScrollBarCorner() )
{
m_growBox->SetSize( width - scrlsize, height - scrlsize, wxDefaultCoord, wxDefaultCoord, wxSIZE_USE_EXISTING );
if ( !m_growBox->IsShown() )
m_growBox->Show();
}
else
{
if ( m_growBox->IsShown() )
m_growBox->Hide();
}
}
#endif #endif
} }