Mac: Fix truncation of images in wxDataViewCtrl
Take into account a cell's height and adjust the row height accordingly. See #18868. Closes #19003.
This commit is contained in:
committed by
Dimitri Schoolwerth
parent
4bf117aabd
commit
d2fc88c03d
@@ -2179,6 +2179,7 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
||||
MaxWidthCalculator(wxCocoaOutlineView *view,
|
||||
NSTableColumn *column, unsigned columnIndex)
|
||||
: m_width(0),
|
||||
m_height(0),
|
||||
m_view(view),
|
||||
m_column(columnIndex),
|
||||
m_indent(0),
|
||||
@@ -2199,6 +2200,7 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
||||
{
|
||||
NSCell *cell = [m_view preparedCellAtColumn:m_column row:row];
|
||||
unsigned cellWidth = ceil([cell cellSize].width);
|
||||
unsigned cellHeight = ceil([cell cellSize].height);
|
||||
|
||||
if ( m_indent )
|
||||
cellWidth += m_indent * [m_view levelForRow:row];
|
||||
@@ -2210,13 +2212,16 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
||||
}
|
||||
|
||||
m_width = wxMax(m_width, cellWidth);
|
||||
m_height = wxMax(m_height, cellHeight);
|
||||
}
|
||||
|
||||
int GetMaxWidth() const { return m_width; }
|
||||
int GetMaxHeight() const { return m_height; }
|
||||
int GetExpanderWidth() const { return m_expander; }
|
||||
|
||||
private:
|
||||
int m_width;
|
||||
int m_height;
|
||||
wxCocoaOutlineView *m_view;
|
||||
unsigned m_column;
|
||||
int m_indent;
|
||||
@@ -2298,6 +2303,14 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
||||
m_expanderWidth = calculator.GetExpanderWidth();
|
||||
|
||||
[column setWidth:calculator.GetMaxWidth() + m_expanderWidth];
|
||||
|
||||
if ( !(GetDataViewCtrl()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) )
|
||||
{
|
||||
int curHeight = ceil([m_OutlineView rowHeight]);
|
||||
int rowHeight = calculator.GetMaxHeight();
|
||||
if ( rowHeight > curHeight )
|
||||
SetRowHeight(rowHeight);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user