]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/modules/ogl/oglhelpers.h
wxPython module for OGL added.
[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
103PyObject* wxPy_ConvertList(wxList* list, char* className);
104
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 {
112public:
113 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
114 const wxPoint& pos = wxPyDefaultPosition,
115 const wxSize& size = wxPyDefaultSize,
116 long style = wxBORDER)
117 : wxShapeCanvas(parent, id, pos, size, style) {}
118
119 DEC_PYCALLBACK__2DBLINT(OnBeginDragLeft);
120 DEC_PYCALLBACK__2DBLINT(OnBeginDragRight);
121 DEC_PYCALLBACK__2DBLINT(OnEndDragLeft);
122 DEC_PYCALLBACK__2DBLINT(OnEndDragRight);
123 DEC_PYCALLBACK__BOOL2DBLINT(OnDragLeft);
124 DEC_PYCALLBACK__BOOL2DBLINT(OnDragRight);
125 DEC_PYCALLBACK__2DBLINT(OnLeftClick);
126 DEC_PYCALLBACK__2DBLINT(OnRightClick);
127
128 PYPRIVATE;
129};
130
131
132
133class wxPyShapeEvtHandler : public wxShapeEvtHandler {
134public:
135 wxPyShapeEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL)
136 : wxShapeEvtHandler(prev, shape) {}
137
138 WXSHAPE_DEC_CALLBACKS();
139};
140
141
142class wxPyShape : public wxShape {
143public:
144 wxPyShape(wxPyShapeCanvas *can = NULL)
145 : wxShape(can) {}
146
147 WXSHAPE_DEC_CALLBACKS();
148
149};
150
151
152class wxPyRectangleShape : public wxRectangleShape {
153public:
154 wxPyRectangleShape(double width = 0.0, double height = 0.0)
155 : wxRectangleShape(width, height) {}
156
157 WXSHAPE_DEC_CALLBACKS();
158};
159
160
161
162class wxPyBitmapShape : public wxBitmapShape {
163public:
164 wxPyBitmapShape() : wxBitmapShape() {}
165
166 WXSHAPE_DEC_CALLBACKS();
167};
168
169
170
171class wxPyDrawnShape : public wxDrawnShape {
172public:
173 wxPyDrawnShape() : wxDrawnShape() {}
174
175 WXSHAPE_DEC_CALLBACKS();
176};
177
178
179class wxPyCompositeShape : public wxCompositeShape {
180public:
181 wxPyCompositeShape() : wxCompositeShape() {}
182
183 WXSHAPE_DEC_CALLBACKS();
184};
185
186
187class wxPyDividedShape : public wxDividedShape {
188public:
189 wxPyDividedShape(double width = 0.0, double height = 0.0)
190 : wxDividedShape(width, height) {}
191
192 WXSHAPE_DEC_CALLBACKS();
193};
194
195
196class wxPyDivisionShape : public wxDivisionShape {
197public:
198 wxPyDivisionShape() : wxDivisionShape() {}
199
200 WXSHAPE_DEC_CALLBACKS();
201};
202
203
204class wxPyEllipseShape : public wxEllipseShape {
205public:
206 wxPyEllipseShape(double width = 0.0, double height = 0.0)
207 : wxEllipseShape(width, height) {}
208
209 WXSHAPE_DEC_CALLBACKS();
210};
211
212
213class wxPyCircleShape : public wxCircleShape {
214public:
215 wxPyCircleShape(double width = 0.0)
216 : wxCircleShape(width) {}
217
218 WXSHAPE_DEC_CALLBACKS();
219};
220
221
222class wxPyLineShape : public wxLineShape {
223public:
224 wxPyLineShape() : wxLineShape() {}
225
226 WXSHAPE_DEC_CALLBACKS();
227};
228
229
230class wxPyPolygonShape : public wxPolygonShape {
231public:
232 wxPyPolygonShape() : wxPolygonShape() {}
233
234 WXSHAPE_DEC_CALLBACKS();
235};
236
237
238class wxPyTextShape : public wxTextShape {
239public:
240 wxPyTextShape(double width = 0.0, double height = 0.0)
241 : wxTextShape(width, height) {}
242
243 WXSHAPE_DEC_CALLBACKS();
244};
245
246
247
248//---------------------------------------------------------------------------
249//---------------------------------------------------------------------------
250#endif
251