// this needs to overidden if the axis is inverted
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
+#ifdef __WXMSW__
+ // Native Windows functions using the underlying HDC don't honour GDI+
+ // transformations which may be applied to it. Using this function we can
+ // transform the coordinates manually before passing them to such functions
+ // (as in e.g. wxRendererMSW code). It doesn't do anything if this is not a
+ // wxGCDC.
+ virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const
+ {
+ return r;
+ }
+#endif // __WXMSW__
+
+
// ---------------------------------------------------------
// the actual drawing API
#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<wxGCDC*>(&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
// ----------------------------------------------------------------------------
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);
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);
return;
}
- wxRect adjustedRect = applyGDIPlusTransformsToRect(dc, rect);
+ wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
+
+ wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
RECT r;
wxCopyRectToRECT(adjustedRect, r);
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);
return;
}
- wxRect adjustedRect = applyGDIPlusTransformsToRect(dc, rect);
+ wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
+
+ wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
RECT r;
wxCopyRectToRECT(adjustedRect, r);
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);