Fix DPI change handling in wxGrid with hidden row/column labels

Don't reset the labels windows size to the default value, it should stay
as 0 because otherwise we break the invariants

	m_rowLabelWidth  != 0 <=> m_rowLabelWin->IsShown()
	m_colLabelHeight != 0 <=> m_colLabelWin->IsShown()

that the rest of the code relies on.

Closes #18904.
This commit is contained in:
Vadim Zeitlin
2021-06-24 14:40:35 +01:00
parent 1cc1ddeefb
commit c59ed10c2a

View File

@@ -2829,8 +2829,13 @@ void wxGrid::InitPixelFields()
m_defaultRowHeight += 4;
#endif
m_rowLabelWidth = FromDIP(WXGRID_DEFAULT_ROW_LABEL_WIDTH);
m_colLabelHeight = FromDIP(WXGRID_DEFAULT_COL_LABEL_HEIGHT);
// Don't change the value when called from OnDPIChanged() later if the
// corresponding label window is hidden, these values should remain zeroes
// then.
if ( m_rowLabelWin->IsShown() )
m_rowLabelWidth = FromDIP(WXGRID_DEFAULT_ROW_LABEL_WIDTH);
if ( m_colLabelWin->IsShown() )
m_colLabelHeight = FromDIP(WXGRID_DEFAULT_COL_LABEL_HEIGHT);
m_defaultColWidth = FromDIP(WXGRID_DEFAULT_COL_WIDTH);