Prevent wxGrid rows/columns from becoming too small on double click.

The minimal size wasn't respected when auto-sizing rows/columns in
Set{Row,Col}Size() which was called in response to double clicking the
separator line, which resulted in clearly wrong behaviour as the user was
prevented from resizing the row/column to a smaller size by dragging them but
not by double clicking, so fix this to respect the minimal size as well.

Closes #15627.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-02-02 01:15:34 +00:00
parent 9ce54f4fea
commit 1ee5d643f1
2 changed files with 12 additions and 4 deletions

View File

@@ -596,6 +596,7 @@ All (GUI):
- Fix crash when Destroy()-ing a TLW with non-TLW parent. - Fix crash when Destroy()-ing a TLW with non-TLW parent.
- Fix crash in wxAuiToolBar::GetToolBarFits(). - Fix crash in wxAuiToolBar::GetToolBarFits().
- Make wxHTML more efficient when displaying large tables (Kinaou Hervé). - Make wxHTML more efficient when displaying large tables (Kinaou Hervé).
- Prevent wxGrid rows/columns from becoming too small on double click.
wxGTK: wxGTK:

View File

@@ -8147,8 +8147,9 @@ void wxGrid::SetRowSize( int row, int height )
dc.SetFont(GetLabelFont()); dc.SetFont(GetLabelFont());
StringToLines(GetRowLabelValue( row ), lines); StringToLines(GetRowLabelValue( row ), lines);
GetTextBoxSize( dc, lines, &w, &h ); GetTextBoxSize( dc, lines, &w, &h );
//check that it is not less than the minimal height
height = wxMax(h, GetRowMinimalAcceptableHeight()); // As with the columns, don't make the row smaller than minimal height.
height = wxMax(h, GetRowMinimalHeight(row));
} }
DoSetRowSize(row, height); DoSetRowSize(row, height);
@@ -8228,8 +8229,14 @@ void wxGrid::SetColSize( int col, int width )
else else
GetTextBoxSize( dc, lines, &h, &w ); GetTextBoxSize( dc, lines, &h, &w );
width = w + 6; width = w + 6;
//check that it is not less than the minimal width
width = wxMax(width, GetColMinimalAcceptableWidth()); // Check that it is not less than the minimal width and do use the
// possibly greater than minimal-acceptable-width minimal-width itself
// here as we shouldn't become too small when auto-sizing, otherwise
// the column could be resized to be too small by double clicking its
// divider line (which ends up in a call to this function) even though
// it couldn't be resized to this size by dragging it.
width = wxMax(width, GetColMinimalWidth(col));
} }
DoSetColSize(col, width); DoSetColSize(col, width);