]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/ogl/_oglshapes2.i
fixed deadlock when calling wxPostEvent() from worker thread
[wxWidgets.git] / wxPython / contrib / ogl / _oglshapes2.i
CommitLineData
e91a9dfc
RD
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
d14a1e28 14// not a %module
e91a9dfc
RD
15
16
e91a9dfc 17//---------------------------------------------------------------------------
137b5242 18
e91a9dfc
RD
19%{
20 WXSHAPE_IMP_CALLBACKS(wxPyEllipseShape, wxEllipseShape);
21%}
22
23class wxPyEllipseShape : public wxPyShape {
24public:
2b9048c5 25 %pythonAppend wxPyEllipseShape "self._setOORandCallbackInfo(PyEllipseShape)"
d14a1e28 26
e91a9dfc
RD
27 wxPyEllipseShape(double width = 0.0, double height = 0.0);
28
0122b7e3 29 void _setCallbackInfo(PyObject* self, PyObject* _class);
e91a9dfc
RD
30
31 void base_OnDraw(wxDC& dc);
32 void base_OnDrawContents(wxDC& dc);
33 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
34 void base_OnMoveLinks(wxDC& dc);
35 void base_OnErase(wxDC& dc);
36 void base_OnEraseContents(wxDC& dc);
37 void base_OnHighlight(wxDC& dc);
38 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
39 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
40 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
41 void base_OnSize(double x, double y);
a72f4631
RD
42 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
43 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
e91a9dfc
RD
44 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
45 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
46 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
47 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
48 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
49 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
50 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
51 void base_OnDrawControlPoints(wxDC& dc);
52 void base_OnEraseControlPoints(wxDC& dc);
a72f4631 53 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true);
2348eaee
RD
54 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
55 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
56 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
e91a9dfc
RD
57 void base_OnBeginSize(double w, double h);
58 void base_OnEndSize(double w, double h);
59// void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
60};
61
62//---------------------------------------------------------------------------
63%{
64 WXSHAPE_IMP_CALLBACKS(wxPyCircleShape, wxCircleShape);
65%}
66
67class wxPyCircleShape : public wxPyEllipseShape {
68public:
2b9048c5 69 %pythonAppend wxPyCircleShape "self._setOORandCallbackInfo(PyCircleShape)"
d14a1e28 70
e91a9dfc
RD
71 wxPyCircleShape(double width = 0.0);
72
0122b7e3 73 void _setCallbackInfo(PyObject* self, PyObject* _class);
e91a9dfc
RD
74
75 void base_OnDraw(wxDC& dc);
76 void base_OnDrawContents(wxDC& dc);
77 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
78 void base_OnMoveLinks(wxDC& dc);
79 void base_OnErase(wxDC& dc);
80 void base_OnEraseContents(wxDC& dc);
81 void base_OnHighlight(wxDC& dc);
82 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
83 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
84 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
85 void base_OnSize(double x, double y);
a72f4631
RD
86 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
87 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
e91a9dfc
RD
88 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
89 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
90 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
91 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
92 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
93 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
94 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
95 void base_OnDrawControlPoints(wxDC& dc);
96 void base_OnEraseControlPoints(wxDC& dc);
a72f4631 97 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true);
2348eaee
RD
98 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
99 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
100 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
e91a9dfc
RD
101 void base_OnBeginSize(double w, double h);
102 void base_OnEndSize(double w, double h);
103// void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
104};
d14a1e28 105
e91a9dfc
RD
106//---------------------------------------------------------------------------
107//---------------------------------------------------------------------------
d14a1e28 108
9416aa89 109class wxArrowHead : public wxObject {
e91a9dfc
RD
110public:
111 wxArrowHead(int type = 0,
112 int end = 0,
113 double size = 0.0,
114 double dist = 0.0,
137b5242 115 const wxString& name = wxPyEmptyString,
e91a9dfc
RD
116 wxPseudoMetaFile *mf = NULL,
117 long arrowId = -1);
118 ~wxArrowHead();
119
120 int _GetType();
121 int GetPosition();
122 void SetPosition(int pos);
123 double GetXOffset();
124 double GetYOffset();
125 double GetSpacing();
126 double GetSize();
127 wxString GetName();
128 void SetXOffset(double x);
129 void SetYOffset(double y);
130 wxPseudoMetaFile *GetMetaFile();
131 long GetId();
132 int GetArrowEnd();
133 double GetArrowSize();
134 void SetSize(double size);
135 void SetSpacing(double sp);
136};
137//---------------------------------------------------------------------------
138%{
139 WXSHAPE_IMP_CALLBACKS(wxPyLineShape, wxLineShape);
140%}
141
142class wxPyLineShape : public wxPyShape {
143public:
2b9048c5 144 %pythonAppend wxPyLineShape "self._setOORandCallbackInfo(PyLineShape)"
d14a1e28 145
e91a9dfc
RD
146 wxPyLineShape();
147
0122b7e3 148 void _setCallbackInfo(PyObject* self, PyObject* _class);
e91a9dfc
RD
149
150 void AddArrow(int type, int end = ARROW_POSITION_END,
151 double arrowSize = 10.0, double xOffset = 0.0,
137b5242 152 const wxString& name = wxPyEmptyString, wxPseudoMetaFile *mf = NULL,
e91a9dfc
RD
153 long arrowId = -1);
154
155 //void AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int end);
d14a1e28 156 %extend {
e91a9dfc 157 void AddArrowOrdered(wxArrowHead *arrow, PyObject* referenceList, int end) {
d14a1e28 158 wxList* list = wxPy_wxListHelper(referenceList, wxT("wxArrowHead"));
e91a9dfc
RD
159 self->AddArrowOrdered(arrow, *list, end);
160 delete list;
161 }
162 }
163 bool ClearArrow(const wxString& name);
164 void ClearArrowsAtPosition(int position = -1);
165 void DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool proportionalOffset);
1b8c7ba6 166 %Rename(DeleteArrowHeadId, bool, DeleteArrowHead(long arrowId));
e91a9dfc
RD
167 bool DeleteArrowHead(int position, const wxString& name);
168 bool DeleteLineControlPoint();
169 void DrawArrows(wxDC& dc);
170 void DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
171 void EraseRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
1b8c7ba6 172 %Rename(FindArrowHeadId, wxArrowHead *, FindArrowHead(long arrowId));
e91a9dfc
RD
173 wxArrowHead * FindArrowHead(int position, const wxString& name);
174 void FindLineEndPoints(double *OUTPUT, double *OUTPUT,
175 double *OUTPUT, double *OUTPUT);
176 int FindLinePosition(double x, double y);
177 double FindMinimumWidth();
178 void FindNth(wxPyShape *image, int *OUTPUT, int *OUTPUT, bool incoming);
179 int GetAttachmentFrom();
180 int GetAttachmentTo();
181 void GetEnds(double *OUTPUT, double *OUTPUT, double *OUTPUT, double *OUTPUT);
182 wxPyShape * GetFrom();
183 void GetLabelPosition(int position, double *OUTPUT, double *OUTPUT);
1e4a197e 184 wxRealPoint * GetNextControlPoint(wxPyShape *shape);
e91a9dfc
RD
185 wxPyShape * GetTo();
186 void Initialise();
187 void InsertLineControlPoint(wxDC* dc);
188 bool IsEnd(wxPyShape *shape);
189 bool IsSpline();
190 void MakeLineControlPoints(int n);
191
211a46cf 192 // inline wxList *GetLineControlPoints() { return m_lineControlPoints; }
d14a1e28 193 %extend {
9416aa89
RD
194 PyObject* GetLineControlPoints() {
195 wxList* list = self->GetLineControlPoints();
1ce56f78
RD
196 return wxPy_ConvertRealPointList(list);
197 }
198
199 // part of Patch# 893337
200 void SetLineControlPoints(PyObject* list) {
201 wxList* real_point_list = wxPy_wxRealPoint_ListHelper(list);
202 self->MakeLineControlPoints((int)(real_point_list->GetCount()));
203 wxList* old_control_points = self->GetLineControlPoints();
204 wxNode* old_node = old_control_points->GetFirst();
205 wxNode* real_node = real_point_list->GetFirst();
206 while(old_node)
207 {
208 wxRealPoint* old_point = (wxRealPoint*)old_node->GetData();
209 wxRealPoint* new_point = (wxRealPoint*)real_node->GetData();
210 old_point->x = new_point->x;
211 old_point->y = new_point->y;
212 old_node = old_node->GetNext();
213 real_node = real_node->GetNext();
214 }
215 self->ClearPointList(*real_point_list);
216 delete real_point_list;
9416aa89
RD
217 }
218 }
211a46cf 219
e91a9dfc
RD
220 void SetAttachmentFrom(int fromAttach);
221 void SetAttachments(int fromAttach, int toAttach);
222 void SetAttachmentTo(int toAttach);
223 void SetEnds(double x1, double y1, double x2, double y2);
224 void SetFrom(wxPyShape *object);
225 void SetIgnoreOffsets(bool ignore);
226 void SetSpline(bool spline);
227 void SetTo(wxPyShape *object);
228 void Straighten(wxDC* dc = NULL);
229 void Unlink();
230
231
e7726f5e
RD
232 void SetAlignmentOrientation(bool isEnd, bool isHoriz);
233 void SetAlignmentType(bool isEnd, int alignType);
234 bool GetAlignmentOrientation(bool isEnd);
235 int GetAlignmentType(bool isEnd);
236 int GetAlignmentStart() const;
237 int GetAlignmentEnd() const;
238
e91a9dfc
RD
239 void base_OnDraw(wxDC& dc);
240 void base_OnDrawContents(wxDC& dc);
241 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
242 void base_OnMoveLinks(wxDC& dc);
243 void base_OnErase(wxDC& dc);
244 void base_OnEraseContents(wxDC& dc);
245 void base_OnHighlight(wxDC& dc);
246 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
247 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
248 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
249 void base_OnSize(double x, double y);
a72f4631
RD
250 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
251 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
e91a9dfc
RD
252 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
253 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
254 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
255 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
256 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
257 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
258 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
259 void base_OnDrawControlPoints(wxDC& dc);
260 void base_OnEraseControlPoints(wxDC& dc);
a72f4631 261 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true);
2348eaee
RD
262 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
263 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
264 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
e91a9dfc
RD
265 void base_OnBeginSize(double w, double h);
266 void base_OnEndSize(double w, double h);
267// void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
268};
269
270//---------------------------------------------------------------------------
271%{
272 WXSHAPE_IMP_CALLBACKS(wxPyPolygonShape, wxPolygonShape);
273%}
274
275class wxPyPolygonShape : public wxPyShape {
276public:
2b9048c5 277 %pythonAppend wxPyPolygonShape "self._setOORandCallbackInfo(PyPolygonShape)"
d14a1e28 278
e91a9dfc
RD
279 wxPyPolygonShape();
280
0122b7e3 281 void _setCallbackInfo(PyObject* self, PyObject* _class);
e91a9dfc
RD
282
283
284 // void Create(wxList* points);
d14a1e28 285 %extend {
e91a9dfc
RD
286 PyObject* Create(PyObject* points) {
287 wxList* list = wxPy_wxRealPoint_ListHelper(points);
288 if (list) {
289 self->Create(list);
290 Py_INCREF(Py_None);
291 return Py_None;
292 }
293 else return NULL;
294 }
295 }
296
297 void AddPolygonPoint(int pos = 0);
298 void CalculatePolygonCentre();
299 void DeletePolygonPoint(int pos = 0);
300
301 // wxList* GetPoints();
d14a1e28 302 %extend {
e91a9dfc
RD
303 PyObject* GetPoints() {
304 wxList* list = self->GetPoints();
1ce56f78 305 return wxPy_ConvertRealPointList(list);
e91a9dfc 306 }
e7726f5e
RD
307
308 PyObject* GetOriginalPoints() {
309 wxList* list = self->GetOriginalPoints();
310 PyObject* pyList;
311 PyObject* pyObj;
312 wxObject* wxObj;
313 wxNode* node = list->GetFirst();
314
6e6b3557 315 wxPyBlock_t blocked = wxPyBeginBlockThreads();
e7726f5e
RD
316 pyList = PyList_New(0);
317 while (node) {
318 wxObj = node->GetData();
319 pyObj = wxPyConstructObject(wxObj, wxT("wxRealPoint"), 0);
320 PyList_Append(pyList, pyObj);
321 node = node->GetNext();
322 }
da32eb53 323 wxPyEndBlockThreads(blocked);
e7726f5e
RD
324 return pyList;
325 }
e91a9dfc
RD
326 }
327
e7726f5e
RD
328 double GetOriginalWidth() const;
329 double GetOriginalHeight() const;
330
331 void SetOriginalWidth(double w);
332 void SetOriginalHeight(double h);
333
e91a9dfc
RD
334 void UpdateOriginalPoints();
335
e91a9dfc
RD
336 void base_OnDraw(wxDC& dc);
337 void base_OnDrawContents(wxDC& dc);
338 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
339 void base_OnMoveLinks(wxDC& dc);
340 void base_OnErase(wxDC& dc);
341 void base_OnEraseContents(wxDC& dc);
342 void base_OnHighlight(wxDC& dc);
343 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
344 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
345 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
346 void base_OnSize(double x, double y);
a72f4631
RD
347 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
348 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
e91a9dfc
RD
349 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
350 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
351 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
352 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
353 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
354 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
355 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
356 void base_OnDrawControlPoints(wxDC& dc);
357 void base_OnEraseControlPoints(wxDC& dc);
a72f4631 358 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true);
2348eaee
RD
359 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
360 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
361 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
e91a9dfc
RD
362 void base_OnBeginSize(double w, double h);
363 void base_OnEndSize(double w, double h);
364// void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
365};
366//---------------------------------------------------------------------------
367%{
368 WXSHAPE_IMP_CALLBACKS(wxPyTextShape, wxTextShape);
369%}
370
371class wxPyTextShape : public wxPyRectangleShape {
372public:
2b9048c5 373 %pythonAppend wxPyTextShape "self._setOORandCallbackInfo(PyTextShape)"
d14a1e28 374
e91a9dfc
RD
375 wxPyTextShape(double width = 0.0, double height = 0.0);
376
0122b7e3 377 void _setCallbackInfo(PyObject* self, PyObject* _class);
e91a9dfc
RD
378
379 void base_OnDelete();
380 void base_OnDraw(wxDC& dc);
381 void base_OnDrawContents(wxDC& dc);
382 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
383 void base_OnMoveLinks(wxDC& dc);
384 void base_OnErase(wxDC& dc);
385 void base_OnEraseContents(wxDC& dc);
386 void base_OnHighlight(wxDC& dc);
387 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
388 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
389 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
390 void base_OnSize(double x, double y);
a72f4631
RD
391 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
392 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
e91a9dfc
RD
393 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
394 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
395 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
396 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
397 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
398 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
399 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
400 void base_OnDrawControlPoints(wxDC& dc);
401 void base_OnEraseControlPoints(wxDC& dc);
a72f4631 402 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true);
2348eaee
RD
403 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
404 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
405 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
e91a9dfc
RD
406 void base_OnBeginSize(double w, double h);
407 void base_OnEndSize(double w, double h);
408// void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
409
410};
411//---------------------------------------------------------------------------