forcefully get rid of the scrollbars in CalcWindowSizes() if we don't need them any more
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
698581160d
commit
388703a573
@ -4623,6 +4623,33 @@ void wxGrid::CalcWindowSizes()
|
|||||||
int cw, ch;
|
int cw, ch;
|
||||||
GetClientSize( &cw, &ch );
|
GetClientSize( &cw, &ch );
|
||||||
|
|
||||||
|
// this block of code tries to work around the following problem: the grid
|
||||||
|
// could have been just resized to have enough space to show the full grid
|
||||||
|
// window contents without the scrollbars, but its client size could be
|
||||||
|
// not big enough because the grid has the scrollbars right now and so the
|
||||||
|
// scrollbars would remain even though we don't need them any more
|
||||||
|
//
|
||||||
|
// to prevent this from happening, check if we have enough space for
|
||||||
|
// everything without the scrollbars and explicitly disable them then
|
||||||
|
wxSize size = GetSize() - GetWindowBorderSize();
|
||||||
|
if ( size != wxSize(cw, ch) )
|
||||||
|
{
|
||||||
|
// check if we have enough space for grid window after accounting for
|
||||||
|
// the fixed size elements
|
||||||
|
size.x -= m_rowLabelWidth;
|
||||||
|
size.y -= m_colLabelHeight;
|
||||||
|
|
||||||
|
const wxSize vsize = m_gridWin->GetVirtualSize();
|
||||||
|
|
||||||
|
if ( size.x >= vsize.x && size.y >= vsize.y )
|
||||||
|
{
|
||||||
|
// yes, we do, so remove the scrollbars and use the new client size
|
||||||
|
// (which should be the same as full window size - borders now)
|
||||||
|
SetScrollbars(0, 0, 0, 0);
|
||||||
|
GetClientSize(&cw, &ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_cornerLabelWin && m_cornerLabelWin->IsShown() )
|
if ( m_cornerLabelWin && m_cornerLabelWin->IsShown() )
|
||||||
m_cornerLabelWin->SetSize( 0, 0, m_rowLabelWidth, m_colLabelHeight );
|
m_cornerLabelWin->SetSize( 0, 0, m_rowLabelWidth, m_colLabelHeight );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user