]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/drawnp.h
added xmlres format docs (uncomplete)
[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 #ifdef __GNUG__
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 virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0;
69 virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0;
70
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 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 wxExpr *WriteExpr(wxPseudoMetaFile *image);
102 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
103
104 public:
105 int m_mode;
106 int m_gdiIndex;
107 wxPseudoMetaFile* m_image;
108 unsigned char m_r;
109 unsigned char m_g;
110 unsigned char m_b;
111 };
112
113 /*
114 * Set/destroy clipping
115 *
116 */
117
118 class wxOpSetClipping: public wxDrawOp
119 {
120 public:
121 wxOpSetClipping(int theOp, double theX1, double theY1, double theX2, double theY2);
122 void Do(wxDC& dc, double xoffset, double yoffset);
123 void Scale(double xScale, double yScale);
124 void Translate(double x, double y);
125 wxDrawOp *Copy(wxPseudoMetaFile *newImage);
126 wxExpr *WriteExpr(wxPseudoMetaFile *image);
127 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
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 */
140
141 class wxOpDraw: public wxDrawOp
142 {
143 public:
144 wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
145 double radius = 0.0, char *s = NULL);
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);
152 wxExpr *WriteExpr(wxPseudoMetaFile *image);
153 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
154
155 public:
156 double m_x1;
157 double m_y1;
158 double m_x2;
159 double m_y2;
160 double m_x3;
161 double m_y3;
162 double m_radius;
163 char* m_textString;
164
165 };
166
167 /*
168 * Draw polyline, spline, polygon
169 *
170 */
171
172 class wxOpPolyDraw: public wxDrawOp
173 {
174 public:
175 wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints);
176 ~wxOpPolyDraw();
177 void Do(wxDC& dc, double xoffset, double yoffset);
178 void Scale(double scaleX, double scaleY);
179 void Translate(double x, double y);
180 void Rotate(double x, double y, double theta, double sinTheta, double cosTheta);
181 wxDrawOp *Copy(wxPseudoMetaFile *newImage);
182 wxExpr *WriteExpr(wxPseudoMetaFile *image);
183 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
184
185 // Draw an outline using the current operation.
186 virtual bool OnDrawOutline(wxDC& dc, double x, double y, double w, double h,
187 double oldW, double oldH);
188
189 // Get the perimeter point using this data
190 bool GetPerimeterPoint(double x1, double y1,
191 double x2, double y2,
192 double *x3, double *y3,
193 double xOffset, double yOffset,
194 int attachmentMode);
195
196 public:
197 wxRealPoint* m_points;
198 int m_noPoints;
199
200 };
201
202 #endif
203 // _OGL_DRAWNP_H_
204
205