Allow passing multi-line strings to wxDC::DrawText(), even under MSW.
Native wxMSW wxDC::DrawText() implementation doesn't support multi-line strings so use the generic wxDC::DrawLabel() code instead. Drawing multi-line strings now works at least in wxGTK and wxMSW, to be tested for the other platforms. Closes #12239. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1303,6 +1303,18 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool
|
||||
|
||||
void wxMSWDCImpl::DoDrawText(const wxString& text, 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 MSW 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 ( text.find('\n') != wxString::npos )
|
||||
{
|
||||
GetOwner()->DrawLabel(text, wxRect(x, y, 0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
WXMICROWIN_CHECK_HDC
|
||||
|
||||
DrawAnyText(text, x, y);
|
||||
|
Reference in New Issue
Block a user