Fix auto-sizing column labels when using native header in wxGrid
Use wxHeaderCtrl-specific GetColumnTitleWidth() function to account for the native header control margins, otherwise the computed width could be insufficient for short columns, resulting in their ellipsization.
This commit is contained in:
committed by
Vadim Zeitlin
parent
0766283b2e
commit
3c72396a36
@@ -9384,13 +9384,30 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction)
|
||||
|
||||
if ( column )
|
||||
{
|
||||
dc.GetMultiLineTextExtent( GetColLabelValue(colOrRow), &w, &h );
|
||||
if ( GetColLabelTextOrientation() == wxVERTICAL )
|
||||
w = h;
|
||||
if ( m_useNativeHeader )
|
||||
{
|
||||
w = GetGridColHeader()->GetColumnTitleWidth(colOrRow);
|
||||
h = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.GetMultiLineTextExtent( GetColLabelValue(colOrRow), &w, &h );
|
||||
if ( GetColLabelTextOrientation() == wxVERTICAL )
|
||||
w = h;
|
||||
|
||||
// leave some space around text
|
||||
if ( w )
|
||||
w += 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.GetMultiLineTextExtent( GetRowLabelValue(colOrRow), &w, &h );
|
||||
|
||||
if ( h )
|
||||
h += 6;
|
||||
}
|
||||
|
||||
extent = column ? w : h;
|
||||
if ( extent > extentMax )
|
||||
extentMax = extent;
|
||||
@@ -9401,14 +9418,6 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction)
|
||||
// than default extent but != 0, it's OK)
|
||||
extentMax = column ? m_defaultColWidth : m_defaultRowHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( column )
|
||||
// leave some space around text
|
||||
extentMax += 10;
|
||||
else
|
||||
extentMax += 6;
|
||||
}
|
||||
|
||||
if ( column )
|
||||
{
|
||||
|
Reference in New Issue
Block a user