#define wxUSE_NEW_DC 0
+#if wxUSE_NEW_DC
+class WXDLLIMPEXP_FWD_CORE wxDC;
+#else
+class WXDLLIMPEXP_FWD_CORE wxDCBase;
+#endif
+
+class WXDLLEXPORT wxDrawObject
+{
+public:
+
+ wxDrawObject()
+ : m_isBBoxValid(false)
+ , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
+ { }
+
+ virtual ~wxDrawObject() { }
+
+#if wxUSE_NEW_DC
+ virtual void Draw(wxDC&) const { }
+#else
+ virtual void Draw(wxDCBase&) const { }
+#endif
+
+ virtual void CalcBoundingBox(wxCoord x, wxCoord y)
+ {
+ if ( m_isBBoxValid )
+ {
+ if ( x < m_minX ) m_minX = x;
+ if ( y < m_minY ) m_minY = y;
+ if ( x > m_maxX ) m_maxX = x;
+ if ( y > m_maxY ) m_maxY = y;
+ }
+ else
+ {
+ m_isBBoxValid = true;
+
+ m_minX = x;
+ m_minY = y;
+ m_maxX = x;
+ m_maxY = y;
+ }
+ }
+
+ void ResetBoundingBox()
+ {
+ m_isBBoxValid = false;
+
+ m_minX = m_maxX = m_minY = m_maxY = 0;
+ }
+
+ // Get the final bounding box of the PostScript or Metafile picture.
+
+ wxCoord MinX() const { return m_minX; }
+ wxCoord MaxX() const { return m_maxX; }
+ wxCoord MinY() const { return m_minY; }
+ wxCoord MaxY() const { return m_maxY; }
+
+ //to define the type of object for derived objects
+ virtual int GetType()=0;
+
+protected:
+ //for boundingbox calculation
+ bool m_isBBoxValid:1;
+ //for boundingbox calculation
+ wxCoord m_minX, m_minY, m_maxX, m_maxY;
+};
+
+
#if wxUSE_NEW_DC
//-----------------------------------------------------------------------------
// wxNativeDCFactory
//-----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxDCFactory
+class WXDLLIMPEXP_CORE wxNativeDCFactory
{
public:
wxNativeDCFactory() {}
virtual wxImplDC* CreateMemoryDC( wxDC *dc );
};
-//-----------------------------------------------------------------------------
-// wxWindowDC
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
-{
-public:
- wxWindowDC();
- wxWindowDC( wxWindow *win );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxWindowDC)
-};
-
-//-----------------------------------------------------------------------------
-// wxClientDC
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxClientDC : public wxDC
-{
-public:
- wxClientDC();
- wxClientDC( wxWindow *win );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxClientDC)
-};
-
-//-----------------------------------------------------------------------------
-// wxMemoryDC
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC
-{
-public:
- wxMemoryDC();
- wxMemoryDC( wxBitmap& bitmap );
- wxMemoryDC( wxDC *dc );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxMemoryDC)
-};
-
-//-----------------------------------------------------------------------------
-// wxPaintDC
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxPaintDC : public wxDC
-{
-public:
- wxPaintDC();
- wxPaintDC( wxWindow *win );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxPaintDC)
-};
-
//-----------------------------------------------------------------------------
// wxImplDC
//-----------------------------------------------------------------------------
// bounding box
- virtual void CalcBoundingBox(wxCoord x, wxCoord y);
+ virtual void CalcBoundingBox(wxCoord x, wxCoord y)
{
if ( m_isBBoxValid )
{
m_maxY = y;
}
}
- void ResetBoundingBox();
+ void ResetBoundingBox()
{
m_isBBoxValid = false;
#if wxUSE_SPLINES
+ virtual void DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3);
+ virtual void DoDrawSpline(int n, wxPoint points[]);
virtual void DoDrawSpline(wxList *points);
#endif
private:
DECLARE_ABSTRACT_CLASS(wxImplDC)
-}
+};
class wxDC: public wxObject
{ return m_pimpl->GetBackground(); }
void SetBackgroundMode(int mode)
- { m_pimpl->SetBackground( mode ); }
+ { m_pimpl->SetBackgroundMode( mode ); }
int GetBackgroundMode() const
- { return m_pimpl->GetBackground(); }
+ { return m_pimpl->GetBackgroundMode(); }
void SetTextForeground(const wxColour& colour)
{ m_pimpl->SetTextForeground(colour); }
wxCoord DeviceToLogicalX(wxCoord x) const
{ return m_pimpl->DeviceToLogicalX(x); }
- wxCoord DeviceToLogicalY(wxCoord y) const;
+ wxCoord DeviceToLogicalY(wxCoord y) const
{ return m_pimpl->DeviceToLogicalY(y); }
- wxCoord DeviceToLogicalXRel(wxCoord x) const;
+ wxCoord DeviceToLogicalXRel(wxCoord x) const
{ return m_pimpl->DeviceToLogicalXRel(x); }
- wxCoord DeviceToLogicalYRel(wxCoord y) const;
+ wxCoord DeviceToLogicalYRel(wxCoord y) const
{ return m_pimpl->DeviceToLogicalYRel(y); }
- wxCoord LogicalToDeviceX(wxCoord x) const;
+ wxCoord LogicalToDeviceX(wxCoord x) const
{ return m_pimpl->LogicalToDeviceX(x); }
- wxCoord LogicalToDeviceY(wxCoord y) const;
+ wxCoord LogicalToDeviceY(wxCoord y) const
{ return m_pimpl->LogicalToDeviceY(y); }
- wxCoord LogicalToDeviceXRel(wxCoord x) const;
+ wxCoord LogicalToDeviceXRel(wxCoord x) const
{ return m_pimpl->LogicalToDeviceXRel(x); }
- wxCoord LogicalToDeviceYRel(wxCoord y) const;
+ wxCoord LogicalToDeviceYRel(wxCoord y) const
{ return m_pimpl->LogicalToDeviceYRel(y); }
void SetMapMode(int mode)
void GradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour)
- { m_pimpl->GradientFillConcentric(rect, initialColour, destColour,
- wxPoint(rect.GetWidth() / 2,
- rect.GetHeight() / 2)); }
+ { m_pimpl->DoGradientFillConcentric( rect, initialColour, destColour,
+ wxPoint(rect.GetWidth() / 2,
+ rect.GetHeight() / 2)); }
void GradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
void DrawLines(int n, wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0)
{ m_pimpl->DoDrawLines(n, points, xoffset, yoffset); }
+
+#if 0
+ // needs to be removed
void DrawLines(const wxList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0)
- { m_pimpl->DrawLines( list, xoffset, yoffset ); }
+#endif
void DrawPolygon(int n, wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
+#if 0
+ // needs to be removed
void DrawPolygon(const wxList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
+#endif
void DrawPolyPolygon(int n, int count[], wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius)
{ m_pimpl->DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
void DrawCircle(const wxPoint& pt, wxCoord radius)
- { m_pimpl->DrawCircle(pt.x, pt.y, radius); }
+ { m_pimpl->DoDrawEllipse(pt.x - radius, pt.y - radius, 2*radius, 2*radius); }
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{ m_pimpl->DoDrawEllipse(x, y, width, height); }
bool useMask = false)
{ m_pimpl->DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
- virtual void DrawScaledBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, wxCoord w, wxCoord h, bool useMask = false, int quality = wxIMAGE_QUALITY_NORMAL)
- {
- if (bmp.GetWidth() != w || bmp.GetHeight() != h)
- {
- if (quality != wxIMAGE_QUALITY_HIGH)
- quality = wxIMAGE_QUALITY_NORMAL;
- wxImage tmpImg = bmp.ConvertToImage();
- tmpImg.Rescale( w, h, quality );
- wxBitmap scaledBmp(tmpImg);
- m_pimpl->DoDrawBitmap(scaledBmp, x, y, useMask);
- }
- else
- m_pimpl->DoDrawBitmap(bmp, x, y, useMask);
- }
- virtual void DrawScaledBitmap(const wxBitmap &bmp, const wxPoint& pt, const wxSize& sz, bool useMask = false, int quality = wxIMAGE_QUALITY_NORMAL)
- {
- if (bmp.GetWidth() != sz.x || bmp.GetHeight() != sz.y)
- {
- if (quality != wxIMAGE_QUALITY_HIGH)
- quality = wxIMAGE_QUALITY_NORMAL;
- wxImage tmpImg = bmp.ConvertToImage();
- tmpImg.Rescale( sz.x, sz.y, quality );
- wxBitmap scaledBmp(tmpImg);
- m_pimpl->DoDrawBitmap(scaledBmp, pt.x, pt.y, useMask);
- }
- else
- m_pimpl->DoDrawBitmap(bmp, pt.x, pt.y, useMask);
- }
- virtual void DrawScaledBitmap(const wxBitmap &bmp, const wxRect& rect, bool useMask = false, int quality = wxIMAGE_QUALITY_NORMAL)
- {
- if (bmp.GetWidth() != rect.width || bmp.GetHeight() != rect.height)
- {
- if (quality != wxIMAGE_QUALITY_HIGH)
- quality = wxIMAGE_QUALITY_NORMAL;
- wxImage tmpImg = bmp.ConvertToImage();
- tmpImg.Rescale( rect.width, rect.height, quality );
- wxBitmap scaledBmp(tmpImg);
- m_pimpl->DoDrawBitmap(scaledBmp, rect.x, rect.y, useMask);
- }
- else
- m_pimpl->DoDrawBitmap(bmp, rect.x, rect.y, useMask);
- }
-
void DrawText(const wxString& text, wxCoord x, wxCoord y)
{ m_pimpl->DoDrawText(text, x, y); }
void DrawText(const wxString& text, const wxPoint& pt)
const wxRect& rect,
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
int indexAccel = -1,
- wxRect *rectBounding = NULL)
- { m_pimpl->DrawLabel( text, image, rect, alignment, indexAccel, rectBounding ); }
+ wxRect *rectBounding = NULL);
void DrawLabel(const wxString& text, const wxRect& rect,
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
int indexAccel = -1)
- { m_pimpl->DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); }
+ { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); }
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
}
#if wxUSE_SPLINES
- // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
void DrawSpline(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3)
- { m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); }
+ { m_pimpl->DoDrawSpline(x1,y1,x2,y2,x3,y3); }
void DrawSpline(int n, wxPoint points[])
- { m_pimpl->DrawSpline(n,points); }
+ { m_pimpl->DoDrawSpline(n,points); }
+#if 0
+ // needs to be removed
void DrawSpline(wxList *points)
{ m_pimpl->DoDrawSpline(points); }
+#endif
#endif // wxUSE_SPLINES
private:
DECLARE_ABSTRACT_CLASS(wxImplDC)
-}
-
-
-#else // wxUSE_NEW_DC
+};
-class WXDLLIMPEXP_FWD_CORE wxDC;
-class WXDLLIMPEXP_FWD_CORE wxDCBase;
+//-----------------------------------------------------------------------------
+// wxWindowDC
+//-----------------------------------------------------------------------------
-class WXDLLEXPORT wxDrawObject
+class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
{
public:
+ wxWindowDC();
+ wxWindowDC( wxWindow *win );
- wxDrawObject()
- : m_isBBoxValid(false)
- , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
- { }
+private:
+ DECLARE_DYNAMIC_CLASS(wxWindowDC)
+};
- virtual ~wxDrawObject() { }
+//-----------------------------------------------------------------------------
+// wxClientDC
+//-----------------------------------------------------------------------------
- virtual void Draw(wxDCBase&) const { }
+class WXDLLIMPEXP_CORE wxClientDC : public wxDC
+{
+public:
+ wxClientDC();
+ wxClientDC( wxWindow *win );
- virtual void CalcBoundingBox(wxCoord x, wxCoord y)
- {
- if ( m_isBBoxValid )
- {
- if ( x < m_minX ) m_minX = x;
- if ( y < m_minY ) m_minY = y;
- if ( x > m_maxX ) m_maxX = x;
- if ( y > m_maxY ) m_maxY = y;
- }
- else
- {
- m_isBBoxValid = true;
+private:
+ DECLARE_DYNAMIC_CLASS(wxClientDC)
+};
- m_minX = x;
- m_minY = y;
- m_maxX = x;
- m_maxY = y;
- }
- }
+//-----------------------------------------------------------------------------
+// wxMemoryDC
+//-----------------------------------------------------------------------------
- void ResetBoundingBox()
- {
- m_isBBoxValid = false;
+class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC
+{
+public:
+ wxMemoryDC();
+ wxMemoryDC( wxBitmap& bitmap );
+ wxMemoryDC( wxDC *dc );
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxMemoryDC)
+};
+
+//-----------------------------------------------------------------------------
+// wxPaintDC
+//-----------------------------------------------------------------------------
- m_minX = m_maxX = m_minY = m_maxY = 0;
- }
+class WXDLLIMPEXP_CORE wxPaintDC : public wxDC
+{
+public:
+ wxPaintDC();
+ wxPaintDC( wxWindow *win );
- // Get the final bounding box of the PostScript or Metafile picture.
+private:
+ DECLARE_DYNAMIC_CLASS(wxPaintDC)
+};
- wxCoord MinX() const { return m_minX; }
- wxCoord MaxX() const { return m_maxX; }
- wxCoord MinY() const { return m_minY; }
- wxCoord MaxY() const { return m_maxY; }
+#else // wxUSE_NEW_DC
- //to define the type of object for derived objects
- virtual int GetType()=0;
-protected:
- //for boundingbox calculation
- bool m_isBBoxValid:1;
- //for boundingbox calculation
- wxCoord m_minX, m_minY, m_maxX, m_maxY;
-};
+class WXDLLIMPEXP_FWD_CORE wxDC;
// ---------------------------------------------------------------------------
// global variables
bool useMask = false)
{ DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
- virtual void DrawScaledBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, wxCoord w, wxCoord h, bool useMask = false, int quality = wxIMAGE_QUALITY_NORMAL)
- {
- if (bmp.GetWidth() != w || bmp.GetHeight() != h)
- {
- if (quality != wxIMAGE_QUALITY_HIGH)
- quality = wxIMAGE_QUALITY_NORMAL;
- wxImage tmpImg = bmp.ConvertToImage();
- tmpImg.Rescale( w, h, quality );
- wxBitmap scaledBmp(tmpImg);
- DoDrawBitmap(scaledBmp, x, y, useMask);
- }
- else
- DoDrawBitmap(bmp, x, y, useMask);
- }
- virtual void DrawScaledBitmap(const wxBitmap &bmp, const wxPoint& pt, const wxSize& sz, bool useMask = false, int quality = wxIMAGE_QUALITY_NORMAL)
- {
- if (bmp.GetWidth() != sz.x || bmp.GetHeight() != sz.y)
- {
- if (quality != wxIMAGE_QUALITY_HIGH)
- quality = wxIMAGE_QUALITY_NORMAL;
- wxImage tmpImg = bmp.ConvertToImage();
- tmpImg.Rescale( sz.x, sz.y, quality );
- wxBitmap scaledBmp(tmpImg);
- DoDrawBitmap(scaledBmp, pt.x, pt.y, useMask);
- }
- else
- DoDrawBitmap(bmp, pt.x, pt.y, useMask);
- }
- virtual void DrawScaledBitmap(const wxBitmap &bmp, const wxRect& rect, bool useMask = false, int quality = wxIMAGE_QUALITY_NORMAL)
- {
- if (bmp.GetWidth() != rect.width || bmp.GetHeight() != rect.height)
- {
- if (quality != wxIMAGE_QUALITY_HIGH)
- quality = wxIMAGE_QUALITY_NORMAL;
- wxImage tmpImg = bmp.ConvertToImage();
- tmpImg.Rescale( rect.width, rect.height, quality );
- wxBitmap scaledBmp(tmpImg);
- DoDrawBitmap(scaledBmp, rect.x, rect.y, useMask);
- }
- else
- DoDrawBitmap(bmp, rect.x, rect.y, useMask);
- }
-
void DrawText(const wxString& text, wxCoord x, wxCoord y)
{ DoDrawText(text, x, y); }
void DrawText(const wxString& text, const wxPoint& pt)