X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7b8d24ad99363a4328125516baaf45b2a2f27fce..6686fbad16ec929f33cbbcc1b638bf00406218c5:/src/msw/dc.cpp?ds=sidebyside diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 15f83c4955..b5f8cd1298 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -723,7 +723,7 @@ void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord xxx2 = (wxCoord) (xxc+ray); wxCoord yyy2 = (wxCoord) (yyc+ray); - if ( m_brush.IsOk() && m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT ) + if ( m_brush.IsNonTransparent() ) { // Have to add 1 to bottom-right corner of rectangle // to make semi-circles look right (crooked line otherwise). @@ -931,7 +931,7 @@ void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h // (i.e. drawn with a transparent pen) one pixel smaller in both directions // and we want them to have the same size regardless of which pen is used #ifndef __WXWINCE__ - if ( m_pen.IsOk() && m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) + if ( m_pen.IsTransparent() ) { x2dev++; y2dev++; @@ -965,7 +965,7 @@ void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wx // Windows draws the filled rectangles without outline (i.e. drawn with a // transparent pen) one pixel smaller in both directions and we want them // to have the same size regardless of which pen is used - adjust - if ( m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) + if ( m_pen.IsTransparent() ) { x2++; y2++; @@ -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); @@ -1772,17 +1784,21 @@ void wxMSWDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y } #endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - TEXTMETRIC tm; - ::GetTextMetrics(GetHdc(), &tm); - if (x) *x = sizeRect.cx; if (y) *y = sizeRect.cy; - if (descent) - *descent = tm.tmDescent; - if (externalLeading) - *externalLeading = tm.tmExternalLeading; + + if ( descent || externalLeading ) + { + TEXTMETRIC tm; + ::GetTextMetrics(GetHdc(), &tm); + + if (descent) + *descent = tm.tmDescent; + if (externalLeading) + *externalLeading = tm.tmExternalLeading; + } if ( hfontOld ) {