Replace wxGridCellBoolRenderer::ms_sizeCheckMark with a local var

This variable is (now) only used in a single function, so there is no
reason to declare it as a class member.

No real changes.
This commit is contained in:
Vadim Zeitlin
2020-04-01 22:33:02 +02:00
parent f2923d49e1
commit d41d159576
2 changed files with 5 additions and 8 deletions

View File

@@ -143,9 +143,6 @@ public:
virtual wxGridCellRenderer *Clone() const wxOVERRIDE virtual wxGridCellRenderer *Clone() const wxOVERRIDE
{ return new wxGridCellBoolRenderer; } { return new wxGridCellBoolRenderer; }
private:
static wxSize ms_sizeCheckMark;
}; };

View File

@@ -920,22 +920,22 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params)
// wxGridCellBoolRenderer // wxGridCellBoolRenderer
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxSize wxGridCellBoolRenderer::ms_sizeCheckMark;
wxSize wxGridCellBoolRenderer::GetBestSize(wxGrid& grid, wxSize wxGridCellBoolRenderer::GetBestSize(wxGrid& grid,
wxGridCellAttr& WXUNUSED(attr), wxGridCellAttr& WXUNUSED(attr),
wxDC& WXUNUSED(dc), wxDC& WXUNUSED(dc),
int WXUNUSED(row), int WXUNUSED(row),
int WXUNUSED(col)) int WXUNUSED(col))
{ {
static wxSize s_sizeCheckMark;
// compute it only once (no locks for MT safeness in GUI thread...) // compute it only once (no locks for MT safeness in GUI thread...)
if ( !ms_sizeCheckMark.x ) if ( !s_sizeCheckMark.x )
{ {
ms_sizeCheckMark = s_sizeCheckMark =
wxRendererNative::Get().GetCheckBoxSize(&grid, wxCONTROL_CELL); wxRendererNative::Get().GetCheckBoxSize(&grid, wxCONTROL_CELL);
} }
return ms_sizeCheckMark; return s_sizeCheckMark;
} }
void wxGridCellBoolRenderer::Draw(wxGrid& grid, void wxGridCellBoolRenderer::Draw(wxGrid& grid,