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_
21 #define DRAWOP_SET_PEN 1
22 #define DRAWOP_SET_BRUSH 2
23 #define DRAWOP_SET_FONT 3
24 #define DRAWOP_SET_TEXT_COLOUR 4
25 #define DRAWOP_SET_BK_COLOUR 5
26 #define DRAWOP_SET_BK_MODE 6
27 #define DRAWOP_SET_CLIPPING_RECT 7
28 #define DRAWOP_DESTROY_CLIPPING_RECT 8
31 #define DRAWOP_CREATE_PEN 10
32 #define DRAWOP_CREATE_BRUSH 11
33 #define DRAWOP_CREATE_FONT 12
36 #define DRAWOP_DRAW_LINE 20
37 #define DRAWOP_DRAW_POLYLINE 21
38 #define DRAWOP_DRAW_POLYGON 22
39 #define DRAWOP_DRAW_RECT 23
40 #define DRAWOP_DRAW_ROUNDED_RECT 24
41 #define DRAWOP_DRAW_ELLIPSE 25
42 #define DRAWOP_DRAW_POINT 26
43 #define DRAWOP_DRAW_ARC 27
44 #define DRAWOP_DRAW_TEXT 28
45 #define DRAWOP_DRAW_SPLINE 29
46 #define DRAWOP_DRAW_ELLIPTIC_ARC 30
53 class WXDLLIMPEXP_OGL wxDrawOp
: public wxObject
56 inline wxDrawOp(int theOp
) { m_op
= theOp
; }
58 inline virtual void Scale(double WXUNUSED(xScale
), double WXUNUSED(yScale
)) {};
59 inline virtual void Translate(double WXUNUSED(x
), double WXUNUSED(y
)) {};
60 inline virtual void Rotate(double WXUNUSED(x
), double WXUNUSED(y
), double WXUNUSED(theta
), double WXUNUSED(sinTheta
), double WXUNUSED(cosTheta
)) {};
61 virtual void Do(wxDC
& dc
, double xoffset
, double yoffset
) = 0;
62 virtual wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
) = 0;
64 virtual wxExpr
*WriteExpr(wxPseudoMetaFile
*image
) = 0;
65 virtual void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
) = 0;
67 inline int GetOp() const { return m_op
; }
69 // Draw an outline using the current operation. By default, return false (not drawn)
70 virtual bool OnDrawOutline(wxDC
& WXUNUSED(dc
), double WXUNUSED(x
), double WXUNUSED(y
), double WXUNUSED(w
), double WXUNUSED(h
),
71 double WXUNUSED(oldW
), double WXUNUSED(oldH
)) { return false; }
73 // Get the perimeter point using this data
74 virtual bool GetPerimeterPoint(double WXUNUSED(x1
), double WXUNUSED(y1
),
75 double WXUNUSED(x2
), double WXUNUSED(y2
),
76 double *WXUNUSED(x3
), double *WXUNUSED(y3
),
77 double WXUNUSED(xOffset
), double WXUNUSED(yOffset
),
78 int WXUNUSED(attachmentMode
))
87 * Set font, brush, text colour
91 class WXDLLIMPEXP_OGL wxOpSetGDI
: public wxDrawOp
94 wxOpSetGDI(int theOp
, wxPseudoMetaFile
*theImage
, int theGdiIndex
, int theMode
= 0);
95 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
96 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
98 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
99 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
105 wxPseudoMetaFile
* m_image
;
112 * Set/destroy clipping
116 class WXDLLIMPEXP_OGL wxOpSetClipping
: public wxDrawOp
119 wxOpSetClipping(int theOp
, double theX1
, double theY1
, double theX2
, double theY2
);
120 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
121 void Scale(double xScale
, double yScale
);
122 void Translate(double x
, double y
);
123 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
125 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
126 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
137 * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
141 class WXDLLIMPEXP_OGL wxOpDraw
: public wxDrawOp
144 wxOpDraw(int theOp
, double theX1
, double theY1
, double theX2
, double theY2
,
145 double radius
= 0.0, const wxString
& s
= wxEmptyString
);
147 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
148 void Scale(double scaleX
, double scaleY
);
149 void Translate(double x
, double y
);
150 void Rotate(double x
, double y
, double theta
, double sinTheta
, double cosTheta
);
151 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
153 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
154 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
165 wxString m_textString
;
170 * Draw polyline, spline, polygon
174 class WXDLLIMPEXP_OGL wxOpPolyDraw
: public wxDrawOp
177 wxOpPolyDraw(int theOp
, int n
, wxRealPoint
*thePoints
);
179 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
180 void Scale(double scaleX
, double scaleY
);
181 void Translate(double x
, double y
);
182 void Rotate(double x
, double y
, double theta
, double sinTheta
, double cosTheta
);
183 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
185 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
186 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
189 // Draw an outline using the current operation.
190 virtual bool OnDrawOutline(wxDC
& dc
, double x
, double y
, double w
, double h
,
191 double oldW
, double oldH
);
193 // Get the perimeter point using this data
194 bool GetPerimeterPoint(double x1
, double y1
,
195 double x2
, double y2
,
196 double *x3
, double *y3
,
197 double xOffset
, double yOffset
,
201 wxRealPoint
* m_points
;