]> git.saurik.com Git - wxWidgets.git/blame_incremental - contrib/include/wx/ogl/drawnp.h
more const correctness (slightly modified patch 1655991)
[wxWidgets.git] / contrib / include / wx / ogl / drawnp.h
... / ...
CommitLineData
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
16/*
17 * Drawing operations
18 *
19 */
20
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 */
52
53class WXDLLIMPEXP_OGL wxDrawOp: public wxObject
54{
55public:
56 inline wxDrawOp(int theOp) { m_op = theOp; }
57 inline ~wxDrawOp() {}
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)) {};
61 virtual void Do(wxDC& dc, double xoffset, double yoffset) = 0;
62 virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0;
63#if wxUSE_PROLOGIO
64 virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0;
65 virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0;
66#endif
67 inline int GetOp() const { return m_op; }
68
69 // Draw an outline using the current operation. By default, return false (not drawn)
70 virtual bool OnDrawOutline(wxDC& WXUNUSED(dc), double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(w), double WXUNUSED(h),
71 double WXUNUSED(oldW), double WXUNUSED(oldH)) { return false; }
72
73 // Get the perimeter point using this data
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))
79 { return false; }
80
81protected:
82 int m_op;
83
84};
85
86/*
87 * Set font, brush, text colour
88 *
89 */
90
91class WXDLLIMPEXP_OGL wxOpSetGDI: public wxDrawOp
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);
97#if wxUSE_PROLOGIO
98 wxExpr *WriteExpr(wxPseudoMetaFile *image);
99 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
100#endif
101
102public:
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 */
115
116class WXDLLIMPEXP_OGL wxOpSetClipping: public wxDrawOp
117{
118public:
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);
124#if wxUSE_PROLOGIO
125 wxExpr *WriteExpr(wxPseudoMetaFile *image);
126 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
127#endif
128
129public:
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
141class WXDLLIMPEXP_OGL wxOpDraw: public wxDrawOp
142{
143 public:
144 wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
145 double radius = 0.0, const wxString& s = wxEmptyString);
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#if wxUSE_PROLOGIO
153 wxExpr *WriteExpr(wxPseudoMetaFile *image);
154 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
155#endif
156
157public:
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;
165 wxString m_textString;
166
167};
168
169/*
170 * Draw polyline, spline, polygon
171 *
172 */
173
174class WXDLLIMPEXP_OGL wxOpPolyDraw: public wxDrawOp
175{
176public:
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);
184#if wxUSE_PROLOGIO
185 wxExpr *WriteExpr(wxPseudoMetaFile *image);
186 void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
187#endif
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
200public:
201 wxRealPoint* m_points;
202 int m_noPoints;
203
204};
205
206#endif
207 // _OGL_DRAWNP_H_
208
209