X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/066bd2519140d36312712e27f2ac81d98c4b72fa..b54a0e3913d919ed1ed2b51acb0ebbe5e4c0bb11:/src/msw/renderer.cpp diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index 380ad2e383..46f4381915 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -114,28 +114,6 @@ #define DFCS_HOT 0x1000 #endif -// When we're using GDI+, the DC might have transforms applied to it, -// but the renderer APIs don't respect them. So we need to apply -// the transforms to the rect ourselves. -inline -wxRect applyGDIPlusTransformsToRect(wxDC& dc, const wxRect& r) -{ - wxRect rect = r; -#if wxUSE_GRAPHICS_CONTEXT - wxGCDC* gcdc = dynamic_cast(&dc); - if (gcdc) - { - double xtrans = 0; - double ytrans = 0; - wxGraphicsContext* gc = gcdc->GetGraphicsContext(); - gc->GetTransform().TransformPoint(&xtrans, &ytrans); - rect.x = rect.x + (int)xtrans; - rect.y = rect.y + (int)ytrans; - } -#endif - return rect; -} - // ---------------------------------------------------------------------------- // methods common to wxRendererMSW and wxRendererXP // ---------------------------------------------------------------------------- @@ -417,7 +395,9 @@ wxRendererMSW::DrawComboBoxDropButton(wxWindow * WXUNUSED(win), const wxRect& rect, int flags) { - wxRect adjustedRect = applyGDIPlusTransformsToRect(dc, rect); + wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") ); + + wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect); RECT r; wxCopyRectToRECT(adjustedRect, r); @@ -439,7 +419,9 @@ wxRendererMSW::DoDrawFrameControl(UINT type, const wxRect& rect, int flags) { - wxRect adjustedRect = applyGDIPlusTransformsToRect(dc, rect); + wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") ); + + wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect); RECT r; wxCopyRectToRECT(adjustedRect, r); @@ -455,6 +437,11 @@ wxRendererMSW::DoDrawFrameControl(UINT type, style |= DFCS_PUSHED; if ( flags & wxCONTROL_CURRENT ) style |= DFCS_HOT; + if ( flags & wxCONTROL_UNDETERMINED ) + // Using DFCS_BUTTON3STATE here doesn't work (as might be expected), + // use the following two styles to get the same look of a check box + // in the undetermined state. + style |= DFCS_INACTIVE | DFCS_CHECKED; ::DrawFrameControl(GetHdcOf(dc.GetTempHDC()), &r, type, style); } @@ -642,7 +629,9 @@ wxRendererXP::DrawComboBoxDropButton(wxWindow * win, return; } - wxRect adjustedRect = applyGDIPlusTransformsToRect(dc, rect); + wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") ); + + wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect); RECT r; wxCopyRectToRECT(adjustedRect, r); @@ -683,7 +672,9 @@ wxRendererXP::DrawHeaderButton(wxWindow *win, return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); } - wxRect adjustedRect = applyGDIPlusTransformsToRect(dc, rect); + wxCHECK_MSG( dc.GetImpl(), -1, wxT("Invalid wxDC") ); + + wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect); RECT r; wxCopyRectToRECT(adjustedRect, r); @@ -727,7 +718,9 @@ wxRendererXP::DrawTreeItemButton(wxWindow *win, return; } - wxRect adjustedRect = applyGDIPlusTransformsToRect(dc, rect); + wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") ); + + wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect); RECT r; wxCopyRectToRECT(adjustedRect, r); @@ -767,7 +760,9 @@ wxRendererXP::DoDrawButtonLike(HTHEME htheme, const wxRect& rect, int flags) { - wxRect adjustedRect = applyGDIPlusTransformsToRect(dc, rect); + wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") ); + + wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect); RECT r; wxCopyRectToRECT(adjustedRect, r);