]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dc.h
converted to 16 colors
[wxWidgets.git] / include / wx / dc.h
index ef4e0e331b69025a7ebecd89b948517220d8db97..90fd7f6c9422474d7b101df687938d092a4dcbd4 100644 (file)
@@ -1,3 +1,14 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        dc.h
+// Purpose:     wxDC class
+// Author:      Vadim Zeitlin
+// Modified by:
+// Created:     05/25/99
+// RCS-ID:      $Id$
+// Copyright:   (c) wxWindows team
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
 #ifndef _WX_DC_H_BASE_
 #define _WX_DC_H_BASE_
 
@@ -56,7 +67,7 @@ public:
         m_deviceOriginX = m_deviceOriginY = 0;
 
         m_logicalScaleX = m_logicalScaleY =
-        m_userScaleX = m_userScaleY = 
+        m_userScaleX = m_userScaleY =
         m_scaleX = m_scaleY = 1.0;
 
         m_logicalFunction = -1;
@@ -65,7 +76,7 @@ public:
 
         m_mappingMode = wxMM_TEXT;
 
-        m_backgroundBrush = *wxWHITE_BRUSH;
+        m_backgroundBrush = *wxTRANSPARENT_BRUSH;
 
         m_textForegroundColour = *wxBLACK;
         m_textBackgroundColour = *wxWHITE;
@@ -109,7 +120,7 @@ public:
         { DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); }
 
     void DrawEllipticArc(long x, long y, long w, long h, double sa, double ea)
-        { DoDrawEllipticArc(x, y, x, y, sa, ea); }
+        { DoDrawEllipticArc(x, y, w, h, sa, ea); }
     void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
                          double sa, double ea)
         { DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); }
@@ -121,23 +132,7 @@ public:
 
     void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0)
         { DoDrawLines(n, points, xoffset, yoffset); }
-    void DrawLines(const wxList *list, long xoffset = 0, long yoffset = 0)
-    {
-        int n = list->Number();
-        wxPoint *points = new wxPoint[n];
-
-        int i = 0;
-        for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
-        {
-            wxPoint *point = (wxPoint *)node->Data();
-            points[i].x = point->x;
-            points[i].y = point->y;
-        }
-
-        DoDrawLines(n, points, xoffset, yoffset);
-
-        delete [] points;
-    }
+    void DrawLines(const wxList *list, long xoffset = 0, long yoffset = 0);
 
     void DrawPolygon(int n, wxPoint points[],
                      long xoffset = 0, long yoffset = 0,
@@ -146,23 +141,7 @@ public:
 
     void DrawPolygon(const wxList *list,
                      long xoffset = 0, long yoffset = 0,
-                     int fillStyle = wxODDEVEN_RULE)
-    {
-        int n = list->Number();
-        wxPoint *points = new wxPoint[n];
-
-        int i = 0;
-        for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
-        {
-            wxPoint *point = (wxPoint *)node->Data();
-            points[i].x = point->x;
-            points[i].y = point->y;
-        }
-
-        DoDrawPolygon(n, points, xoffset, yoffset, fillStyle);
-
-        delete [] points;
-    }
+                     int fillStyle = wxODDEVEN_RULE);
 
     void DrawRectangle(long x, long y, long width, long height)
         { DoDrawRectangle(x, y, width, height); }
@@ -180,6 +159,8 @@ public:
     void DrawRoundedRectangle(const wxRect& r, double radius)
         { DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
 
+    void DrawCircle(long x, long y, long radius)
+        { DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
     void DrawEllipse(long x, long y, long width, long height)
         { DoDrawEllipse(x, y, width, height); }
     void DrawEllipse(const wxPoint& pt, const wxSize& sz)
@@ -219,42 +200,9 @@ public:
     }
 
 #if wxUSE_SPLINES
-    // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
-    void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
-    {
-        wxList point_list;
-
-        wxPoint *point1 = new wxPoint;
-        point1->x = x1; point1->y = y1;
-        point_list.Append((wxObject*)point1);
-
-        wxPoint *point2 = new wxPoint;
-        point2->x = x2; point2->y = y2;
-        point_list.Append((wxObject*)point2);
-
-        wxPoint *point3 = new wxPoint;
-        point3->x = x3; point3->y = y3;
-        point_list.Append((wxObject*)point3);
-
-        DrawSpline(&point_list);
-
-        for( wxNode *node = point_list.First(); node; node = node->Next() )
-        {
-            wxPoint *p = (wxPoint *)node->Data();
-            delete p;
-        }
-    }
-
-    void DrawSpline(int n, wxPoint points[])
-    {
-        wxList list;
-        for (int i =0; i < n; i++)
-        {
-            list.Append((wxObject*)&points[i]);
-        }
-
-        DrawSpline(&list);
-    }
+// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
+    void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
+    void DrawSpline(int n, wxPoint points[]);
 
     void DrawSpline(wxList *points) { DoDrawSpline(points); }
 #endif // wxUSE_SPLINES
@@ -264,11 +212,11 @@ public:
 
     virtual void Clear() = 0;
 
-    virtual bool StartDoc(const wxString& message) = 0;
-    virtual void EndDoc() = 0;
+    virtual bool StartDoc(const wxString& WXUNUSED(message)) { return TRUE; }
+    virtual void EndDoc() { }
 
-    virtual void StartPage() = 0;
-    virtual void EndPage() = 0;
+    virtual void StartPage() { }
+    virtual void EndPage() { }
 
     // set objects to use for drawing
     // ------------------------------
@@ -397,8 +345,6 @@ public:
     }
     virtual void SetUserScale(double x, double y) = 0;
 
-    virtual void SetSystemScale(double x, double y) = 0;
-
     virtual void GetLogicalScale(double *x, double *y)
     {
         if ( x ) *x = m_logicalScaleX;
@@ -509,8 +455,11 @@ protected:
     virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
     virtual void DoSetClippingRegion(long x, long y,
                                      long width, long height) = 0;
+
+    // FIXME are these functions really different?
     virtual void DoGetClippingRegion(long *x, long *y,
-                                     long *width, long *height) = 0;
+                                     long *w, long *h)
+        { DoGetClippingBox(x, y, w, h); }
     virtual void DoGetClippingBox(long *x, long *y,
                                   long *w, long *h) const
     {
@@ -539,7 +488,9 @@ protected:
         if ( y ) *y = m_deviceOriginY;
     }
 
+#if wxUSE_SPLINES
     virtual void DoDrawSpline(wxList *points) = 0;
+#endif
 
 protected:
     // flags
@@ -597,6 +548,8 @@ private:
     #include "wx/qt/dc.h"
 #elif defined(__WXMAC__)
     #include "wx/mac/dc.h"
+#elif defined(__WXPM__)
+    #include "wx/os2/dc.h"
 #elif defined(__WXSTUBS__)
     #include "wx/stubs/dc.h"
 #endif