Add const_cast and explain why it's needed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49206 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2007-10-17 22:07:21 +00:00
parent 032f2af9a2
commit 4ec06c2eed

View File

@@ -1223,7 +1223,9 @@ void wxWindow::GetTextExtent(const wxString& string, int *outX, int *outY,
// We don't create a wxClientDC because we don't want to accidently be able to use
// it for drawing.
wxDC tmpdc;
return tmpdc.GetTextExtent(string, outX, outY, outDescent, outExternalLeading, inFont);
// NOTE: We must use const_cast here on 2.8 because we must take a const wxFont but the wxDC method
// must not. In trunk, the wxDC method has been corrected to take const wxFont.
return tmpdc.GetTextExtent(string, outX, outY, outDescent, outExternalLeading, const_cast<wxFont*>(inFont));
}
// Coordinates relative to the window