1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private header for wxDrawnShape
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _OGL_DRAWNP_H_
13 #define _OGL_DRAWNP_H_
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "drawnp.h"
25 #define DRAWOP_SET_PEN 1
26 #define DRAWOP_SET_BRUSH 2
27 #define DRAWOP_SET_FONT 3
28 #define DRAWOP_SET_TEXT_COLOUR 4
29 #define DRAWOP_SET_BK_COLOUR 5
30 #define DRAWOP_SET_BK_MODE 6
31 #define DRAWOP_SET_CLIPPING_RECT 7
32 #define DRAWOP_DESTROY_CLIPPING_RECT 8
35 #define DRAWOP_CREATE_PEN 10
36 #define DRAWOP_CREATE_BRUSH 11
37 #define DRAWOP_CREATE_FONT 12
40 #define DRAWOP_DRAW_LINE 20
41 #define DRAWOP_DRAW_POLYLINE 21
42 #define DRAWOP_DRAW_POLYGON 22
43 #define DRAWOP_DRAW_RECT 23
44 #define DRAWOP_DRAW_ROUNDED_RECT 24
45 #define DRAWOP_DRAW_ELLIPSE 25
46 #define DRAWOP_DRAW_POINT 26
47 #define DRAWOP_DRAW_ARC 27
48 #define DRAWOP_DRAW_TEXT 28
49 #define DRAWOP_DRAW_SPLINE 29
50 #define DRAWOP_DRAW_ELLIPTIC_ARC 30
57 class WXDLLIMPEXP_OGL wxDrawOp
: public wxObject
60 inline wxDrawOp(int theOp
) { m_op
= theOp
; }
62 inline virtual void Scale(double WXUNUSED(xScale
), double WXUNUSED(yScale
)) {};
63 inline virtual void Translate(double WXUNUSED(x
), double WXUNUSED(y
)) {};
64 inline virtual void Rotate(double WXUNUSED(x
), double WXUNUSED(y
), double WXUNUSED(theta
), double WXUNUSED(sinTheta
), double WXUNUSED(cosTheta
)) {};
65 virtual void Do(wxDC
& dc
, double xoffset
, double yoffset
) = 0;
66 virtual wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
) = 0;
68 virtual wxExpr
*WriteExpr(wxPseudoMetaFile
*image
) = 0;
69 virtual void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
) = 0;
71 inline int GetOp() const { return m_op
; }
73 // Draw an outline using the current operation. By default, return false (not drawn)
74 virtual bool OnDrawOutline(wxDC
& WXUNUSED(dc
), double WXUNUSED(x
), double WXUNUSED(y
), double WXUNUSED(w
), double WXUNUSED(h
),
75 double WXUNUSED(oldW
), double WXUNUSED(oldH
)) { return false; }
77 // Get the perimeter point using this data
78 virtual bool GetPerimeterPoint(double WXUNUSED(x1
), double WXUNUSED(y1
),
79 double WXUNUSED(x2
), double WXUNUSED(y2
),
80 double *WXUNUSED(x3
), double *WXUNUSED(y3
),
81 double WXUNUSED(xOffset
), double WXUNUSED(yOffset
),
82 int WXUNUSED(attachmentMode
))
91 * Set font, brush, text colour
95 class WXDLLIMPEXP_OGL wxOpSetGDI
: public wxDrawOp
98 wxOpSetGDI(int theOp
, wxPseudoMetaFile
*theImage
, int theGdiIndex
, int theMode
= 0);
99 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
100 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
102 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
103 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
109 wxPseudoMetaFile
* m_image
;
116 * Set/destroy clipping
120 class WXDLLIMPEXP_OGL wxOpSetClipping
: public wxDrawOp
123 wxOpSetClipping(int theOp
, double theX1
, double theY1
, double theX2
, double theY2
);
124 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
125 void Scale(double xScale
, double yScale
);
126 void Translate(double x
, double y
);
127 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
129 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
130 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
141 * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
145 class WXDLLIMPEXP_OGL wxOpDraw
: public wxDrawOp
148 wxOpDraw(int theOp
, double theX1
, double theY1
, double theX2
, double theY2
,
149 double radius
= 0.0, const wxString
& s
= wxEmptyString
);
151 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
152 void Scale(double scaleX
, double scaleY
);
153 void Translate(double x
, double y
);
154 void Rotate(double x
, double y
, double theta
, double sinTheta
, double cosTheta
);
155 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
157 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
158 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
169 wxString m_textString
;
174 * Draw polyline, spline, polygon
178 class WXDLLIMPEXP_OGL wxOpPolyDraw
: public wxDrawOp
181 wxOpPolyDraw(int theOp
, int n
, wxRealPoint
*thePoints
);
183 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
184 void Scale(double scaleX
, double scaleY
);
185 void Translate(double x
, double y
);
186 void Rotate(double x
, double y
, double theta
, double sinTheta
, double cosTheta
);
187 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
189 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
190 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
193 // Draw an outline using the current operation.
194 virtual bool OnDrawOutline(wxDC
& dc
, double x
, double y
, double w
, double h
,
195 double oldW
, double oldH
);
197 // Get the perimeter point using this data
198 bool GetPerimeterPoint(double x1
, double y1
,
199 double x2
, double y2
,
200 double *x3
, double *y3
,
201 double xOffset
, double yOffset
,
205 wxRealPoint
* m_points
;