{
wxCHECK_RET( row >= 0 && row < m_numRows, _T("invalid row index") );
+ // if < 0 then calculate new height from label
+ if ( height < 0 )
+ {
+ long w, h;
+ wxArrayString lines;
+ wxClientDC dc(m_rowLabelWin);
+ dc.SetFont(GetLabelFont());
+ StringToLines(GetRowLabelValue( row ), lines);
+ GetTextBoxSize( dc, lines, &w, &h );
+ //check that it is not less than the minimal height
+ height = wxMax(h, GetRowMinimalAcceptableHeight());
+ }
+
// See comment in SetColSize
if ( height < GetRowMinimalAcceptableHeight())
return;
{
wxCHECK_RET( col >= 0 && col < m_numCols, _T("invalid column index") );
+ // if < 0 then calculate new width from label
+ if ( width < 0 )
+ {
+ long w, h;
+ wxArrayString lines;
+ wxClientDC dc(m_colLabelWin);
+ dc.SetFont(GetLabelFont());
+ StringToLines(GetColLabelValue(col), lines);
+ if ( GetColLabelTextOrientation() == wxHORIZONTAL )
+ GetTextBoxSize( dc, lines, &w, &h );
+ else
+ GetTextBoxSize( dc, lines, &h, &w );
+ width = w + 6;
+ //check that it is not less than the minimal width
+ width = wxMax(width, GetColMinimalAcceptableWidth());
+ }
+
// should we check that it's bigger than GetColMinimalWidth(col) here?
// (VZ)
// No, because it is reasonable to assume the library user know's
InitColWidths();
}
- // if < 0 then calculate new width from label
- if ( width < 0 )
- {
- long w, h;
- wxArrayString lines;
- wxClientDC dc(m_colLabelWin);
- dc.SetFont(GetLabelFont());
- StringToLines(GetColLabelValue(col), lines);
- GetTextBoxSize(dc, lines, &w, &h);
- width = w + 6;
- }
-
int w = wxMax( 0, width );
int diff = w - m_colWidths[col];
m_colWidths[col] = w;
void wxGrid::AutoSizeRowLabelSize( int row )
{
- wxArrayString lines;
- long w, h;
-
// Hide the edit control, so it
// won't interfere with drag-shrinking.
if ( IsCellEditControlShown() )
}
// autosize row height depending on label text
- StringToLines( GetRowLabelValue( row ), lines );
- wxClientDC dc( m_rowLabelWin );
- GetTextBoxSize( dc, lines, &w, &h );
- if ( h < m_defaultRowHeight )
- h = m_defaultRowHeight;
- SetRowSize(row, h);
+ SetRowSize(row, -1);
ForceRefresh();
}
void wxGrid::AutoSizeColLabelSize( int col )
{
- wxArrayString lines;
- long w, h;
-
// Hide the edit control, so it
// won't interfere with drag-shrinking.
if ( IsCellEditControlShown() )
}
// autosize column width depending on label text
- StringToLines( GetColLabelValue( col ), lines );
- wxClientDC dc( m_colLabelWin );
- if ( GetColLabelTextOrientation() == wxHORIZONTAL )
- GetTextBoxSize( dc, lines, &w, &h );
- else
- GetTextBoxSize( dc, lines, &h, &w );
- if ( w < m_defaultColWidth )
- w = m_defaultColWidth;
- SetColSize(col, w);
+ SetColSize(col, -1);
ForceRefresh();
}