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
37 %pragma(python) code = "import wx"
39 //---------------------------------------------------------------------------
40 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
43 class wxPseudoMetaFile {
48 void Draw(wxDC& dc, double xoffset, double yoffset);
50 void WriteAttributes(wxExpr *clause, int whichAngle);
51 void ReadAttributes(wxExpr *clause, int whichAngle);
53 void Copy(wxPseudoMetaFile& copy);
54 void Scale(double sx, double sy);
55 void ScaleTo(double w, double h);
56 void Translate(double x, double y);
57 void Rotate(double x, double y, double theta);
58 bool LoadFromMetaFile(char* filename, double *width, double *height);
59 void GetBounds(double *minX, double *minY, double *maxX, double *maxY);
60 void CalculateSize(wxDrawnShape* shape);
62 // **** fix these... is it even possible? these are lists of various GDI opperations (not the objects...)
63 // wxList& GetOutlineColours();
64 // wxList& GetFillColours();
67 void SetRotateable(bool rot);
69 void SetSize(double w, double h);
70 void SetFillBrush(wxBrush* brush);
71 wxBrush* GetFillBrush();
72 void SetOutlinePen(wxPen* pen);
73 wxPen* GetOutlinePen();
74 void SetOutlineOp(int op);
79 void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
80 void DrawRectangle(const wxRect& rect);
81 void DrawRoundedRectangle(const wxRect& rect, double radius);
82 void DrawArc(const wxPoint& centrePt, const wxPoint& startPt, const wxPoint& endPt);
83 void DrawEllipticArc(const wxRect& rect, double startAngle, double endAngle);
84 void DrawEllipse(const wxRect& rect);
85 void DrawPoint(const wxPoint& pt);
86 void DrawText(const wxString& text, const wxPoint& pt);
87 void DrawLines(int LCOUNT, wxPoint* LIST);
88 void DrawPolygon(int LCOUNT, wxPoint* LIST, int flags = 0);
89 void DrawSpline(int LCOUNT, wxPoint* LIST);
90 void SetClippingRect(const wxRect& rect);
91 void DestroyClippingRect();
92 void SetPen(wxPen* pen, bool isOutline = FALSE);
93 void SetBrush(wxBrush* brush, bool isFill = FALSE);
94 void SetFont(wxFont* font);
95 void SetTextColour(const wxColour& colour);
96 void SetBackgroundColour(const wxColour& colour);
97 void SetBackgroundMode(int mode);
101 //---------------------------------------------------------------------------
104 WXSHAPE_IMP_CALLBACKS(wxPyRectangleShape, wxRectangleShape);
107 class wxPyRectangleShape : public wxPyShape {
109 wxPyRectangleShape(double width = 0.0, double height = 0.0);
111 void _setSelf(PyObject* self);
112 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
114 void SetCornerRadius(double radius);
116 void base_OnDelete();
117 void base_OnDraw(wxDC& dc);
118 void base_OnDrawContents(wxDC& dc);
119 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
120 void base_OnMoveLinks(wxDC& dc);
121 void base_OnErase(wxDC& dc);
122 void base_OnEraseContents(wxDC& dc);
123 void base_OnHighlight(wxDC& dc);
124 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
125 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
126 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
127 void base_OnSize(double x, double y);
128 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
129 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
130 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
131 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
132 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
133 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
134 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
135 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
136 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
137 void base_OnDrawControlPoints(wxDC& dc);
138 void base_OnEraseControlPoints(wxDC& dc);
139 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
140 void base_OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
141 void base_OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
142 void base_OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
143 void base_OnBeginSize(double w, double h);
144 void base_OnEndSize(double w, double h);
145 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
148 //---------------------------------------------------------------------------
150 WXSHAPE_IMP_CALLBACKS(wxPyBitmapShape, wxBitmapShape);
154 class wxPyBitmapShape : public wxPyRectangleShape {
158 void _setSelf(PyObject* self);
159 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
161 wxBitmap& GetBitmap();
162 wxString GetFilename();
163 void SetBitmap(const wxBitmap& bitmap);
164 void SetFilename(const wxString& filename);
166 void base_OnDelete();
167 void base_OnDraw(wxDC& dc);
168 void base_OnDrawContents(wxDC& dc);
169 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
170 void base_OnMoveLinks(wxDC& dc);
171 void base_OnErase(wxDC& dc);
172 void base_OnEraseContents(wxDC& dc);
173 void base_OnHighlight(wxDC& dc);
174 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
175 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
176 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
177 void base_OnSize(double x, double y);
178 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
179 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
180 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
181 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
182 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
183 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
184 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
185 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
186 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
187 void base_OnDrawControlPoints(wxDC& dc);
188 void base_OnEraseControlPoints(wxDC& dc);
189 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
190 void base_OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
191 void base_OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
192 void base_OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
193 void base_OnBeginSize(double w, double h);
194 void base_OnEndSize(double w, double h);
195 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
198 //---------------------------------------------------------------------------
200 WXSHAPE_IMP_CALLBACKS(wxPyDrawnShape, wxDrawnShape);
203 class wxPyDrawnShape : public wxPyRectangleShape {
207 void _setSelf(PyObject* self);
208 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
210 void CalculateSize();
211 void DestroyClippingRect();
212 void DrawArc(const wxPoint& centrePoint, const wxPoint& startPoint,
213 const wxPoint& endPoint);
214 void DrawAtAngle(int angle);
215 void DrawEllipticArc(const wxRect& rect, double startAngle, double endAngle);
216 void DrawLine(const wxPoint& point1, const wxPoint& point2);
217 void DrawLines(int LCOUNT, wxPoint* LIST);
218 void DrawPoint(const wxPoint& point);
219 void DrawPolygon(int LCOUNT, wxPoint* LIST, int flags = 0);
220 void DrawRectangle(const wxRect& rect);
221 void DrawRoundedRectangle(const wxRect& rect, double radius);
222 void DrawSpline(int LCOUNT, wxPoint* LIST);
223 void DrawText(const wxString& text, const wxPoint& point);
226 wxPseudoMetaFile& GetMetaFile();
228 double GetRotation();
229 bool LoadFromMetaFile(char * filename);
230 void Rotate(double x, double y, double theta);
231 void SetClippingRect(const wxRect& rect);
232 void SetDrawnBackgroundColour(const wxColour& colour);
233 void SetDrawnBackgroundMode(int mode);
234 void SetDrawnBrush(wxBrush* pen, bool isOutline = FALSE);
235 void SetDrawnFont(wxFont* font);
236 void SetDrawnPen(wxPen* pen, bool isOutline = FALSE);
237 void SetDrawnTextColour(const wxColour& colour);
238 void Scale(double sx, double sy);
239 void SetSaveToFile(bool save);
240 void Translate(double x, double y);
243 void base_OnDelete();
244 void base_OnDraw(wxDC& dc);
245 void base_OnDrawContents(wxDC& dc);
246 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
247 void base_OnMoveLinks(wxDC& dc);
248 void base_OnErase(wxDC& dc);
249 void base_OnEraseContents(wxDC& dc);
250 void base_OnHighlight(wxDC& dc);
251 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
252 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
253 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
254 void base_OnSize(double x, double y);
255 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
256 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
257 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
258 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
259 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
260 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
261 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
262 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
263 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
264 void base_OnDrawControlPoints(wxDC& dc);
265 void base_OnEraseControlPoints(wxDC& dc);
266 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
267 void base_OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
268 void base_OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
269 void base_OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
270 void base_OnBeginSize(double w, double h);
271 void base_OnEndSize(double w, double h);
272 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
277 //---------------------------------------------------------------------------
279 class wxOGLConstraint {
281 //wxOGLConstraint(int type, wxPyShape *constraining, wxList& constrained);
283 wxOGLConstraint(int type, wxPyShape *constraining, PyObject* constrained) {
284 wxList* list = wxPy_wxListHelper(constrained, "wxPyShape");
285 wxOGLConstraint* rv = new wxOGLConstraint(type, constraining, *list);
293 void SetSpacing(double x, double y);
294 bool Equals(double a, double b);
300 //---------------------------------------------------------------------------
303 WXSHAPE_IMP_CALLBACKS(wxPyCompositeShape, wxCompositeShape);
306 class wxPyCompositeShape : public wxPyRectangleShape {
308 wxPyCompositeShape();
310 void _setSelf(PyObject* self);
311 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
313 void AddChild(wxPyShape *child, wxPyShape *addAfter = NULL);
315 wxOGLConstraint * AddConstraint(wxOGLConstraint *constraint);
317 // **** Needs a typemap
318 //wxOGLConstraint * AddConstraint(int type,
319 // wxPyShape *constraining,
320 // wxList& constrained);
322 %name(AddSimpleConstraint)wxOGLConstraint* AddConstraint(int type,
323 wxPyShape *constraining,
324 wxPyShape *constrained);
326 void CalculateSize();
327 bool ContainsDivision(wxPyDivisionShape *division);
328 void DeleteConstraint(wxOGLConstraint *constraint);
329 void DeleteConstraintsInvolvingChild(wxPyShape *child);
331 // **** Needs an output typemap
332 //wxOGLConstraint * FindConstraint(long id, wxPyCompositeShape **actualComposite);
334 wxPyShape * FindContainerImage();
336 // wxList& GetConstraints();
337 // wxList& GetDivisions();
339 PyObject* GetConstraints() {
340 wxList& list = self->GetConstraints();
341 return wxPy_ConvertList(&list, "wxOGLConstraint");
344 PyObject* GetDivisions() {
345 wxList& list = self->GetDivisions();
346 return wxPy_ConvertList(&list, "wxPyDivisionShape");
350 void MakeContainer();
352 void RemoveChild(wxPyShape *child);
355 void base_OnDelete();
356 void base_OnDraw(wxDC& dc);
357 void base_OnDrawContents(wxDC& dc);
358 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
359 void base_OnMoveLinks(wxDC& dc);
360 void base_OnErase(wxDC& dc);
361 void base_OnEraseContents(wxDC& dc);
362 void base_OnHighlight(wxDC& dc);
363 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
364 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
365 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
366 void base_OnSize(double x, double y);
367 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
368 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
369 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
370 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
371 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
372 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
373 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
374 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
375 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
376 void base_OnDrawControlPoints(wxDC& dc);
377 void base_OnEraseControlPoints(wxDC& dc);
378 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
379 void base_OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
380 void base_OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
381 void base_OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
382 void base_OnBeginSize(double w, double h);
383 void base_OnEndSize(double w, double h);
384 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
389 //---------------------------------------------------------------------------
392 WXSHAPE_IMP_CALLBACKS(wxPyDividedShape, wxDividedShape);
395 class wxPyDividedShape : public wxPyRectangleShape {
397 wxPyDividedShape(double width = 0.0, double height = 0.0);
399 void _setSelf(PyObject* self);
400 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
403 void SetRegionSizes();
405 void base_OnDelete();
406 void base_OnDraw(wxDC& dc);
407 void base_OnDrawContents(wxDC& dc);
408 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
409 void base_OnMoveLinks(wxDC& dc);
410 void base_OnErase(wxDC& dc);
411 void base_OnEraseContents(wxDC& dc);
412 void base_OnHighlight(wxDC& dc);
413 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
414 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
415 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
416 void base_OnSize(double x, double y);
417 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
418 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
419 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
420 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
421 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
422 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
423 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
424 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
425 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
426 void base_OnDrawControlPoints(wxDC& dc);
427 void base_OnEraseControlPoints(wxDC& dc);
428 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
429 void base_OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
430 void base_OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
431 void base_OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
432 void base_OnBeginSize(double w, double h);
433 void base_OnEndSize(double w, double h);
434 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
439 //---------------------------------------------------------------------------
441 WXSHAPE_IMP_CALLBACKS(wxPyDivisionShape, wxDivisionShape);
444 class wxPyDivisionShape : public wxPyCompositeShape {
448 void _setSelf(PyObject* self);
449 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
451 void AdjustBottom(double bottom, bool test);
452 void AdjustLeft(double left, bool test);
453 void AdjustRight(double right, bool test);
454 void AdjustTop(double top, bool test);
455 void Divide(int direction);
456 void EditEdge(int side);
457 wxPyDivisionShape * GetBottomSide();
459 wxPyDivisionShape * GetLeftSide();
460 wxString GetLeftSideColour();
461 wxPen * GetLeftSidePen();
462 wxPyDivisionShape * GetRightSide();
463 wxPyDivisionShape * GetTopSide();
464 wxPen * GetTopSidePen();
465 void ResizeAdjoining(int side, double newPos, bool test);
466 void PopupMenu(double x, double y);
467 void SetBottomSide(wxPyDivisionShape *shape);
468 void SetHandleSide(int side);
469 void SetLeftSide(wxPyDivisionShape *shape);
470 void SetLeftSideColour(const wxString& colour);
471 void SetLeftSidePen(wxPen *pen);
472 void SetRightSide(wxPyDivisionShape *shape);
473 void SetTopSide(wxPyDivisionShape *shape);
474 void SetTopSideColour(const wxString& colour);
475 void SetTopSidePen(wxPen *pen);
479 void base_OnDelete();
480 void base_OnDraw(wxDC& dc);
481 void base_OnDrawContents(wxDC& dc);
482 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
483 void base_OnMoveLinks(wxDC& dc);
484 void base_OnErase(wxDC& dc);
485 void base_OnEraseContents(wxDC& dc);
486 void base_OnHighlight(wxDC& dc);
487 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
488 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
489 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
490 void base_OnSize(double x, double y);
491 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
492 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
493 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
494 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
495 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
496 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
497 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
498 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
499 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
500 void base_OnDrawControlPoints(wxDC& dc);
501 void base_OnEraseControlPoints(wxDC& dc);
502 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
503 void base_OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
504 void base_OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
505 void base_OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
506 void base_OnBeginSize(double w, double h);
507 void base_OnEndSize(double w, double h);
508 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
514 //---------------------------------------------------------------------------