X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/25889d3c43f537fea00a2b7d6df7bd7e63e113f8..4438caf41af49f00f3c8137ac801871f59cce386:/src/msw/dc.cpp?ds=sidebyside diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index a7b088cb0e..c5c2a08b64 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -295,14 +295,19 @@ int wxDC::GetDepth() const void wxDC::Clear() { RECT rect; - if (m_canvas) + if ( m_canvas ) + { GetClientRect((HWND) m_canvas->GetHWND(), &rect); - else if (m_selectedBitmap.Ok()) + } + else { + wxCHECK_RET( m_selectedBitmap.Ok(), _T("this DC can't be cleared") ); + rect.left = 0; rect.top = 0; rect.right = m_selectedBitmap.GetWidth(); rect.bottom = m_selectedBitmap.GetHeight(); } + (void) ::SetMapMode(GetHdc(), MM_TEXT); DWORD colour = GetBkColor(GetHdc()); @@ -680,7 +685,7 @@ void wxDC::DoDrawText(const wxString& text, long x, long y) else SetBkMode(GetHdc(), OPAQUE); - (void)TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), (char *) (const char *)text, strlen((const char *)text)); + (void)TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), WXSTRINGCAST text, wxStrlen(WXSTRINGCAST text)); if (m_textBackgroundColour.Ok()) (void)SetBkColor(GetHdc(), old_background); @@ -755,7 +760,7 @@ void wxDC::SetFont(const wxFont& the_font) HFONT f = (HFONT) ::SelectObject(GetHdc(), (HFONT) m_font.GetResourceHandle()); if (f == (HFONT) NULL) { - wxLogDebug("::SelectObject failed in wxDC::SetFont."); + wxLogDebug(_T("::SelectObject failed in wxDC::SetFont.")); } if (!m_oldFont) m_oldFont = (WXHFONT) f; @@ -962,7 +967,7 @@ void wxDC::GetTextExtent(const wxString& string, long *x, long *y, SIZE sizeRect; TEXTMETRIC tm; - GetTextExtentPoint(GetHdc(), (char *)(const char *) string, strlen((char *)(const char *) string), &sizeRect); + GetTextExtentPoint(GetHdc(), WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); GetTextMetrics(GetHdc(), &tm); if (x) *x = XDEV2LOGREL(sizeRect.cx);