X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8f20ea03912fa5bffc537230ce853ef15b77f1fa..4e0a055757f928dce8c53b8e4cb60a699ab43e07:/include/wx/dcmirror.h diff --git a/include/wx/dcmirror.h b/include/wx/dcmirror.h index fcb396113c..0a7d430120 100644 --- a/include/wx/dcmirror.h +++ b/include/wx/dcmirror.h @@ -5,7 +5,7 @@ // Modified by: // Created: 21.07.2003 // RCS-ID: $Id$ -// Copyright: (c) 2003 Vadim Zeitlin +// Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ // wxMirrorDC allows to write the same code for horz/vertical layout // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxMirrorDC : public wxDCBase +class WXDLLEXPORT wxMirrorDC : public wxDC { public: // constructs a mirror DC associated with the given real DC @@ -53,7 +53,8 @@ public: virtual bool CanGetTextExtent() const { return m_dc.CanGetTextExtent(); } virtual int GetDepth() const { return m_dc.GetDepth(); } virtual wxSize GetPPI() const { return m_dc.GetPPI(); } - virtual bool Ok() const { return m_dc.Ok(); } + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return m_dc.Ok(); } virtual void SetMapMode(int mode) { m_dc.SetMapMode(mode); } virtual void SetUserScale(double x, double y) { m_dc.SetUserScale(GetX(x, y), GetY(x, y)); } @@ -67,6 +68,12 @@ public: virtual void SetLogicalFunction(int function) { m_dc.SetLogicalFunction(function); } + // helper functions which may be useful for the users of this class + wxSize Reflect(const wxSize& sizeOrig) + { + return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig; + } + protected: // returns x and y if not mirroring or y and x if mirroring wxCoord GetX(wxCoord x, wxCoord y) const { return m_mirror ? y : x; } @@ -131,7 +138,7 @@ protected: wxFAIL_MSG( _T("this is probably wrong") ); m_dc.DoDrawArc(GetX(x1, y1), GetY(x1, y1), - GetX(x2, y2), GetY(x2, y2), + GetX(x2, y2), GetY(x2, y2), xc, yc); } @@ -148,7 +155,7 @@ protected: wxFAIL_MSG( _T("this is probably wrong") ); m_dc.DoDrawEllipticArc(GetX(x, y), GetY(x, y), - GetX(w, h), GetY(w, h), + GetX(w, h), GetY(w, h), sa, ea); } @@ -182,7 +189,7 @@ protected: } virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = FALSE) + bool useMask = false) { m_dc.DoDrawBitmap(bmp, GetX(x, y), GetY(x, y), useMask); } @@ -203,8 +210,8 @@ protected: virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord w, wxCoord h, wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = FALSE, - wxCoord xsrcMask = -1, wxCoord ysrcMask = -1) + int rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) { return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest), GetX(w, h), GetY(w, h), @@ -262,7 +269,7 @@ protected: wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const + const wxFont *theFont = NULL) const { // never mirrored m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont); @@ -272,6 +279,8 @@ private: wxMirrorDC& m_dc; bool m_mirror; + + DECLARE_NO_COPY_CLASS(wxMirrorDC) }; #endif // _WX_DCMIRROR_H_