]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/drawnp.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private header for wxDrawnShape
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _OGL_DRAWNP_H_
13 #define _OGL_DRAWNP_H_
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "drawnp.h"
19 #include <wx/ogl/drawn.h>
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
36 #define DRAWOP_CREATE_PEN 10
37 #define DRAWOP_CREATE_BRUSH 11
38 #define DRAWOP_CREATE_FONT 12
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
58 class wxDrawOp
: public wxObject
61 inline wxDrawOp(int theOp
) { m_op
= theOp
; }
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;
69 virtual wxExpr
*WriteExpr(wxPseudoMetaFile
*image
) = 0;
70 virtual void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
) = 0;
72 inline int GetOp() const { return m_op
; }
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
; }
78 // Get the perimeter point using this data
79 virtual bool GetPerimeterPoint(double x1
, double y1
,
81 double *x3
, double *y3
,
82 double xOffset
, double yOffset
,
92 * Set font, brush, text colour
96 class wxOpSetGDI
: public wxDrawOp
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
);
103 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
104 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
110 wxPseudoMetaFile
* m_image
;
117 * Set/destroy clipping
121 class wxOpSetClipping
: public wxDrawOp
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
);
130 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
131 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
142 * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
146 class wxOpDraw
: public wxDrawOp
149 wxOpDraw(int theOp
, double theX1
, double theY1
, double theX2
, double theY2
,
150 double radius
= 0.0, wxChar
*s
= NULL
);
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
);
158 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
159 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
170 wxChar
* m_textString
;
175 * Draw polyline, spline, polygon
179 class wxOpPolyDraw
: public wxDrawOp
182 wxOpPolyDraw(int theOp
, int n
, wxRealPoint
*thePoints
);
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
);
190 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
191 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
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
);
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
,
206 wxRealPoint
* m_points
;