]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/ogl/oglhelpers.h
Update with recent changes.
[wxWidgets.git] / wxPython / contrib / ogl / oglhelpers.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: oglhelpers.h
3 // Purpose: Some Helper functions to help in data conversions in OGL
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 9-Sept-1999
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef __wxp_ogl_helpers__
14 #define __wxp_ogl_helpers__
15
16
17 #include <wx/ogl/ogl.h>
18 #include <wx/ogl/basicp.h>
19 #include <wx/ogl/constrnt.h>
20 #include <wx/ogl/bmpshape.h>
21 #include <wx/ogl/drawn.h>
22
23
24 //---------------------------------------------------------------------------
25 // Define a macro that will be used in the class definintions below
26
27 #define WXSHAPE_DEC_CALLBACKS() \
28 DEC_PYCALLBACK__ (OnDelete); \
29 DEC_PYCALLBACK__DC (OnDraw); \
30 DEC_PYCALLBACK__DC (OnDrawContents); \
31 DEC_PYCALLBACK__DCBOOL (OnDrawBranches); \
32 DEC_PYCALLBACK__DC (OnMoveLinks); \
33 DEC_PYCALLBACK__DC (OnErase); \
34 DEC_PYCALLBACK__DC (OnEraseContents); \
35 DEC_PYCALLBACK__DC (OnHighlight); \
36 DEC_PYCALLBACK__2DBL2INT (OnLeftClick); \
37 DEC_PYCALLBACK__2DBL2INT (OnLeftDoubleClick); \
38 DEC_PYCALLBACK__2DBL2INT (OnRightClick); \
39 DEC_PYCALLBACK__2DBL (OnSize); \
40 DEC_PYCALLBACK_BOOL_DC4DBLBOOL (OnMovePre); \
41 DEC_PYCALLBACK__DC4DBLBOOL (OnMovePost); \
42 DEC_PYCALLBACK__BOOL2DBL2INT (OnDragLeft); \
43 DEC_PYCALLBACK__2DBL2INT (OnBeginDragLeft); \
44 DEC_PYCALLBACK__2DBL2INT (OnEndDragLeft); \
45 DEC_PYCALLBACK__BOOL2DBL2INT (OnDragRight); \
46 DEC_PYCALLBACK__2DBL2INT (OnBeginDragRight); \
47 DEC_PYCALLBACK__2DBL2INT (OnEndDragRight); \
48 DEC_PYCALLBACK__DC4DBL (OnDrawOutline); \
49 DEC_PYCALLBACK__DC (OnDrawControlPoints); \
50 DEC_PYCALLBACK__DC (OnEraseControlPoints); \
51 DEC_PYCALLBACK__DCBOOL (OnMoveLink); \
52 DEC_PYCALLBACK__WXCPBOOL2DBL2INT(OnSizingDragLeft); \
53 DEC_PYCALLBACK__WXCP2DBL2INT (OnSizingBeginDragLeft);\
54 DEC_PYCALLBACK__WXCP2DBL2INT (OnSizingEndDragLeft); \
55 DEC_PYCALLBACK__2DBL (OnBeginSize); \
56 DEC_PYCALLBACK__2DBL (OnEndSize); \
57 \
58 PYPRIVATE;
59
60
61 #define WXSHAPE_IMP_CALLBACKS(CLASS, PARENT) \
62 IMP_PYCALLBACK__ (CLASS, PARENT, OnDelete); \
63 IMP_PYCALLBACK__DC (CLASS, PARENT, OnDraw); \
64 IMP_PYCALLBACK__DC (CLASS, PARENT, OnDrawContents); \
65 IMP_PYCALLBACK__DCBOOL (CLASS, PARENT, OnDrawBranches); \
66 IMP_PYCALLBACK__DC (CLASS, PARENT, OnMoveLinks); \
67 IMP_PYCALLBACK__DC (CLASS, PARENT, OnErase); \
68 IMP_PYCALLBACK__DC (CLASS, PARENT, OnEraseContents); \
69 IMP_PYCALLBACK__DC (CLASS, PARENT, OnHighlight); \
70 IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnLeftClick); \
71 IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnLeftDoubleClick); \
72 IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnRightClick); \
73 IMP_PYCALLBACK__2DBL (CLASS, PARENT, OnSize); \
74 IMP_PYCALLBACK_BOOL_DC4DBLBOOL (CLASS, PARENT, OnMovePre); \
75 IMP_PYCALLBACK__DC4DBLBOOL (CLASS, PARENT, OnMovePost); \
76 IMP_PYCALLBACK__BOOL2DBL2INT (CLASS, PARENT, OnDragLeft); \
77 IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnBeginDragLeft); \
78 IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnEndDragLeft); \
79 IMP_PYCALLBACK__BOOL2DBL2INT (CLASS, PARENT, OnDragRight); \
80 IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnBeginDragRight); \
81 IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnEndDragRight); \
82 IMP_PYCALLBACK__DC4DBL (CLASS, PARENT, OnDrawOutline); \
83 IMP_PYCALLBACK__DC (CLASS, PARENT, OnDrawControlPoints); \
84 IMP_PYCALLBACK__DC (CLASS, PARENT, OnEraseControlPoints); \
85 IMP_PYCALLBACK__DCBOOL (CLASS, PARENT, OnMoveLink); \
86 IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PARENT, OnSizingDragLeft); \
87 IMP_PYCALLBACK__WXCP2DBL2INT (CLASS, PARENT, OnSizingBeginDragLeft);\
88 IMP_PYCALLBACK__WXCP2DBL2INT (CLASS, PARENT, OnSizingEndDragLeft); \
89 IMP_PYCALLBACK__2DBL (CLASS, PARENT, OnBeginSize); \
90 IMP_PYCALLBACK__2DBL (CLASS, PARENT, OnEndSize); \
91
92
93 // This one may be difficult...
94 //PYCALLBACK__??????? (PARENT, OnChangeAttachment);
95
96
97
98 //---------------------------------------------------------------------------
99 // These are prototypes of some helper functions found in ogl.i
100
101 wxList* wxPy_wxListHelper(PyObject* pyList, char* className);
102 wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList);
103 PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source);
104 PyObject* wxPy_ConvertShapeList(wxListBase* list, const char* className);
105
106
107
108 //---------------------------------------------------------------------------
109 // Classes that derive from the shapes and such, but which know how to turn
110 // virtual callbacks into Python callbacks.
111
112 class wxPyShapeCanvas : public wxShapeCanvas {
113 DECLARE_DYNAMIC_CLASS(wxPyShapeCanvas);
114 public:
115 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
116 const wxPoint& pos = wxDefaultPosition,
117 const wxSize& size = wxDefaultSize,
118 long style = wxBORDER,
119 const wxString& name = wxT("shapeCanvas"))
120 : wxShapeCanvas(parent, id, pos, size, style, name) {}
121
122 DEC_PYCALLBACK__2DBLINT(OnBeginDragLeft);
123 DEC_PYCALLBACK__2DBLINT(OnBeginDragRight);
124 DEC_PYCALLBACK__2DBLINT(OnEndDragLeft);
125 DEC_PYCALLBACK__2DBLINT(OnEndDragRight);
126 DEC_PYCALLBACK__BOOL2DBLINT(OnDragLeft);
127 DEC_PYCALLBACK__BOOL2DBLINT(OnDragRight);
128 DEC_PYCALLBACK__2DBLINT(OnLeftClick);
129 DEC_PYCALLBACK__2DBLINT(OnRightClick);
130
131 PYPRIVATE;
132 };
133
134
135
136 class wxPyShapeEvtHandler : public wxShapeEvtHandler {
137 DECLARE_DYNAMIC_CLASS(wxPyShapeEvtHandler);
138 public:
139 wxPyShapeEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL)
140 : wxShapeEvtHandler(prev, shape) {}
141
142 WXSHAPE_DEC_CALLBACKS();
143 };
144
145
146 class wxPyShape : public wxShape {
147 DECLARE_ABSTRACT_CLASS(wxPyShape);
148 public:
149 wxPyShape(wxPyShapeCanvas *can = NULL)
150 : wxShape(can) {}
151
152 WXSHAPE_DEC_CALLBACKS();
153
154 };
155
156
157 class wxPyRectangleShape : public wxRectangleShape {
158 DECLARE_DYNAMIC_CLASS(wxPyRectangleShape);
159 public:
160 wxPyRectangleShape(double width = 0.0, double height = 0.0)
161 : wxRectangleShape(width, height) {}
162
163 WXSHAPE_DEC_CALLBACKS();
164 };
165
166 class wxPyControlPoint : public wxControlPoint {
167 DECLARE_DYNAMIC_CLASS(wxPyControlPoint);
168 public:
169 wxPyControlPoint(wxPyShapeCanvas *the_canvas = NULL,
170 wxPyShape *object = NULL,
171 double size = 0.0, double the_xoffset = 0.0,
172 double the_yoffset = 0.0, int the_type = 0)
173 : wxControlPoint(the_canvas, object, size,
174 the_xoffset, the_yoffset, the_type) {}
175
176 WXSHAPE_DEC_CALLBACKS();
177 };
178
179
180
181 class wxPyBitmapShape : public wxBitmapShape {
182 DECLARE_DYNAMIC_CLASS(wxPyBitmapShape);
183 public:
184 wxPyBitmapShape() : wxBitmapShape() {}
185
186 WXSHAPE_DEC_CALLBACKS();
187 };
188
189
190
191 class wxPyDrawnShape : public wxDrawnShape {
192 DECLARE_DYNAMIC_CLASS(wxPyDrawnShape);
193 public:
194 wxPyDrawnShape() : wxDrawnShape() {}
195
196 WXSHAPE_DEC_CALLBACKS();
197 };
198
199
200 class wxPyCompositeShape : public wxCompositeShape {
201 DECLARE_DYNAMIC_CLASS(wxPyCompositeShape);
202 public:
203 wxPyCompositeShape() : wxCompositeShape() {}
204
205 WXSHAPE_DEC_CALLBACKS();
206 };
207
208
209 class wxPyDividedShape : public wxDividedShape {
210 DECLARE_DYNAMIC_CLASS(wxPyDividedShape);
211 public:
212 wxPyDividedShape(double width = 0.0, double height = 0.0)
213 : wxDividedShape(width, height) {}
214
215 WXSHAPE_DEC_CALLBACKS();
216 };
217
218
219 class wxPyDivisionShape : public wxDivisionShape {
220 DECLARE_DYNAMIC_CLASS(wxPyDivisionShape);
221 public:
222 wxPyDivisionShape() : wxDivisionShape() {}
223
224 WXSHAPE_DEC_CALLBACKS();
225 };
226
227
228 class wxPyEllipseShape : public wxEllipseShape {
229 DECLARE_DYNAMIC_CLASS(wxPyEllipseShape);
230 public:
231 wxPyEllipseShape(double width = 0.0, double height = 0.0)
232 : wxEllipseShape(width, height) {}
233
234 WXSHAPE_DEC_CALLBACKS();
235 };
236
237
238 class wxPyCircleShape : public wxCircleShape {
239 DECLARE_DYNAMIC_CLASS(wxPyCircleShape);
240 public:
241 wxPyCircleShape(double width = 0.0)
242 : wxCircleShape(width) {}
243
244 WXSHAPE_DEC_CALLBACKS();
245 };
246
247
248 class wxPyLineShape : public wxLineShape {
249 DECLARE_DYNAMIC_CLASS(wxPyLineShape);
250 public:
251 wxPyLineShape() : wxLineShape() {}
252
253 WXSHAPE_DEC_CALLBACKS();
254 };
255
256
257 class wxPyPolygonShape : public wxPolygonShape {
258 DECLARE_DYNAMIC_CLASS(wxPyPolygonShape);
259 public:
260 wxPyPolygonShape() : wxPolygonShape() {}
261
262 WXSHAPE_DEC_CALLBACKS();
263 };
264
265
266 class wxPyTextShape : public wxTextShape {
267 DECLARE_DYNAMIC_CLASS(wxPyTextShape);
268 public:
269 wxPyTextShape(double width = 0.0, double height = 0.0)
270 : wxTextShape(width, height) {}
271
272 WXSHAPE_DEC_CALLBACKS();
273 };
274
275
276
277 //---------------------------------------------------------------------------
278 //---------------------------------------------------------------------------
279 #endif
280
281