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).
// (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++;
// 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++;
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);
return lpTextMetric.tmAveCharWidth;
}
+void wxMSWDCImpl::DoGetFontMetrics(int *height,
+ int *ascent,
+ int *descent,
+ int *internalLeading,
+ int *externalLeading,
+ int *averageWidth) const
+{
+ TEXTMETRIC tm;
+
+ GetTextMetrics(GetHdc(), &tm);
+
+ if ( height )
+ *height = tm.tmHeight;
+ if ( ascent )
+ *ascent = tm.tmAscent;
+ if ( descent )
+ *descent = tm.tmDescent;
+ if ( internalLeading )
+ *internalLeading = tm.tmInternalLeading;
+ if ( externalLeading )
+ *externalLeading = tm.tmExternalLeading;
+ if ( averageWidth )
+ *averageWidth = tm.tmAveCharWidth;
+}
+
void wxMSWDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
wxCoord *descent, wxCoord *externalLeading,
const wxFont *font) const
}
#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 )
+ {
+ DoGetFontMetrics(NULL, NULL, descent, NULL, externalLeading, NULL);
+ }
if ( hfontOld )
{