]>
Commit | Line | Data |
---|---|---|
1fc25a89 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: drawnp.h | |
3 | // Purpose: Private header for wxDrawnShape | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 12/07/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
2ba06d5a | 9 | // Licence: wxWindows licence |
1fc25a89 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _OGL_DRAWNP_H_ | |
13 | #define _OGL_DRAWNP_H_ | |
14 | ||
1fc25a89 JS |
15 | |
16 | /* | |
17 | * Drawing operations | |
18 | * | |
19 | */ | |
c1fa2fda | 20 | |
1fc25a89 JS |
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 | |
29 | ||
30 | /* | |
31 | #define DRAWOP_CREATE_PEN 10 | |
32 | #define DRAWOP_CREATE_BRUSH 11 | |
33 | #define DRAWOP_CREATE_FONT 12 | |
34 | */ | |
35 | ||
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 | |
47 | ||
48 | /* | |
49 | * Base, virtual class | |
50 | * | |
51 | */ | |
c1fa2fda | 52 | |
5f331691 | 53 | class WXDLLIMPEXP_OGL wxDrawOp: public wxObject |
1fc25a89 JS |
54 | { |
55 | public: | |
56 | inline wxDrawOp(int theOp) { m_op = theOp; } | |
57 | inline ~wxDrawOp() {} | |
93210c68 JS |
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)) {}; | |
1fc25a89 JS |
61 | virtual void Do(wxDC& dc, double xoffset, double yoffset) = 0; |
62 | virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0; | |
2b5f62a0 | 63 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
64 | virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0; |
65 | virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0; | |
2b5f62a0 | 66 | #endif |
1fc25a89 JS |
67 | inline int GetOp() const { return m_op; } |
68 | ||
2ba06d5a | 69 | // Draw an outline using the current operation. By default, return false (not drawn) |
93210c68 | 70 | virtual bool OnDrawOutline(wxDC& WXUNUSED(dc), double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(w), double WXUNUSED(h), |
2ba06d5a | 71 | double WXUNUSED(oldW), double WXUNUSED(oldH)) { return false; } |
1fc25a89 JS |
72 | |
73 | // Get the perimeter point using this data | |
93210c68 JS |
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)) | |
2ba06d5a | 79 | { return false; } |
1fc25a89 JS |
80 | |
81 | protected: | |
82 | int m_op; | |
83 | ||
84 | }; | |
85 | ||
86 | /* | |
87 | * Set font, brush, text colour | |
88 | * | |
89 | */ | |
c1fa2fda | 90 | |
5f331691 | 91 | class WXDLLIMPEXP_OGL wxOpSetGDI: public wxDrawOp |
1fc25a89 JS |
92 | { |
93 | public: | |
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); | |
2b5f62a0 | 97 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
98 | wxExpr *WriteExpr(wxPseudoMetaFile *image); |
99 | void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr); | |
2b5f62a0 | 100 | #endif |
1fc25a89 JS |
101 | |
102 | public: | |
103 | int m_mode; | |
104 | int m_gdiIndex; | |
105 | wxPseudoMetaFile* m_image; | |
106 | unsigned char m_r; | |
107 | unsigned char m_g; | |
108 | unsigned char m_b; | |
109 | }; | |
110 | ||
111 | /* | |
112 | * Set/destroy clipping | |
113 | * | |
114 | */ | |
c1fa2fda | 115 | |
5f331691 | 116 | class WXDLLIMPEXP_OGL wxOpSetClipping: public wxDrawOp |
1fc25a89 JS |
117 | { |
118 | public: | |
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); | |
2b5f62a0 | 124 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
125 | wxExpr *WriteExpr(wxPseudoMetaFile *image); |
126 | void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr); | |
2b5f62a0 | 127 | #endif |
1fc25a89 JS |
128 | |
129 | public: | |
130 | double m_x1; | |
131 | double m_y1; | |
132 | double m_x2; | |
133 | double m_y2; | |
134 | }; | |
135 | ||
136 | /* | |
137 | * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text | |
138 | * | |
139 | */ | |
c1fa2fda | 140 | |
5f331691 | 141 | class WXDLLIMPEXP_OGL wxOpDraw: public wxDrawOp |
1fc25a89 JS |
142 | { |
143 | public: | |
144 | wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, | |
17401ab1 | 145 | double radius = 0.0, const wxString& s = wxEmptyString); |
1fc25a89 JS |
146 | ~wxOpDraw(); |
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); | |
2b5f62a0 | 152 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
153 | wxExpr *WriteExpr(wxPseudoMetaFile *image); |
154 | void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr); | |
2b5f62a0 | 155 | #endif |
1fc25a89 JS |
156 | |
157 | public: | |
158 | double m_x1; | |
159 | double m_y1; | |
160 | double m_x2; | |
161 | double m_y2; | |
162 | double m_x3; | |
163 | double m_y3; | |
164 | double m_radius; | |
17401ab1 | 165 | wxString m_textString; |
1fc25a89 JS |
166 | |
167 | }; | |
168 | ||
169 | /* | |
170 | * Draw polyline, spline, polygon | |
171 | * | |
172 | */ | |
173 | ||
5f331691 | 174 | class WXDLLIMPEXP_OGL wxOpPolyDraw: public wxDrawOp |
1fc25a89 JS |
175 | { |
176 | public: | |
177 | wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints); | |
178 | ~wxOpPolyDraw(); | |
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); | |
2b5f62a0 | 184 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
185 | wxExpr *WriteExpr(wxPseudoMetaFile *image); |
186 | void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr); | |
2b5f62a0 | 187 | #endif |
1fc25a89 JS |
188 | |
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); | |
192 | ||
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, | |
198 | int attachmentMode); | |
199 | ||
200 | public: | |
201 | wxRealPoint* m_points; | |
202 | int m_noPoints; | |
c1fa2fda | 203 | |
1fc25a89 JS |
204 | }; |
205 | ||
206 | #endif | |
207 | // _OGL_DRAWNP_H_ | |
208 | ||
209 |