]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/ogl/oglhelpers.h
some wxUniv docs
[wxWidgets.git] / wxPython / contrib / ogl / oglhelpers.h
CommitLineData
e91a9dfc
RD
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
4c9993c3
RD
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
e91a9dfc
RD
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//---------------------------------------------------------------------------
2f4e9287 99// These are prototypes of some helper functions found in ogl.i
e91a9dfc
RD
100
101wxList* wxPy_wxListHelper(PyObject* pyList, char* className);
102wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList);
2f4e9287 103PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source);
e91a9dfc 104
e91a9dfc
RD
105
106
107//---------------------------------------------------------------------------
108// Classes that derive from the shapes and such, but which know how to turn
109// virtual callbacks into Python callbacks.
110
111class wxPyShapeCanvas : public wxShapeCanvas {
9416aa89 112 DECLARE_DYNAMIC_CLASS(wxPyShapeCanvas);
e91a9dfc
RD
113public:
114 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
b68dc582
RD
115 const wxPoint& pos = wxDefaultPosition,
116 const wxSize& size = wxDefaultSize,
e91a9dfc
RD
117 long style = wxBORDER)
118 : wxShapeCanvas(parent, id, pos, size, style) {}
119
120 DEC_PYCALLBACK__2DBLINT(OnBeginDragLeft);
121 DEC_PYCALLBACK__2DBLINT(OnBeginDragRight);
122 DEC_PYCALLBACK__2DBLINT(OnEndDragLeft);
123 DEC_PYCALLBACK__2DBLINT(OnEndDragRight);
124 DEC_PYCALLBACK__BOOL2DBLINT(OnDragLeft);
125 DEC_PYCALLBACK__BOOL2DBLINT(OnDragRight);
126 DEC_PYCALLBACK__2DBLINT(OnLeftClick);
127 DEC_PYCALLBACK__2DBLINT(OnRightClick);
128
129 PYPRIVATE;
130};
131
132
133
134class wxPyShapeEvtHandler : public wxShapeEvtHandler {
9416aa89 135 DECLARE_DYNAMIC_CLASS(wxPyShapeEvtHandler);
e91a9dfc
RD
136public:
137 wxPyShapeEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL)
138 : wxShapeEvtHandler(prev, shape) {}
139
140 WXSHAPE_DEC_CALLBACKS();
141};
142
143
144class wxPyShape : public wxShape {
9416aa89 145 DECLARE_ABSTRACT_CLASS(wxPyShape);
e91a9dfc
RD
146public:
147 wxPyShape(wxPyShapeCanvas *can = NULL)
148 : wxShape(can) {}
149
150 WXSHAPE_DEC_CALLBACKS();
151
152};
153
154
155class wxPyRectangleShape : public wxRectangleShape {
9416aa89 156 DECLARE_DYNAMIC_CLASS(wxPyRectangleShape);
e91a9dfc
RD
157public:
158 wxPyRectangleShape(double width = 0.0, double height = 0.0)
159 : wxRectangleShape(width, height) {}
160
161 WXSHAPE_DEC_CALLBACKS();
162};
163
2348eaee 164class wxPyControlPoint : public wxControlPoint {
9416aa89 165 DECLARE_DYNAMIC_CLASS(wxPyControlPoint);
2348eaee
RD
166public:
167 wxPyControlPoint(wxPyShapeCanvas *the_canvas = NULL,
168 wxPyShape *object = NULL,
169 double size = 0.0, double the_xoffset = 0.0,
170 double the_yoffset = 0.0, int the_type = 0)
171 : wxControlPoint(the_canvas, object, size,
172 the_xoffset, the_yoffset, the_type) {}
173
174 WXSHAPE_DEC_CALLBACKS();
175};
176
e91a9dfc
RD
177
178
179class wxPyBitmapShape : public wxBitmapShape {
9416aa89 180 DECLARE_DYNAMIC_CLASS(wxPyBitmapShape);
e91a9dfc
RD
181public:
182 wxPyBitmapShape() : wxBitmapShape() {}
183
184 WXSHAPE_DEC_CALLBACKS();
185};
186
187
188
189class wxPyDrawnShape : public wxDrawnShape {
9416aa89 190 DECLARE_DYNAMIC_CLASS(wxPyDrawnShape);
e91a9dfc
RD
191public:
192 wxPyDrawnShape() : wxDrawnShape() {}
193
194 WXSHAPE_DEC_CALLBACKS();
195};
196
197
198class wxPyCompositeShape : public wxCompositeShape {
9416aa89 199 DECLARE_DYNAMIC_CLASS(wxPyCompositeShape);
e91a9dfc
RD
200public:
201 wxPyCompositeShape() : wxCompositeShape() {}
202
203 WXSHAPE_DEC_CALLBACKS();
204};
205
206
207class wxPyDividedShape : public wxDividedShape {
9416aa89 208 DECLARE_DYNAMIC_CLASS(wxPyDividedShape);
e91a9dfc
RD
209public:
210 wxPyDividedShape(double width = 0.0, double height = 0.0)
211 : wxDividedShape(width, height) {}
212
213 WXSHAPE_DEC_CALLBACKS();
214};
215
216
217class wxPyDivisionShape : public wxDivisionShape {
9416aa89 218 DECLARE_DYNAMIC_CLASS(wxPyDivisionShape);
e91a9dfc
RD
219public:
220 wxPyDivisionShape() : wxDivisionShape() {}
221
222 WXSHAPE_DEC_CALLBACKS();
223};
224
225
226class wxPyEllipseShape : public wxEllipseShape {
9416aa89 227 DECLARE_DYNAMIC_CLASS(wxPyEllipseShape);
e91a9dfc
RD
228public:
229 wxPyEllipseShape(double width = 0.0, double height = 0.0)
230 : wxEllipseShape(width, height) {}
231
232 WXSHAPE_DEC_CALLBACKS();
233};
234
235
236class wxPyCircleShape : public wxCircleShape {
9416aa89 237 DECLARE_DYNAMIC_CLASS(wxPyCircleShape);
e91a9dfc
RD
238public:
239 wxPyCircleShape(double width = 0.0)
240 : wxCircleShape(width) {}
241
242 WXSHAPE_DEC_CALLBACKS();
243};
244
245
246class wxPyLineShape : public wxLineShape {
9416aa89 247 DECLARE_DYNAMIC_CLASS(wxPyLineShape);
e91a9dfc
RD
248public:
249 wxPyLineShape() : wxLineShape() {}
250
251 WXSHAPE_DEC_CALLBACKS();
252};
253
254
255class wxPyPolygonShape : public wxPolygonShape {
9416aa89 256 DECLARE_DYNAMIC_CLASS(wxPyPolygonShape);
e91a9dfc
RD
257public:
258 wxPyPolygonShape() : wxPolygonShape() {}
259
260 WXSHAPE_DEC_CALLBACKS();
261};
262
263
264class wxPyTextShape : public wxTextShape {
9416aa89 265 DECLARE_DYNAMIC_CLASS(wxPyTextShape);
e91a9dfc
RD
266public:
267 wxPyTextShape(double width = 0.0, double height = 0.0)
268 : wxTextShape(width, height) {}
269
270 WXSHAPE_DEC_CALLBACKS();
271};
272
273
274
275//---------------------------------------------------------------------------
276//---------------------------------------------------------------------------
277#endif
278
9416aa89 279