]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dc.h
Build fix.
[wxWidgets.git] / include / wx / dc.h
index acb004af104f0376e72162d9b92cdcbfcd6fa161..0b74388dff1c080363918cb5cd398b78fa0d6112 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dc.h
+// Name:        wx/dc.h
 // Purpose:     wxDC class
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -93,8 +93,6 @@ protected:
 // global variables
 // ---------------------------------------------------------------------------
 
-extern WXDLLEXPORT_DATA(int) wxPageNumber;
-
 // ---------------------------------------------------------------------------
 // wxDC is the device context - object on which any drawing is done
 // ---------------------------------------------------------------------------
@@ -134,7 +132,7 @@ public:
         ResetClipping();
     }
 
-    ~wxDCBase() { }
+    virtual ~wxDCBase() { }
 
 #if WXWIN_COMPATIBILITY_2_6
     wxDEPRECATED( virtual void BeginDrawing() );
@@ -161,20 +159,21 @@ public:
     // fill the area specified by rect with a radial gradient, starting from
     // initialColour in the centre of the cercle and fading to destColour.
     void GradientFillConcentric(const wxRect& rect,
-                                const wxColour& initialColour, 
+                                const wxColour& initialColour,
                                 const wxColour& destColour)
         { GradientFillConcentric(rect, initialColour, destColour,
                                  wxPoint(rect.GetWidth() / 2,
                                          rect.GetHeight() / 2)); }
 
     void GradientFillConcentric(const wxRect& rect,
-                                const wxColour& initialColour, 
+                                const wxColour& initialColour,
                                 const wxColour& destColour,
-                                const wxPoint& circleCenter);
+                                const wxPoint& circleCenter)
+        { DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); }
 
     // fill the area specified by rect with a linear gradient
     void GradientFillLinear(const wxRect& rect,
-                            const wxColour& initialColour, 
+                            const wxColour& initialColour,
                             const wxColour& destColour,
                             wxDirection nDirection = wxEAST)
         { DoGradientFillLinear(rect, initialColour, destColour, nDirection); }
@@ -498,7 +497,8 @@ public:
     // Resolution in Pixels per inch
     virtual wxSize GetPPI() const = 0;
 
-    virtual bool Ok() const { return m_ok; }
+    virtual bool Ok() const { return IsOk(); }
+    virtual bool IsOk() const { return m_ok; }
 
     // accessors and setters
     // ---------------------
@@ -659,7 +659,12 @@ protected:
                                       const wxColour& initialColour,
                                       const wxColour& destColour,
                                       wxDirection nDirection = wxEAST);
-    
+
+    virtual void DoGradientFillConcentric(const wxRect& rect,
+                                        const wxColour& initialColour,
+                                        const wxColour& destColour,
+                                        const wxPoint& circleCenter);
+
     virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0;
 
     virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0;
@@ -829,6 +834,8 @@ private:
     #include "wx/x11/dc.h"
 #elif defined(__WXMGL__)
     #include "wx/mgl/dc.h"
+#elif defined(__WXDFB__)
+    #include "wx/dfb/dc.h"
 #elif defined(__WXMAC__)
     #include "wx/mac/dc.h"
 #elif defined(__WXCOCOA__)
@@ -868,6 +875,60 @@ private:
     DECLARE_NO_COPY_CLASS(wxDCTextColourChanger)
 };
 
+// ----------------------------------------------------------------------------
+// helper class: you can use it to temporarily change the DC pen and
+// restore it automatically when the object goes out of scope
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxDCPenChanger
+{
+public:
+    wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen())
+    {
+        m_dc.SetPen(pen);
+    }
+
+    ~wxDCPenChanger()
+    {
+        if ( m_penOld.Ok() )
+            m_dc.SetPen(m_penOld);
+    }
+
+private:
+    wxDC& m_dc;
+
+    wxPen m_penOld;
+
+    DECLARE_NO_COPY_CLASS(wxDCPenChanger)
+};
+
+// ----------------------------------------------------------------------------
+// helper class: you can use it to temporarily change the DC brush and
+// restore it automatically when the object goes out of scope
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxDCBrushChanger
+{
+public:
+    wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush())
+    {
+        m_dc.SetBrush(brush);
+    }
+
+    ~wxDCBrushChanger()
+    {
+        if ( m_brushOld.Ok() )
+            m_dc.SetBrush(m_brushOld);
+    }
+
+private:
+    wxDC& m_dc;
+
+    wxBrush m_brushOld;
+
+    DECLARE_NO_COPY_CLASS(wxDCBrushChanger)
+};
+
 // ----------------------------------------------------------------------------
 // another small helper class: sets the clipping region in its ctor and
 // destroys it in the dtor
@@ -876,6 +937,8 @@ private:
 class WXDLLEXPORT wxDCClipper
 {
 public:
+    wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc)
+        { dc.SetClippingRegion(r); }
     wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc)
         { dc.SetClippingRegion(r.x, r.y, r.width, r.height); }
     wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc)