1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for the wxWindows Object Graphics Library
7 // Created: 3-Sept-1999
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include "oglhelpers.h"
21 //---------------------------------------------------------------------------
24 %include my_typemaps.i
38 %pragma(python) code = "import wx"
40 //---------------------------------------------------------------------------
43 // Put some wx default wxChar* values into wxStrings.
44 static const wxString wxPyEmptyString(wxT(""));
47 //---------------------------------------------------------------------------
50 WXSHAPE_IMP_CALLBACKS(wxPyEllipseShape, wxEllipseShape);
53 class wxPyEllipseShape : public wxPyShape {
55 wxPyEllipseShape(double width = 0.0, double height = 0.0);
57 void _setCallbackInfo(PyObject* self, PyObject* _class);
58 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyEllipseShape)"
59 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
61 void base_OnDraw(wxDC& dc);
62 void base_OnDrawContents(wxDC& dc);
63 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
64 void base_OnMoveLinks(wxDC& dc);
65 void base_OnErase(wxDC& dc);
66 void base_OnEraseContents(wxDC& dc);
67 void base_OnHighlight(wxDC& dc);
68 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
69 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
70 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
71 void base_OnSize(double x, double y);
72 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
73 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
74 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
75 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
76 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
77 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
78 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
79 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
80 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
81 void base_OnDrawControlPoints(wxDC& dc);
82 void base_OnEraseControlPoints(wxDC& dc);
83 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
84 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
85 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
86 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
87 void base_OnBeginSize(double w, double h);
88 void base_OnEndSize(double w, double h);
89 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
92 //---------------------------------------------------------------------------
94 WXSHAPE_IMP_CALLBACKS(wxPyCircleShape, wxCircleShape);
97 class wxPyCircleShape : public wxPyEllipseShape {
99 wxPyCircleShape(double width = 0.0);
101 void _setCallbackInfo(PyObject* self, PyObject* _class);
102 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyCircleShape)"
103 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
105 void base_OnDraw(wxDC& dc);
106 void base_OnDrawContents(wxDC& dc);
107 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
108 void base_OnMoveLinks(wxDC& dc);
109 void base_OnErase(wxDC& dc);
110 void base_OnEraseContents(wxDC& dc);
111 void base_OnHighlight(wxDC& dc);
112 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
113 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
114 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
115 void base_OnSize(double x, double y);
116 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
117 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
118 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
119 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
120 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
121 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
122 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
123 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
124 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
125 void base_OnDrawControlPoints(wxDC& dc);
126 void base_OnEraseControlPoints(wxDC& dc);
127 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
128 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
129 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
130 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
131 void base_OnBeginSize(double w, double h);
132 void base_OnEndSize(double w, double h);
133 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
135 //---------------------------------------------------------------------------
136 //---------------------------------------------------------------------------
137 class wxArrowHead : public wxObject {
139 wxArrowHead(int type = 0,
143 const wxString& name = wxPyEmptyString,
144 wxPseudoMetaFile *mf = NULL,
150 void SetPosition(int pos);
156 void SetXOffset(double x);
157 void SetYOffset(double y);
158 wxPseudoMetaFile *GetMetaFile();
161 double GetArrowSize();
162 void SetSize(double size);
163 void SetSpacing(double sp);
165 //---------------------------------------------------------------------------
167 WXSHAPE_IMP_CALLBACKS(wxPyLineShape, wxLineShape);
170 class wxPyLineShape : public wxPyShape {
174 void _setCallbackInfo(PyObject* self, PyObject* _class);
175 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyLineShape)"
176 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
178 void AddArrow(int type, int end = ARROW_POSITION_END,
179 double arrowSize = 10.0, double xOffset = 0.0,
180 const wxString& name = wxPyEmptyString, wxPseudoMetaFile *mf = NULL,
183 //void AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int end);
185 void AddArrowOrdered(wxArrowHead *arrow, PyObject* referenceList, int end) {
186 wxList* list = wxPy_wxListHelper(referenceList, "_wxArrowHead_p");
187 self->AddArrowOrdered(arrow, *list, end);
191 bool ClearArrow(const wxString& name);
192 void ClearArrowsAtPosition(int position = -1);
193 void DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool proportionalOffset);
194 %name(DeleteArrowHeadId)bool DeleteArrowHead(long arrowId);
195 bool DeleteArrowHead(int position, const wxString& name);
196 bool DeleteLineControlPoint();
197 void DrawArrows(wxDC& dc);
198 void DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
199 void EraseRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
200 %name(FindArrowHeadId)wxArrowHead * FindArrowHead(long arrowId);
201 wxArrowHead * FindArrowHead(int position, const wxString& name);
202 void FindLineEndPoints(double *OUTPUT, double *OUTPUT,
203 double *OUTPUT, double *OUTPUT);
204 int FindLinePosition(double x, double y);
205 double FindMinimumWidth();
206 void FindNth(wxPyShape *image, int *OUTPUT, int *OUTPUT, bool incoming);
207 int GetAttachmentFrom();
208 int GetAttachmentTo();
209 void GetEnds(double *OUTPUT, double *OUTPUT, double *OUTPUT, double *OUTPUT);
210 wxPyShape * GetFrom();
211 void GetLabelPosition(int position, double *OUTPUT, double *OUTPUT);
212 wxRealPoint * GetNextControlPoint(wxPyShape *shape);
215 void InsertLineControlPoint(wxDC* dc);
216 bool IsEnd(wxPyShape *shape);
218 void MakeLineControlPoints(int n);
220 // inline wxList *GetLineControlPoints() { return m_lineControlPoints; }
222 PyObject* GetLineControlPoints() {
223 wxList* list = self->GetLineControlPoints();
224 return wxPy_ConvertShapeList(list, "wxPyControlPoint");
228 void SetAttachmentFrom(int fromAttach);
229 void SetAttachments(int fromAttach, int toAttach);
230 void SetAttachmentTo(int toAttach);
231 void SetEnds(double x1, double y1, double x2, double y2);
232 void SetFrom(wxPyShape *object);
233 void SetIgnoreOffsets(bool ignore);
234 void SetSpline(bool spline);
235 void SetTo(wxPyShape *object);
236 void Straighten(wxDC* dc = NULL);
240 void base_OnDraw(wxDC& dc);
241 void base_OnDrawContents(wxDC& dc);
242 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
243 void base_OnMoveLinks(wxDC& dc);
244 void base_OnErase(wxDC& dc);
245 void base_OnEraseContents(wxDC& dc);
246 void base_OnHighlight(wxDC& dc);
247 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
248 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
249 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
250 void base_OnSize(double x, double y);
251 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
252 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
253 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
254 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
255 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
256 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
257 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
258 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
259 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
260 void base_OnDrawControlPoints(wxDC& dc);
261 void base_OnEraseControlPoints(wxDC& dc);
262 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
263 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
264 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
265 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
266 void base_OnBeginSize(double w, double h);
267 void base_OnEndSize(double w, double h);
268 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
271 //---------------------------------------------------------------------------
273 WXSHAPE_IMP_CALLBACKS(wxPyPolygonShape, wxPolygonShape);
276 class wxPyPolygonShape : public wxPyShape {
280 void _setCallbackInfo(PyObject* self, PyObject* _class);
281 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPolygonShape)"
282 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
285 // void Create(wxList* points);
287 PyObject* Create(PyObject* points) {
288 wxList* list = wxPy_wxRealPoint_ListHelper(points);
298 void AddPolygonPoint(int pos = 0);
299 void CalculatePolygonCentre();
300 void DeletePolygonPoint(int pos = 0);
302 // wxList* GetPoints();
304 PyObject* GetPoints() {
305 wxList* list = self->GetPoints();
306 return wxPy_ConvertList(list, "wxRealPoint");
310 void UpdateOriginalPoints();
313 void base_OnDraw(wxDC& dc);
314 void base_OnDrawContents(wxDC& dc);
315 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
316 void base_OnMoveLinks(wxDC& dc);
317 void base_OnErase(wxDC& dc);
318 void base_OnEraseContents(wxDC& dc);
319 void base_OnHighlight(wxDC& dc);
320 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
321 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
322 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
323 void base_OnSize(double x, double y);
324 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
325 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
326 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
327 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
328 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
329 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
330 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
331 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
332 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
333 void base_OnDrawControlPoints(wxDC& dc);
334 void base_OnEraseControlPoints(wxDC& dc);
335 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
336 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
337 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
338 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
339 void base_OnBeginSize(double w, double h);
340 void base_OnEndSize(double w, double h);
341 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
343 //---------------------------------------------------------------------------
345 WXSHAPE_IMP_CALLBACKS(wxPyTextShape, wxTextShape);
348 class wxPyTextShape : public wxPyRectangleShape {
350 wxPyTextShape(double width = 0.0, double height = 0.0);
352 void _setCallbackInfo(PyObject* self, PyObject* _class);
353 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyTextShape)"
354 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
357 void base_OnDelete();
358 void base_OnDraw(wxDC& dc);
359 void base_OnDrawContents(wxDC& dc);
360 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
361 void base_OnMoveLinks(wxDC& dc);
362 void base_OnErase(wxDC& dc);
363 void base_OnEraseContents(wxDC& dc);
364 void base_OnHighlight(wxDC& dc);
365 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
366 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
367 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
368 void base_OnSize(double x, double y);
369 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
370 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
371 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
372 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
373 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
374 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
375 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
376 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
377 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
378 void base_OnDrawControlPoints(wxDC& dc);
379 void base_OnEraseControlPoints(wxDC& dc);
380 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
381 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
382 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
383 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
384 void base_OnBeginSize(double w, double h);
385 void base_OnEndSize(double w, double h);
386 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
389 //---------------------------------------------------------------------------