Fix recent regression in grid content autosizing
Fix autosizing broken in 3c72396a36
: we
must add the extra margin to "extentMax".
See https://github.com/wxWidgets/wxWidgets/pull/1559
Closes https://github.com/wxWidgets/wxWidgets/pull/1578
This commit is contained in:
committed by
Vadim Zeitlin
parent
0c1c13883c
commit
f7e335c031
@@ -9378,11 +9378,16 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction)
|
|||||||
wxCoord w, h;
|
wxCoord w, h;
|
||||||
dc.SetFont( GetLabelFont() );
|
dc.SetFont( GetLabelFont() );
|
||||||
|
|
||||||
|
bool addMargin = true;
|
||||||
|
|
||||||
if ( column )
|
if ( column )
|
||||||
{
|
{
|
||||||
if ( m_useNativeHeader )
|
if ( m_useNativeHeader )
|
||||||
{
|
{
|
||||||
w = GetGridColHeader()->GetColumnTitleWidth(colOrRow);
|
w = GetGridColHeader()->GetColumnTitleWidth(colOrRow);
|
||||||
|
|
||||||
|
// GetColumnTitleWidth already adds margins internally.
|
||||||
|
addMargin = false;
|
||||||
h = 0;
|
h = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -9390,18 +9395,11 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction)
|
|||||||
dc.GetMultiLineTextExtent( GetColLabelValue(colOrRow), &w, &h );
|
dc.GetMultiLineTextExtent( GetColLabelValue(colOrRow), &w, &h );
|
||||||
if ( GetColLabelTextOrientation() == wxVERTICAL )
|
if ( GetColLabelTextOrientation() == wxVERTICAL )
|
||||||
w = h;
|
w = h;
|
||||||
|
|
||||||
// leave some space around text
|
|
||||||
if ( w )
|
|
||||||
w += 10;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dc.GetMultiLineTextExtent( GetRowLabelValue(colOrRow), &w, &h );
|
dc.GetMultiLineTextExtent( GetRowLabelValue(colOrRow), &w, &h );
|
||||||
|
|
||||||
if ( h )
|
|
||||||
h += 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extent = column ? w : h;
|
extent = column ? w : h;
|
||||||
@@ -9414,6 +9412,14 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction)
|
|||||||
// than default extent but != 0, it's OK)
|
// than default extent but != 0, it's OK)
|
||||||
extentMax = column ? m_defaultColWidth : m_defaultRowHeight;
|
extentMax = column ? m_defaultColWidth : m_defaultRowHeight;
|
||||||
}
|
}
|
||||||
|
else if ( addMargin )
|
||||||
|
{
|
||||||
|
// leave some space around text
|
||||||
|
if ( column )
|
||||||
|
extentMax += 10;
|
||||||
|
else
|
||||||
|
extentMax += 6;
|
||||||
|
}
|
||||||
|
|
||||||
if ( column )
|
if ( column )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user