]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/drawnp.h
Added files so sample links
[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 #include <wx/ogl/drawn.h>
20
21 /*
22 * Drawing operations
23 *
24 */
25
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 */
57
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;
68 #if wxUSE_PROLOGIO
69 virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0;
70 virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0;
71 #endif
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 */
95
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);
102 #if wxUSE_PROLOGIO
103 wxExpr *WriteExpr(wxPseudoMetaFile *image);
104 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
105 #endif
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 */
120
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);
129 #if wxUSE_PROLOGIO
130 wxExpr *WriteExpr(wxPseudoMetaFile *image);
131 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
132 #endif
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 */
145
146 class wxOpDraw: public wxDrawOp
147 {
148 public:
149 wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
150 double radius = 0.0, wxChar *s = NULL);
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);
157 #if wxUSE_PROLOGIO
158 wxExpr *WriteExpr(wxPseudoMetaFile *image);
159 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
160 #endif
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;
170 wxChar* m_textString;
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);
189 #if wxUSE_PROLOGIO
190 wxExpr *WriteExpr(wxPseudoMetaFile *image);
191 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
192 #endif
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;
208
209 };
210
211 #endif
212 // _OGL_DRAWNP_H_
213
214