Invalidate wxGrid best size when the grid is changed.
Don't keep using the cached best size if rows/columns are added/removed to/from wxGrid or resized, doing this meant that we always used the first computed best size which was way too small after adding rows/columns to the grid. There could be more places where the grid best size may need to be invalidated but this should be a good start. Closes #14761. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -3068,6 +3068,8 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) | ||||
|         break; | ||||
|     } | ||||
|  | ||||
|     InvalidateBestSize(); | ||||
|  | ||||
|     if (result && !GetBatchCount() ) | ||||
|         m_gridWin->Refresh(); | ||||
|  | ||||
| @@ -7117,6 +7119,7 @@ void wxGrid::SetRowLabelSize( int width ) | ||||
|         } | ||||
|  | ||||
|         m_rowLabelWidth = width; | ||||
|         InvalidateBestSize(); | ||||
|         CalcWindowSizes(); | ||||
|         wxScrolledWindow::Refresh( true ); | ||||
|     } | ||||
| @@ -7146,6 +7149,7 @@ void wxGrid::SetColLabelSize( int height ) | ||||
|         } | ||||
|  | ||||
|         m_colLabelHeight = height; | ||||
|         InvalidateBestSize(); | ||||
|         CalcWindowSizes(); | ||||
|         wxScrolledWindow::Refresh( true ); | ||||
|     } | ||||
| @@ -8175,6 +8179,8 @@ void wxGrid::DoSetRowSize( int row, int height ) | ||||
|         m_rowBottoms[i] += diff; | ||||
|     } | ||||
|  | ||||
|     InvalidateBestSize(); | ||||
|  | ||||
|     if ( !GetBatchCount() ) | ||||
|     { | ||||
|         CalcDimensions(); | ||||
| @@ -8259,6 +8265,8 @@ void wxGrid::DoSetColSize( int col, int width ) | ||||
|         m_colRights[GetColAt(colPos)] += diff; | ||||
|     } | ||||
|  | ||||
|     InvalidateBestSize(); | ||||
|  | ||||
|     if ( !GetBatchCount() ) | ||||
|     { | ||||
|         CalcDimensions(); | ||||
| @@ -8668,11 +8676,6 @@ wxSize wxGrid::DoGetBestSize() const | ||||
|     wxSize size(self->SetOrCalcColumnSizes(true) - m_rowLabelWidth + m_extraWidth, | ||||
|                 self->SetOrCalcRowSizes(true) - m_colLabelHeight + m_extraHeight); | ||||
|  | ||||
|     // NOTE: This size should be cached, but first we need to add calls to | ||||
|     // InvalidateBestSize everywhere that could change the results of this | ||||
|     // calculation. | ||||
|     // CacheBestSize(size); | ||||
|  | ||||
|     return wxSize(size.x + m_rowLabelWidth, size.y + m_colLabelHeight) | ||||
|             + GetWindowBorderSize(); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user