Determine the checkbox size in wxGetGridCheckBoxRect() itself

It doesn't make much sense to pass the size to the function supposed to
compute it, so call wxRendererNative::GetCheckBoxSize() from the
function itself instead of forcing its callers to do it.

No real changes.
This commit is contained in:
Vadim Zeitlin
2019-11-22 01:07:20 +01:00
parent f4756eaa2f
commit 851d11ba2c
4 changed files with 23 additions and 23 deletions

View File

@@ -937,8 +937,11 @@ wxSize wxGridCellBoolRenderer::GetBestSize(wxGrid& grid,
// compute it only once (no locks for MT safeness in GUI thread...)
if ( !ms_sizeCheckMark.x )
{
// Use rectangle big enough for the check box to fit into it.
const wxRect r(0, 0, 1000, 1000);
ms_sizeCheckMark =
wxRendererNative::Get().GetCheckBoxSize(&grid, wxCONTROL_CELL);
wxGetGridCheckBoxRect(&grid, r, wxALIGN_LEFT, wxALIGN_TOP).GetSize();
}
return ms_sizeCheckMark;
@@ -958,12 +961,7 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
attr.GetNonDefaultAlignment(&hAlign, &vAlign);
const wxRect
checkBoxRect = wxGetGridCheckBoxRect
(
GetBestSize(grid, attr, dc, row, col),
rect,
hAlign, vAlign
);
checkBoxRect = wxGetGridCheckBoxRect(&grid, rect, hAlign, vAlign);
bool value;
if ( grid.GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL) )