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
This commit is contained in:
Stefan Csomor
2011-05-01 19:07:16 +00:00
parent c81394808b
commit a6afde630c

View File

@@ -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() )