X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/481203cb23ab64f570b2046f7154a94e0561f3e7..24e35cf87b9350d0d114fa8db0e2f5bef6410139:/src/msw/dc.cpp?ds=sidebyside diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 1bd9b7195c..11570c8c40 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -35,10 +35,10 @@ #include "wx/dcmemory.h" #include "wx/log.h" #include "wx/icon.h" + #include "wx/dcprint.h" #endif #include "wx/sysopt.h" -#include "wx/dcprint.h" #include "wx/module.h" #include "wx/dynlib.h" @@ -490,7 +490,7 @@ void wxDC::DestroyClippingRegion() // on desktop WIN32 also, since the WIN32 docs imply that the user // clipping region is independent from the paint clipping region. ::SelectClipRgn(GetHdc(), 0); -#else +#else // TODO: this should restore the previous clipping region, // so that OnPaint processing works correctly, and the update // clipping region doesn't get destroyed after the first @@ -498,7 +498,7 @@ void wxDC::DestroyClippingRegion() HRGN rgn = CreateRectRgn(0, 0, 32000, 32000); ::SelectClipRgn(GetHdc(), rgn); ::DeleteObject(rgn); -#endif +#endif } wxDCBase::DestroyClippingRegion(); @@ -724,12 +724,13 @@ void wxDC::DoDrawArc(wxCoord x1, wxCoord y1, void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxCoord height) { - WXMICROWIN_CHECK_HDC - + // cases when we don't have DrawFrameControl() +#if defined(__SYMANTEC__) || defined(__WXMICROWIN__) + return wxDCBase::DoDrawCheckMark(x1, y1, width, height); +#else // normal case wxCoord x2 = x1 + width, y2 = y1 + height; -#if defined(__WIN32__) && !defined(__SYMANTEC__) && !defined(__WXMICROWIN__) RECT rect; rect.left = x1; rect.top = y1; @@ -741,25 +742,10 @@ void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, #else DrawFrameControl(GetHdc(), &rect, DFC_MENU, DFCS_MENUCHECK); #endif -#else // Symantec-MicroWin - // draw a cross - HPEN blackPen = ::CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); - HPEN whiteBrush = (HPEN)::GetStockObject(WHITE_BRUSH); - HPEN hPenOld = (HPEN)::SelectObject(GetHdc(), blackPen); - HPEN hBrushOld = (HPEN)::SelectObject(GetHdc(), whiteBrush); - ::SetROP2(GetHdc(), R2_COPYPEN); - Rectangle(GetHdc(), x1, y1, x2, y2); - MoveToEx(GetHdc(), x1, y1, NULL); - LineTo(GetHdc(), x2, y2); - MoveToEx(GetHdc(), x2, y1, NULL); - LineTo(GetHdc(), x1, y2); - ::SelectObject(GetHdc(), hPenOld); - ::SelectObject(GetHdc(), hBrushOld); - ::DeleteObject(blackPen); -#endif // Win32/Symantec-MicroWin CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); +#endif // Microwin/Normal } void wxDC::DoDrawPoint(wxCoord x, wxCoord y) @@ -1502,7 +1488,7 @@ void wxDC::SetFont(const wxFont& font) else // selected ok { if ( !m_oldFont ) - m_oldFont = (WXHPEN)hfont; + m_oldFont = (WXHFONT)hfont; m_font = font; } @@ -1595,7 +1581,7 @@ void wxDC::SetBrush(const wxBrush& brush) else // selected ok { if ( !m_oldBrush ) - m_oldBrush = (WXHPEN)hbrush; + m_oldBrush = (WXHBRUSH)hbrush; m_brush = brush; } @@ -1759,9 +1745,11 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxLogLastError(_T("GetTextExtentPoint32()")); } +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) // the result computed by GetTextExtentPoint32() may be too small as it // accounts for under/overhang of the first/last character while we want // just the bounding rect for this string so adjust the width as needed + // (using API not available in 2002 SDKs of WinCE) if ( len > 0 ) { ABC width; @@ -1783,6 +1771,7 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, } //else: GetCharABCWidths() failed, not a TrueType font? } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) TEXTMETRIC tm; ::GetTextMetrics(GetHdc(), &tm);