Mac: Adjust wxDataViewCtrl column width calculator

Slightly improve the maximum column width calculator by rounding up
the (non-integer) width of cells using ceil() instead of adding 1
unconditionally.

See #19003.
This commit is contained in:
Dimitri Schoolwerth
2020-12-22 02:09:21 +01:00
parent 9ee866551f
commit 4bf117aabd

View File

@@ -2198,7 +2198,7 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
void UpdateWithRow(int row)
{
NSCell *cell = [m_view preparedCellAtColumn:m_column row:row];
unsigned cellWidth = [cell cellSize].width + 1/*round the float up*/;
unsigned cellWidth = ceil([cell cellSize].width);
if ( m_indent )
cellWidth += m_indent * [m_view levelForRow:row];
@@ -2228,7 +2228,7 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
if ( [column headerCell] )
{
calculator.UpdateWithWidth([[column headerCell] cellSize].width + 1/*round the float up*/);
calculator.UpdateWithWidth(ceil([[column headerCell] cellSize].width));
}
// The code below deserves some explanation. For very large controls, we