]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/ogl/oglshapes2.i
toplevel code transferred to wxTopLevelWindow
[wxWidgets.git] / wxPython / contrib / ogl / oglshapes2.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: oglshapes2.i
3 // Purpose: SWIG definitions for the wxWindows Object Graphics Library
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 3-Sept-1999
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13
14 %module oglshapes2
15
16 %{
17 #include "export.h"
18 #include "oglhelpers.h"
19 %}
20
21 //---------------------------------------------------------------------------
22
23 %include typemaps.i
24 %include my_typemaps.i
25
26 %extern wx.i
27 %import windows.i
28 %extern _defs.i
29 %extern misc.i
30 %extern gdi.i
31
32 %include _ogldefs.i
33
34 %import oglbasic.i
35 %import oglshapes.i
36
37
38 %pragma(python) code = "import wx"
39
40 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
42 %{
43 WXSHAPE_IMP_CALLBACKS(wxPyEllipseShape, wxEllipseShape);
44 %}
45
46 class wxPyEllipseShape : public wxPyShape {
47 public:
48 wxPyEllipseShape(double width = 0.0, double height = 0.0);
49
50 void _setCallbackInfo(PyObject* self, PyObject* _class);
51 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyEllipseShape)"
52 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
53
54 void base_OnDraw(wxDC& dc);
55 void base_OnDrawContents(wxDC& dc);
56 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
57 void base_OnMoveLinks(wxDC& dc);
58 void base_OnErase(wxDC& dc);
59 void base_OnEraseContents(wxDC& dc);
60 void base_OnHighlight(wxDC& dc);
61 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
62 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
63 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
64 void base_OnSize(double x, double y);
65 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
66 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
67 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
68 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
69 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
70 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
71 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
72 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
73 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
74 void base_OnDrawControlPoints(wxDC& dc);
75 void base_OnEraseControlPoints(wxDC& dc);
76 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
77 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
78 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
79 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
80 void base_OnBeginSize(double w, double h);
81 void base_OnEndSize(double w, double h);
82 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
83 };
84
85 //---------------------------------------------------------------------------
86 %{
87 WXSHAPE_IMP_CALLBACKS(wxPyCircleShape, wxCircleShape);
88 %}
89
90 class wxPyCircleShape : public wxPyEllipseShape {
91 public:
92 wxPyCircleShape(double width = 0.0);
93
94 void _setCallbackInfo(PyObject* self, PyObject* _class);
95 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyCircleShape)"
96 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
97
98 void base_OnDraw(wxDC& dc);
99 void base_OnDrawContents(wxDC& dc);
100 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
101 void base_OnMoveLinks(wxDC& dc);
102 void base_OnErase(wxDC& dc);
103 void base_OnEraseContents(wxDC& dc);
104 void base_OnHighlight(wxDC& dc);
105 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
106 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
107 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
108 void base_OnSize(double x, double y);
109 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
110 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
111 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
112 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
113 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
114 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
115 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
116 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
117 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
118 void base_OnDrawControlPoints(wxDC& dc);
119 void base_OnEraseControlPoints(wxDC& dc);
120 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
121 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
122 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
123 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
124 void base_OnBeginSize(double w, double h);
125 void base_OnEndSize(double w, double h);
126 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
127 };
128 //---------------------------------------------------------------------------
129 //---------------------------------------------------------------------------
130 class wxArrowHead : public wxObject {
131 public:
132 wxArrowHead(int type = 0,
133 int end = 0,
134 double size = 0.0,
135 double dist = 0.0,
136 const char * name = "",
137 wxPseudoMetaFile *mf = NULL,
138 long arrowId = -1);
139 ~wxArrowHead();
140
141 int _GetType();
142 int GetPosition();
143 void SetPosition(int pos);
144 double GetXOffset();
145 double GetYOffset();
146 double GetSpacing();
147 double GetSize();
148 wxString GetName();
149 void SetXOffset(double x);
150 void SetYOffset(double y);
151 wxPseudoMetaFile *GetMetaFile();
152 long GetId();
153 int GetArrowEnd();
154 double GetArrowSize();
155 void SetSize(double size);
156 void SetSpacing(double sp);
157 };
158 //---------------------------------------------------------------------------
159 %{
160 WXSHAPE_IMP_CALLBACKS(wxPyLineShape, wxLineShape);
161 %}
162
163 class wxPyLineShape : public wxPyShape {
164 public:
165 wxPyLineShape();
166
167 void _setCallbackInfo(PyObject* self, PyObject* _class);
168 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyLineShape)"
169 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
170
171 void AddArrow(int type, int end = ARROW_POSITION_END,
172 double arrowSize = 10.0, double xOffset = 0.0,
173 char* name = "", wxPseudoMetaFile *mf = NULL,
174 long arrowId = -1);
175
176 //void AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int end);
177 %addmethods {
178 void AddArrowOrdered(wxArrowHead *arrow, PyObject* referenceList, int end) {
179 wxList* list = wxPy_wxListHelper(referenceList, "_wxArrowHead_p");
180 self->AddArrowOrdered(arrow, *list, end);
181 delete list;
182 }
183 }
184 bool ClearArrow(const wxString& name);
185 void ClearArrowsAtPosition(int position = -1);
186 void DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool proportionalOffset);
187 %name(DeleteArrowHeadId)bool DeleteArrowHead(long arrowId);
188 bool DeleteArrowHead(int position, const wxString& name);
189 bool DeleteLineControlPoint();
190 void DrawArrows(wxDC& dc);
191 void DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
192 void EraseRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
193 %name(FindArrowHeadId)wxArrowHead * FindArrowHead(long arrowId);
194 wxArrowHead * FindArrowHead(int position, const wxString& name);
195 void FindLineEndPoints(double *OUTPUT, double *OUTPUT,
196 double *OUTPUT, double *OUTPUT);
197 int FindLinePosition(double x, double y);
198 double FindMinimumWidth();
199 void FindNth(wxPyShape *image, int *OUTPUT, int *OUTPUT, bool incoming);
200 int GetAttachmentFrom();
201 int GetAttachmentTo();
202 void GetEnds(double *OUTPUT, double *OUTPUT, double *OUTPUT, double *OUTPUT);
203 wxPyShape * GetFrom();
204 void GetLabelPosition(int position, double *OUTPUT, double *OUTPUT);
205 wxPoint * GetNextControlPoint(wxPyShape *shape);
206 wxPyShape * GetTo();
207 void Initialise();
208 void InsertLineControlPoint(wxDC* dc);
209 bool IsEnd(wxPyShape *shape);
210 bool IsSpline();
211 void MakeLineControlPoints(int n);
212
213 // inline wxList *GetLineControlPoints() { return m_lineControlPoints; }
214 %addmethods {
215 PyObject* GetLineControlPoints() {
216 wxList* list = self->GetLineControlPoints();
217 return wxPy_ConvertList(list, "wxPyControlPoint");
218 }
219 }
220
221 void SetAttachmentFrom(int fromAttach);
222 void SetAttachments(int fromAttach, int toAttach);
223 void SetAttachmentTo(int toAttach);
224 void SetEnds(double x1, double y1, double x2, double y2);
225 void SetFrom(wxPyShape *object);
226 void SetIgnoreOffsets(bool ignore);
227 void SetSpline(bool spline);
228 void SetTo(wxPyShape *object);
229 void Straighten(wxDC* dc = NULL);
230 void Unlink();
231
232
233 void base_OnDraw(wxDC& dc);
234 void base_OnDrawContents(wxDC& dc);
235 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
236 void base_OnMoveLinks(wxDC& dc);
237 void base_OnErase(wxDC& dc);
238 void base_OnEraseContents(wxDC& dc);
239 void base_OnHighlight(wxDC& dc);
240 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
241 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
242 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
243 void base_OnSize(double x, double y);
244 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
245 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
246 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
247 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
248 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
249 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
250 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
251 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
252 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
253 void base_OnDrawControlPoints(wxDC& dc);
254 void base_OnEraseControlPoints(wxDC& dc);
255 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
256 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
257 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
258 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
259 void base_OnBeginSize(double w, double h);
260 void base_OnEndSize(double w, double h);
261 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
262 };
263
264 //---------------------------------------------------------------------------
265 %{
266 WXSHAPE_IMP_CALLBACKS(wxPyPolygonShape, wxPolygonShape);
267 %}
268
269 class wxPyPolygonShape : public wxPyShape {
270 public:
271 wxPyPolygonShape();
272
273 void _setCallbackInfo(PyObject* self, PyObject* _class);
274 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPolygonShape)"
275 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
276
277
278 // void Create(wxList* points);
279 %addmethods {
280 PyObject* Create(PyObject* points) {
281 wxList* list = wxPy_wxRealPoint_ListHelper(points);
282 if (list) {
283 self->Create(list);
284 Py_INCREF(Py_None);
285 return Py_None;
286 }
287 else return NULL;
288 }
289 }
290
291 void AddPolygonPoint(int pos = 0);
292 void CalculatePolygonCentre();
293 void DeletePolygonPoint(int pos = 0);
294
295 // wxList* GetPoints();
296 %addmethods {
297 PyObject* GetPoints() {
298 wxList* list = self->GetPoints();
299 return wxPy_ConvertList(list, "wxRealPoint");
300 }
301 }
302
303 void UpdateOriginalPoints();
304
305
306 void base_OnDraw(wxDC& dc);
307 void base_OnDrawContents(wxDC& dc);
308 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
309 void base_OnMoveLinks(wxDC& dc);
310 void base_OnErase(wxDC& dc);
311 void base_OnEraseContents(wxDC& dc);
312 void base_OnHighlight(wxDC& dc);
313 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
314 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
315 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
316 void base_OnSize(double x, double y);
317 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
318 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
319 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
320 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
321 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
322 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
323 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
324 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
325 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
326 void base_OnDrawControlPoints(wxDC& dc);
327 void base_OnEraseControlPoints(wxDC& dc);
328 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
329 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
330 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
331 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
332 void base_OnBeginSize(double w, double h);
333 void base_OnEndSize(double w, double h);
334 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
335 };
336 //---------------------------------------------------------------------------
337 %{
338 WXSHAPE_IMP_CALLBACKS(wxPyTextShape, wxTextShape);
339 %}
340
341 class wxPyTextShape : public wxPyRectangleShape {
342 public:
343 wxPyTextShape(double width = 0.0, double height = 0.0);
344
345 void _setCallbackInfo(PyObject* self, PyObject* _class);
346 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyTextShape)"
347 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
348
349
350 void base_OnDelete();
351 void base_OnDraw(wxDC& dc);
352 void base_OnDrawContents(wxDC& dc);
353 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
354 void base_OnMoveLinks(wxDC& dc);
355 void base_OnErase(wxDC& dc);
356 void base_OnEraseContents(wxDC& dc);
357 void base_OnHighlight(wxDC& dc);
358 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
359 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
360 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
361 void base_OnSize(double x, double y);
362 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
363 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
364 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
365 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
366 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
367 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
368 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
369 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
370 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
371 void base_OnDrawControlPoints(wxDC& dc);
372 void base_OnEraseControlPoints(wxDC& dc);
373 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
374 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
375 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
376 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
377 void base_OnBeginSize(double w, double h);
378 void base_OnEndSize(double w, double h);
379 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
380
381 };
382 //---------------------------------------------------------------------------