]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/drawnp.h
Check wxUSE_DEPRECATED before including its headers
[wxWidgets.git] / contrib / include / wx / ogl / drawnp.h
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
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "drawnp.h"
17 #endif
18
19
20 /*
21 * Drawing operations
22 *
23 */
24
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
33
34 /*
35 #define DRAWOP_CREATE_PEN 10
36 #define DRAWOP_CREATE_BRUSH 11
37 #define DRAWOP_CREATE_FONT 12
38 */
39
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
51
52 /*
53 * Base, virtual class
54 *
55 */
56
57 class WXDLLIMPEXP_OGL wxDrawOp: public wxObject
58 {
59 public:
60 inline wxDrawOp(int theOp) { m_op = theOp; }
61 inline ~wxDrawOp() {}
62 inline virtual void Scale(double xScale, double yScale) {};
63 inline virtual void Translate(double x, double y) {};
64 inline virtual void Rotate(double x, double y, double theta, double sinTheta, double cosTheta) {};
65 virtual void Do(wxDC& dc, double xoffset, double yoffset) = 0;
66 virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0;
67 #if wxUSE_PROLOGIO
68 virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0;
69 virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0;
70 #endif
71 inline int GetOp() const { return m_op; }
72
73 // Draw an outline using the current operation. By default, return FALSE (not drawn)
74 virtual bool OnDrawOutline(wxDC& dc, double x, double y, double w, double h,
75 double oldW, double oldH) { return FALSE; }
76
77 // Get the perimeter point using this data
78 virtual bool GetPerimeterPoint(double x1, double y1,
79 double x2, double y2,
80 double *x3, double *y3,
81 double xOffset, double yOffset,
82 int attachmentMode)
83 { return FALSE; }
84
85 protected:
86 int m_op;
87
88 };
89
90 /*
91 * Set font, brush, text colour
92 *
93 */
94
95 class WXDLLIMPEXP_OGL wxOpSetGDI: public wxDrawOp
96 {
97 public:
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);
101 #if wxUSE_PROLOGIO
102 wxExpr *WriteExpr(wxPseudoMetaFile *image);
103 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
104 #endif
105
106 public:
107 int m_mode;
108 int m_gdiIndex;
109 wxPseudoMetaFile* m_image;
110 unsigned char m_r;
111 unsigned char m_g;
112 unsigned char m_b;
113 };
114
115 /*
116 * Set/destroy clipping
117 *
118 */
119
120 class WXDLLIMPEXP_OGL wxOpSetClipping: public wxDrawOp
121 {
122 public:
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);
128 #if wxUSE_PROLOGIO
129 wxExpr *WriteExpr(wxPseudoMetaFile *image);
130 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
131 #endif
132
133 public:
134 double m_x1;
135 double m_y1;
136 double m_x2;
137 double m_y2;
138 };
139
140 /*
141 * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
142 *
143 */
144
145 class WXDLLIMPEXP_OGL wxOpDraw: public wxDrawOp
146 {
147 public:
148 wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
149 double radius = 0.0, wxChar *s = NULL);
150 ~wxOpDraw();
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);
156 #if wxUSE_PROLOGIO
157 wxExpr *WriteExpr(wxPseudoMetaFile *image);
158 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
159 #endif
160
161 public:
162 double m_x1;
163 double m_y1;
164 double m_x2;
165 double m_y2;
166 double m_x3;
167 double m_y3;
168 double m_radius;
169 wxChar* m_textString;
170
171 };
172
173 /*
174 * Draw polyline, spline, polygon
175 *
176 */
177
178 class WXDLLIMPEXP_OGL wxOpPolyDraw: public wxDrawOp
179 {
180 public:
181 wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints);
182 ~wxOpPolyDraw();
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);
188 #if wxUSE_PROLOGIO
189 wxExpr *WriteExpr(wxPseudoMetaFile *image);
190 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
191 #endif
192
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);
196
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,
202 int attachmentMode);
203
204 public:
205 wxRealPoint* m_points;
206 int m_noPoints;
207
208 };
209
210 #endif
211 // _OGL_DRAWNP_H_
212
213