Don't truncate item text in wxCheckListBox on macOS

wxListBox's width adjustment code appears to have been written before
wxCheckListBox's existence, and still assumed there's only one column, at
index 0, in some places.

In wxCheckListBox, however, there are two columns, and column 0 is the
non-resizable checkbox one. We need to use column 1 (aka the last
column) for automatic width updates, because that's where the text is.
This commit is contained in:
Václav Slavík
2021-03-07 18:38:47 +01:00
parent bc28cb42c2
commit 9e0a2c04a8

View File

@@ -473,7 +473,9 @@ wxListWidgetColumn* wxListWidgetCocoaImpl::InsertCheckColumn( unsigned pos , con
void wxListWidgetCocoaImpl::AdaptColumnWidth ( int w )
{
NSTableColumn *col = [[m_tableView tableColumns] objectAtIndex:0];
// Note that the table can have more than one column as it's also used by
// wxCheckListBox, but the column containing the text is always the last one.
NSTableColumn *col = [[m_tableView tableColumns] lastObject];
[col setWidth:w];
m_maxWidth = w;
}
@@ -488,7 +490,7 @@ void wxListWidgetCocoaImpl::ListInsert( unsigned int n )
if ( m_autoSize )
{
NSCell *cell = [m_tableView preparedCellAtColumn:0 row:n];
NSCell *cell = [m_tableView preparedCellAtColumn:[m_tableView numberOfColumns]-1 row:n];
NSSize size = [cell cellSize];
int width = (int) ceil(size.width);