X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b7cacb43db1e69b87b257a67912b4d52995b070a..9e1fc0e42822fdf1159582f1b73cde0c7d15bc92:/include/wx/dc.h diff --git a/include/wx/dc.h b/include/wx/dc.h index 0b74388dff..da5bc5fde0 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -18,6 +18,7 @@ #include "wx/object.h" // the base class +#include "wx/intl.h" // for wxLayoutDirection #include "wx/cursor.h" // we have member variables of these classes #include "wx/font.h" // so we can't do without them #include "wx/colour.h" @@ -134,11 +135,6 @@ public: virtual ~wxDCBase() { } -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( virtual void BeginDrawing() ); - wxDEPRECATED( virtual void EndDrawing() ); -#endif // WXWIN_COMPATIBILITY_2_6 - // graphic primitives // ------------------ @@ -317,6 +313,11 @@ public: return DoBlit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); } + + wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const + { + return DoGetAsBitmap(subrect); + } #if wxUSE_SPLINES // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?) @@ -387,6 +388,12 @@ public: virtual void StartPage() { } virtual void EndPage() { } +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void BeginDrawing() ); + wxDEPRECATED( void EndDrawing() ); +#endif // WXWIN_COMPATIBILITY_2_6 + + // set objects to use for drawing // ------------------------------ @@ -439,7 +446,7 @@ public: wxCoord *width, wxCoord *height, wxCoord *heightLine = NULL, - wxFont *font = NULL); + wxFont *font = NULL) const; // Measure cumulative width of text after each character bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const @@ -503,20 +510,20 @@ public: // accessors and setters // --------------------- - int GetBackgroundMode() const { return m_backgroundMode; } - const wxBrush& GetBackground() const { return m_backgroundBrush; } - const wxBrush& GetBrush() const { return m_brush; } - const wxFont& GetFont() const { return m_font; } - const wxPen& GetPen() const { return m_pen; } + virtual int GetBackgroundMode() const { return m_backgroundMode; } + virtual const wxBrush& GetBackground() const { return m_backgroundBrush; } + virtual const wxBrush& GetBrush() const { return m_brush; } + virtual const wxFont& GetFont() const { return m_font; } + virtual const wxPen& GetPen() const { return m_pen; } - const wxColour& GetTextForeground() const { return m_textForegroundColour; } - const wxColour& GetTextBackground() const { return m_textBackgroundColour; } + virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; } + virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; } virtual void SetTextForeground(const wxColour& colour) { m_textForegroundColour = colour; } virtual void SetTextBackground(const wxColour& colour) { m_textBackgroundColour = colour; } - int GetMapMode() const { return m_mappingMode; } + virtual int GetMapMode() const { return m_mappingMode; } virtual void SetMapMode(int mode) = 0; virtual void GetUserScale(double *x, double *y) const @@ -553,7 +560,7 @@ public: virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0; - int GetLogicalFunction() const { return m_logicalFunction; } + virtual int GetLogicalFunction() const { return m_logicalFunction; } virtual void SetLogicalFunction(int function) = 0; #if WXWIN_COMPATIBILITY_2_4 @@ -650,6 +657,16 @@ public: if (h) *h = hh; } + // RTL related functions + // --------------------- + + // get or change the layout direction (LTR or RTL) for this dc, + // wxLayout_Default is returned if layout direction is not supported + virtual wxLayoutDirection GetLayoutDirection() const + { return wxLayout_Default; } + virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) + { } + protected: // the pure virtual functions which should be implemented by wxDC virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, @@ -700,6 +717,8 @@ protected: wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) = 0; + virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const { return wxNullBitmap; } + virtual void DoGetSize(int *width, int *height) const = 0; virtual void DoGetSizeMM(int* width, int* height) const = 0; @@ -844,6 +863,10 @@ private: #include "wx/os2/dc.h" #endif +#if wxUSE_GRAPHICS_CONTEXT + #include "wx/dcgraph.h" +#endif + // ---------------------------------------------------------------------------- // helper class: you can use it to temporarily change the DC text colour and // restore it automatically when the object goes out of scope @@ -854,6 +877,11 @@ class WXDLLEXPORT wxDCTextColourChanger public: wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { } + wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc) + { + Set(col); + } + ~wxDCTextColourChanger() { if ( m_colFgOld.Ok() ) @@ -952,5 +980,4 @@ private: DECLARE_NO_COPY_CLASS(wxDCClipper) }; -#endif - // _WX_DC_H_BASE_ +#endif // _WX_DC_H_BASE_