From 4ec06c2eedd7087237c93e6e2d708f2bb6fb5d78 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Wed, 17 Oct 2007 22:07:21 +0000 Subject: [PATCH] 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 --- src/cocoa/window.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index d5edb29168..aed7f98a48 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -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(inFont)); } // Coordinates relative to the window