]>
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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _OGL_DRAWNP_H_ | |
13 | #define _OGL_DRAWNP_H_ | |
14 | ||
ab7ce33c | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
1fc25a89 JS |
16 | #pragma interface "drawnp.h" |
17 | #endif | |
18 | ||
19 | #include <wx/ogl/drawn.h> | |
20 | ||
21 | /* | |
22 | * Drawing operations | |
23 | * | |
24 | */ | |
c1fa2fda | 25 | |
1fc25a89 JS |
26 | #define DRAWOP_SET_PEN 1 |
27 | #define DRAWOP_SET_BRUSH 2 | |
28 | #define DRAWOP_SET_FONT 3 | |
29 | #define DRAWOP_SET_TEXT_COLOUR 4 | |
30 | #define DRAWOP_SET_BK_COLOUR 5 | |
31 | #define DRAWOP_SET_BK_MODE 6 | |
32 | #define DRAWOP_SET_CLIPPING_RECT 7 | |
33 | #define DRAWOP_DESTROY_CLIPPING_RECT 8 | |
34 | ||
35 | /* | |
36 | #define DRAWOP_CREATE_PEN 10 | |
37 | #define DRAWOP_CREATE_BRUSH 11 | |
38 | #define DRAWOP_CREATE_FONT 12 | |
39 | */ | |
40 | ||
41 | #define DRAWOP_DRAW_LINE 20 | |
42 | #define DRAWOP_DRAW_POLYLINE 21 | |
43 | #define DRAWOP_DRAW_POLYGON 22 | |
44 | #define DRAWOP_DRAW_RECT 23 | |
45 | #define DRAWOP_DRAW_ROUNDED_RECT 24 | |
46 | #define DRAWOP_DRAW_ELLIPSE 25 | |
47 | #define DRAWOP_DRAW_POINT 26 | |
48 | #define DRAWOP_DRAW_ARC 27 | |
49 | #define DRAWOP_DRAW_TEXT 28 | |
50 | #define DRAWOP_DRAW_SPLINE 29 | |
51 | #define DRAWOP_DRAW_ELLIPTIC_ARC 30 | |
52 | ||
53 | /* | |
54 | * Base, virtual class | |
55 | * | |
56 | */ | |
c1fa2fda | 57 | |
1fc25a89 JS |
58 | class wxDrawOp: public wxObject |
59 | { | |
60 | public: | |
61 | inline wxDrawOp(int theOp) { m_op = theOp; } | |
62 | inline ~wxDrawOp() {} | |
63 | inline virtual void Scale(double xScale, double yScale) {}; | |
64 | inline virtual void Translate(double x, double y) {}; | |
65 | inline virtual void Rotate(double x, double y, double theta, double sinTheta, double cosTheta) {}; | |
66 | virtual void Do(wxDC& dc, double xoffset, double yoffset) = 0; | |
67 | virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0; | |
2b5f62a0 | 68 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
69 | virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0; |
70 | virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0; | |
2b5f62a0 | 71 | #endif |
1fc25a89 JS |
72 | inline int GetOp() const { return m_op; } |
73 | ||
74 | // Draw an outline using the current operation. By default, return FALSE (not drawn) | |
75 | virtual bool OnDrawOutline(wxDC& dc, double x, double y, double w, double h, | |
76 | double oldW, double oldH) { return FALSE; } | |
77 | ||
78 | // Get the perimeter point using this data | |
79 | virtual bool GetPerimeterPoint(double x1, double y1, | |
80 | double x2, double y2, | |
81 | double *x3, double *y3, | |
82 | double xOffset, double yOffset, | |
83 | int attachmentMode) | |
84 | { return FALSE; } | |
85 | ||
86 | protected: | |
87 | int m_op; | |
88 | ||
89 | }; | |
90 | ||
91 | /* | |
92 | * Set font, brush, text colour | |
93 | * | |
94 | */ | |
c1fa2fda | 95 | |
1fc25a89 JS |
96 | class wxOpSetGDI: public wxDrawOp |
97 | { | |
98 | public: | |
99 | wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode = 0); | |
100 | void Do(wxDC& dc, double xoffset, double yoffset); | |
101 | wxDrawOp *Copy(wxPseudoMetaFile *newImage); | |
2b5f62a0 | 102 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
103 | wxExpr *WriteExpr(wxPseudoMetaFile *image); |
104 | void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr); | |
2b5f62a0 | 105 | #endif |
1fc25a89 JS |
106 | |
107 | public: | |
108 | int m_mode; | |
109 | int m_gdiIndex; | |
110 | wxPseudoMetaFile* m_image; | |
111 | unsigned char m_r; | |
112 | unsigned char m_g; | |
113 | unsigned char m_b; | |
114 | }; | |
115 | ||
116 | /* | |
117 | * Set/destroy clipping | |
118 | * | |
119 | */ | |
c1fa2fda | 120 | |
1fc25a89 JS |
121 | class wxOpSetClipping: public wxDrawOp |
122 | { | |
123 | public: | |
124 | wxOpSetClipping(int theOp, double theX1, double theY1, double theX2, double theY2); | |
125 | void Do(wxDC& dc, double xoffset, double yoffset); | |
126 | void Scale(double xScale, double yScale); | |
127 | void Translate(double x, double y); | |
128 | wxDrawOp *Copy(wxPseudoMetaFile *newImage); | |
2b5f62a0 | 129 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
130 | wxExpr *WriteExpr(wxPseudoMetaFile *image); |
131 | void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr); | |
2b5f62a0 | 132 | #endif |
1fc25a89 JS |
133 | |
134 | public: | |
135 | double m_x1; | |
136 | double m_y1; | |
137 | double m_x2; | |
138 | double m_y2; | |
139 | }; | |
140 | ||
141 | /* | |
142 | * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text | |
143 | * | |
144 | */ | |
c1fa2fda | 145 | |
1fc25a89 JS |
146 | class wxOpDraw: public wxDrawOp |
147 | { | |
148 | public: | |
149 | wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, | |
c1fa2fda | 150 | double radius = 0.0, wxChar *s = NULL); |
1fc25a89 JS |
151 | ~wxOpDraw(); |
152 | void Do(wxDC& dc, double xoffset, double yoffset); | |
153 | void Scale(double scaleX, double scaleY); | |
154 | void Translate(double x, double y); | |
155 | void Rotate(double x, double y, double theta, double sinTheta, double cosTheta); | |
156 | wxDrawOp *Copy(wxPseudoMetaFile *newImage); | |
2b5f62a0 | 157 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
158 | wxExpr *WriteExpr(wxPseudoMetaFile *image); |
159 | void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr); | |
2b5f62a0 | 160 | #endif |
1fc25a89 JS |
161 | |
162 | public: | |
163 | double m_x1; | |
164 | double m_y1; | |
165 | double m_x2; | |
166 | double m_y2; | |
167 | double m_x3; | |
168 | double m_y3; | |
169 | double m_radius; | |
c1fa2fda | 170 | wxChar* m_textString; |
1fc25a89 JS |
171 | |
172 | }; | |
173 | ||
174 | /* | |
175 | * Draw polyline, spline, polygon | |
176 | * | |
177 | */ | |
178 | ||
179 | class wxOpPolyDraw: public wxDrawOp | |
180 | { | |
181 | public: | |
182 | wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints); | |
183 | ~wxOpPolyDraw(); | |
184 | void Do(wxDC& dc, double xoffset, double yoffset); | |
185 | void Scale(double scaleX, double scaleY); | |
186 | void Translate(double x, double y); | |
187 | void Rotate(double x, double y, double theta, double sinTheta, double cosTheta); | |
188 | wxDrawOp *Copy(wxPseudoMetaFile *newImage); | |
2b5f62a0 | 189 | #if wxUSE_PROLOGIO |
1fc25a89 JS |
190 | wxExpr *WriteExpr(wxPseudoMetaFile *image); |
191 | void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr); | |
2b5f62a0 | 192 | #endif |
1fc25a89 JS |
193 | |
194 | // Draw an outline using the current operation. | |
195 | virtual bool OnDrawOutline(wxDC& dc, double x, double y, double w, double h, | |
196 | double oldW, double oldH); | |
197 | ||
198 | // Get the perimeter point using this data | |
199 | bool GetPerimeterPoint(double x1, double y1, | |
200 | double x2, double y2, | |
201 | double *x3, double *y3, | |
202 | double xOffset, double yOffset, | |
203 | int attachmentMode); | |
204 | ||
205 | public: | |
206 | wxRealPoint* m_points; | |
207 | int m_noPoints; | |
c1fa2fda | 208 | |
1fc25a89 JS |
209 | }; |
210 | ||
211 | #endif | |
212 | // _OGL_DRAWNP_H_ | |
213 | ||
214 |