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