From a6afde630ce1cadbc4a36c55f0eca8a8777d3303 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 1 May 2011 19:07:16 +0000 Subject: [PATCH] support multiline strings using the same workaround as msw, fixes #13019 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67666 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dcgraph.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 42f58a3721..f91a78fd6f 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -958,6 +958,18 @@ void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) { + // For compatibility with other ports (notably wxGTK) and because it's + // genuinely useful, we allow passing multiline strings to DrawText(). + // However there is no native OSX function to draw them directly so we + // instead reuse the generic DrawLabel() method to render them. Of course, + // DrawLabel() itself will call back to us but with single line strings + // only so there won't be any infinite recursion here. + if ( str.find('\n') != wxString::npos ) + { + GetOwner()->DrawLabel(str, wxRect(x, y, 0, 0)); + return; + } + wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawText - invalid DC") ); if ( str.empty() ) -- 2.45.2