Fix wxGrid compilation with MSVC7.

Due to what seems a compiler bug, MSVC tries to instantiate objects of
abstract wxGridXXXHeaderRenderer classes when compiling operators ?: using
references to them. Add explicit static_cast<>s to help it do the right thing.

Fixes compilation with this compiler broken in r62037.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-09-24 00:21:57 +00:00
parent 0661eb625e
commit 7a0a6cc8f6

View File

@ -5443,9 +5443,15 @@ void wxGrid::DrawRowLabel( wxDC& dc, int row )
wxGridCellAttrProvider * const wxGridCellAttrProvider * const
attrProvider = m_table ? m_table->GetAttrProvider() : NULL; attrProvider = m_table ? m_table->GetAttrProvider() : NULL;
// notice that an explicit static_cast is needed to avoid a compilation
// error with VC7.1 which, for some reason, tries to instantiate (abstract)
// wxGridRowHeaderRenderer class without it
const wxGridRowHeaderRenderer& const wxGridRowHeaderRenderer&
rend = attrProvider ? attrProvider->GetRowHeaderRenderer(row) rend = attrProvider ? attrProvider->GetRowHeaderRenderer(row)
: gs_defaultHeaderRenderers.rowRenderer; : static_cast<const wxGridRowHeaderRenderer&>
(gs_defaultHeaderRenderers.rowRenderer);
wxRect rect(0, GetRowTop(row), m_rowLabelWidth, GetRowHeight(row)); wxRect rect(0, GetRowTop(row), m_rowLabelWidth, GetRowHeight(row));
rend.DrawBorder(*this, dc, rect); rend.DrawBorder(*this, dc, rect);
@ -5518,7 +5524,8 @@ void wxGrid::DrawCornerLabel(wxDC& dc)
attrProvider = m_table ? m_table->GetAttrProvider() : NULL; attrProvider = m_table ? m_table->GetAttrProvider() : NULL;
const wxGridCornerHeaderRenderer& const wxGridCornerHeaderRenderer&
rend = attrProvider ? attrProvider->GetCornerRenderer() rend = attrProvider ? attrProvider->GetCornerRenderer()
: gs_defaultHeaderRenderers.cornerRenderer; : static_cast<wxGridCornerHeaderRenderer&>
(gs_defaultHeaderRenderers.cornerRenderer);
rend.DrawBorder(*this, dc, rect); rend.DrawBorder(*this, dc, rect);
} }
@ -5536,7 +5543,8 @@ void wxGrid::DrawColLabel(wxDC& dc, int col)
attrProvider = m_table ? m_table->GetAttrProvider() : NULL; attrProvider = m_table ? m_table->GetAttrProvider() : NULL;
const wxGridColumnHeaderRenderer& const wxGridColumnHeaderRenderer&
rend = attrProvider ? attrProvider->GetColumnHeaderRenderer(col) rend = attrProvider ? attrProvider->GetColumnHeaderRenderer(col)
: gs_defaultHeaderRenderers.colRenderer; : static_cast<wxGridColumnHeaderRenderer&>
(gs_defaultHeaderRenderers.colRenderer);
if ( m_nativeColumnLabels ) if ( m_nativeColumnLabels )
{ {