]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: oglbasic.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 | // Not a %module | |
15 | ||
16 | ||
17 | //--------------------------------------------------------------------------- | |
18 | %newgroup; | |
19 | ||
20 | ||
21 | class wxShapeRegion : public wxObject { | |
22 | public: | |
23 | wxShapeRegion(); | |
24 | //~wxShapeRegion(); | |
25 | ||
26 | void SetText(const wxString& s); | |
27 | void SetFont(wxFont *f); | |
28 | void SetMinSize(double w, double h); | |
29 | void SetSize(double w, double h); | |
30 | void SetPosition(double x, double y); | |
31 | void SetProportions(double x, double y); | |
32 | void SetFormatMode(int mode); | |
33 | void SetName(const wxString& s); | |
34 | void SetColour(const wxString& col); | |
35 | ||
36 | wxString GetText(); | |
37 | wxFont *GetFont(); | |
38 | void GetMinSize(double *OUTPUT, double *OUTPUT); | |
39 | void GetProportion(double *OUTPUT, double *OUTPUT); | |
40 | void GetSize(double *OUTPUT, double *OUTPUT); | |
41 | void GetPosition(double *OUTPUT, double *OUTPUT); | |
42 | int GetFormatMode(); | |
43 | wxString GetName(); | |
44 | wxString GetColour(); | |
45 | wxColour GetActualColourObject(); | |
46 | wxList& GetFormattedText(); | |
47 | wxString GetPenColour(); | |
48 | int GetPenStyle(); | |
49 | void SetPenStyle(int style); | |
50 | void SetPenColour(const wxString& col); | |
51 | wxPen *GetActualPen(); | |
52 | double GetWidth(); | |
53 | double GetHeight(); | |
54 | ||
55 | void ClearText(); | |
56 | }; | |
57 | ||
58 | ||
59 | //--------------------------------------------------------------------------- | |
60 | ||
61 | /* | |
62 | * User-defined attachment point | |
63 | */ | |
64 | ||
65 | class wxAttachmentPoint: public wxObject | |
66 | { | |
67 | public: | |
68 | wxAttachmentPoint(int id=0, double x=0.0, double y=0.0); | |
69 | int m_id; // Identifier | |
70 | double m_x; // x offset from centre of object | |
71 | double m_y; // y offset from centre of object | |
72 | }; | |
73 | ||
74 | ||
75 | //--------------------------------------------------------------------------- | |
76 | ||
77 | %{ | |
78 | WXSHAPE_IMP_CALLBACKS(wxPyShapeEvtHandler,wxShapeEvtHandler); | |
79 | %} | |
80 | ||
81 | ||
82 | class wxPyShapeEvtHandler : public wxObject { | |
83 | public: | |
84 | %addtofunc wxPyShapeEvtHandler "self._setOORandCallbackInfo(PyShapeEvtHandler)" | |
85 | ||
86 | wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL, | |
87 | wxPyShape *shape = NULL); | |
88 | ||
89 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
90 | %extend { | |
91 | void _setOORInfo(PyObject* _self) { | |
92 | self->SetClientObject(new wxPyOORClientData(_self)); | |
93 | } | |
94 | } | |
95 | %pythoncode { | |
96 | def _setOORandCallbackInfo(self, _class): | |
97 | self._setOORInfo(self) | |
98 | self._setCallbackInfo(self, _class) | |
99 | } | |
100 | ||
101 | ||
102 | void SetShape(wxPyShape *sh); | |
103 | wxPyShape *GetShape(); | |
104 | void SetPreviousHandler(wxPyShapeEvtHandler* handler); | |
105 | wxPyShapeEvtHandler* GetPreviousHandler(); | |
106 | wxPyShapeEvtHandler* CreateNewCopy(); | |
107 | ||
108 | void base_OnDelete(); | |
109 | void base_OnDraw(wxDC& dc); | |
110 | void base_OnDrawContents(wxDC& dc); | |
111 | void base_OnDrawBranches(wxDC& dc, bool erase = False); | |
112 | void base_OnMoveLinks(wxDC& dc); | |
113 | void base_OnErase(wxDC& dc); | |
114 | void base_OnEraseContents(wxDC& dc); | |
115 | void base_OnHighlight(wxDC& dc); | |
116 | void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0); | |
117 | void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0); | |
118 | void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0); | |
119 | void base_OnSize(double x, double y); | |
120 | bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True); | |
121 | void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True); | |
122 | void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); | |
123 | void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0); | |
124 | void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0); | |
125 | void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0); | |
126 | void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0); | |
127 | void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0); | |
128 | void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h); | |
129 | void base_OnDrawControlPoints(wxDC& dc); | |
130 | void base_OnEraseControlPoints(wxDC& dc); | |
131 | void base_OnMoveLink(wxDC& dc, bool moveControlPoints = True); | |
132 | void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0); | |
133 | void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0); | |
134 | void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0); | |
135 | void base_OnBeginSize(double w, double h); | |
136 | void base_OnEndSize(double w, double h); | |
137 | // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering); | |
138 | }; | |
139 | ||
140 | //--------------------------------------------------------------------------- | |
141 | %{ | |
142 | WXSHAPE_IMP_CALLBACKS(wxPyShape, wxShape); | |
143 | %} | |
144 | ||
145 | ||
146 | class wxPyShape : public wxPyShapeEvtHandler { | |
147 | public: | |
148 | %addtofunc wxPyShape "self._setOORandCallbackInfo(PyShapeEvtHandler)" | |
149 | ||
150 | wxPyShape(wxPyShapeCanvas *can = NULL); | |
151 | ||
152 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
153 | ||
154 | void GetBoundingBoxMax(double *OUTPUT, double *OUTPUT); | |
155 | void GetBoundingBoxMin(double *OUTPUT, double *OUTPUT); | |
156 | bool GetPerimeterPoint(double x1, double y1, | |
157 | double x2, double y2, | |
158 | double *OUTPUT, double *OUTPUT); | |
159 | wxPyShapeCanvas *GetCanvas(); | |
160 | void SetCanvas(wxPyShapeCanvas *the_canvas); | |
161 | void AddToCanvas(wxPyShapeCanvas *the_canvas, wxPyShape *addAfter = NULL); | |
162 | void InsertInCanvas(wxPyShapeCanvas *the_canvas); | |
163 | void RemoveFromCanvas(wxPyShapeCanvas *the_canvas); | |
164 | double GetX(); | |
165 | double GetY(); | |
166 | void SetX(double x); | |
167 | void SetY(double y); | |
168 | wxPyShape *GetParent(); | |
169 | void SetParent(wxPyShape *p); | |
170 | wxPyShape *GetTopAncestor(); | |
171 | ||
172 | ||
173 | // wxList& GetChildren(); | |
174 | %extend { | |
175 | PyObject* GetChildren() { | |
176 | wxList& list = self->GetChildren(); | |
177 | return wxPy_ConvertShapeList(&list); | |
178 | } | |
179 | } | |
180 | ||
181 | ||
182 | void Unlink(); | |
183 | void SetDrawHandles(bool drawH); | |
184 | bool GetDrawHandles(); | |
185 | void MakeControlPoints(); | |
186 | void DeleteControlPoints(wxDC *dc = NULL); | |
187 | void ResetControlPoints(); | |
188 | wxPyShapeEvtHandler *GetEventHandler(); | |
189 | void SetEventHandler(wxPyShapeEvtHandler *handler); | |
190 | void MakeMandatoryControlPoints(); | |
191 | void ResetMandatoryControlPoints(); | |
192 | bool Recompute(); | |
193 | void CalculateSize(); | |
194 | void Select(bool select = True, wxDC* dc = NULL); | |
195 | void SetHighlight(bool hi = True, bool recurse = False); | |
196 | bool IsHighlighted() ; | |
197 | bool Selected(); | |
198 | bool AncestorSelected(); | |
199 | void SetSensitivityFilter(int sens = OP_ALL, bool recursive = False); | |
200 | int GetSensitivityFilter(); | |
201 | void SetDraggable(bool drag, bool recursive = False); | |
202 | void SetFixedSize(bool x, bool y); | |
203 | void GetFixedSize(bool *OUTPUT, bool *OUTPUT) ; | |
204 | bool GetFixedWidth(); | |
205 | bool GetFixedHeight(); | |
206 | void SetSpaceAttachments(bool sp); | |
207 | bool GetSpaceAttachments() ; | |
208 | void SetShadowMode(int mode, bool redraw = False); | |
209 | int GetShadowMode(); | |
210 | bool HitTest(double x, double y, int *OUTPUT, double *OUTPUT); | |
211 | void SetCentreResize(bool cr); | |
212 | bool GetCentreResize(); | |
213 | void SetMaintainAspectRatio(bool ar); | |
214 | bool GetMaintainAspectRatio(); | |
215 | ||
216 | ||
217 | // wxList& GetLines(); | |
218 | %extend { | |
219 | PyObject* GetLines() { | |
220 | wxList& list = self->GetLines(); | |
221 | return wxPy_ConvertShapeList(&list); | |
222 | } | |
223 | } | |
224 | ||
225 | void SetDisableLabel(bool flag); | |
226 | bool GetDisableLabel(); | |
227 | void SetAttachmentMode(int mode); | |
228 | int GetAttachmentMode(); | |
229 | void SetId(long i); | |
230 | long GetId(); | |
231 | ||
232 | void SetPen(wxPen *pen); | |
233 | void SetBrush(wxBrush *brush); | |
234 | ||
235 | ||
236 | // void SetClientData(wxObject *client_data); | |
237 | // wxObject *GetClientData(); | |
238 | ||
239 | // The real client data methods are being used for OOR, so just fake it. | |
240 | %pythoncode { | |
241 | def SetClientData(self, data): | |
242 | self.clientData = data | |
243 | def GetClientData(self): | |
244 | if hasattr(self, 'clientData'): | |
245 | return self.clientData | |
246 | else: | |
247 | return None | |
248 | } | |
249 | ||
250 | void Show(bool show); | |
251 | bool IsShown(); | |
252 | void Move(wxDC& dc, double x1, double y1, bool display = True); | |
253 | void Erase(wxDC& dc); | |
254 | void EraseContents(wxDC& dc); | |
255 | void Draw(wxDC& dc); | |
256 | void Flash(); | |
257 | void MoveLinks(wxDC& dc); | |
258 | void DrawContents(wxDC& dc); | |
259 | void SetSize(double x, double y, bool recursive = True); | |
260 | void SetAttachmentSize(double x, double y); | |
261 | void Attach(wxPyShapeCanvas *can); | |
262 | void Detach(); | |
263 | bool Constrain(); | |
264 | void AddLine(wxPyLineShape *line, wxPyShape *other, | |
265 | int attachFrom = 0, int attachTo = 0, | |
266 | int positionFrom = -1, int positionTo = -1); | |
267 | int GetLinePosition(wxPyLineShape* line); | |
268 | void AddText(const wxString& string); | |
269 | wxPen *GetPen(); | |
270 | wxBrush *GetBrush(); | |
271 | void SetDefaultRegionSize(); | |
272 | void FormatText(wxDC& dc, const wxString& s, int regionId = 0); | |
273 | void SetFormatMode(int mode, int regionId = 0); | |
274 | int GetFormatMode(int regionId = 0); | |
275 | void SetFont(wxFont *font, int regionId = 0); | |
276 | wxFont *GetFont(int regionId = 0); | |
277 | void SetTextColour(const wxString& colour, int regionId = 0); | |
278 | wxString GetTextColour(int regionId = 0); | |
279 | int GetNumberOfTextRegions(); | |
280 | void SetRegionName(const wxString& name, int regionId = 0); | |
281 | wxString GetRegionName(int regionId); | |
282 | int GetRegionId(const wxString& name); | |
283 | void NameRegions(const wxString& parentName = wxPyEmptyString); | |
284 | ||
285 | // wxList& GetRegions(); | |
286 | %extend { | |
287 | PyObject* GetRegions() { | |
288 | wxList& list = self->GetRegions(); | |
289 | return wxPy_ConvertList(&list); | |
290 | } | |
291 | } | |
292 | ||
293 | void AddRegion(wxShapeRegion *region); | |
294 | void ClearRegions(); | |
295 | void AssignNewIds(); | |
296 | wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT); | |
297 | void FindRegionNames(wxStringList& list); | |
298 | void ClearText(int regionId = 0); | |
299 | void RemoveLine(wxPyLineShape *line); | |
300 | ||
301 | #ifdef wxUSE_PROLOGIO | |
302 | void WriteAttributes(wxExpr *clause); | |
303 | void ReadAttributes(wxExpr *clause); | |
304 | void ReadConstraints(wxExpr *clause, wxExprDatabase *database); | |
305 | void WriteRegions(wxExpr *clause); | |
306 | void ReadRegions(wxExpr *clause); | |
307 | #endif | |
308 | ||
309 | bool GetAttachmentPosition(int attachment, double *OUTPUT, double *OUTPUT, | |
310 | int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL); | |
311 | int GetNumberOfAttachments(); | |
312 | bool AttachmentIsValid(int attachment); | |
313 | ||
314 | %extend { | |
315 | PyObject* GetAttachments() { | |
316 | wxList& list = self->GetAttachments(); | |
317 | return wxPy_ConvertList(&list); | |
318 | } | |
319 | } | |
320 | ||
321 | bool GetAttachmentPositionEdge(int attachment, double *OUTPUT, double *OUTPUT, | |
322 | int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL); | |
323 | wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2, | |
324 | int nth, int noArcs, wxPyLineShape* line); | |
325 | bool AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, const wxRealPoint& pt2); | |
326 | void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = False); | |
327 | void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = False); | |
328 | bool MoveLineToNewAttachment(wxDC& dc, wxPyLineShape *to_move, | |
329 | double x, double y); | |
330 | ||
331 | //void ApplyAttachmentOrdering(wxList& linesToSort); | |
332 | %extend { | |
333 | void ApplyAttachmentOrdering(PyObject* linesToSort) { | |
334 | wxList* list = wxPy_wxListHelper(linesToSort, wxT("wxPyLineShape")); | |
335 | self->ApplyAttachmentOrdering(*list); | |
336 | delete list; | |
337 | } | |
338 | } | |
339 | ||
340 | wxRealPoint GetBranchingAttachmentRoot(int attachment); | |
341 | bool GetBranchingAttachmentInfo(int attachment, wxRealPoint& root, wxRealPoint& neck, | |
342 | wxRealPoint& shoulder1, wxRealPoint& shoulder2); | |
343 | bool GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& attachmentPoint, | |
344 | wxRealPoint& stemPoint); | |
345 | int GetAttachmentLineCount(int attachment); | |
346 | void SetBranchNeckLength(int len); | |
347 | int GetBranchNeckLength(); | |
348 | void SetBranchStemLength(int len); | |
349 | int GetBranchStemLength(); | |
350 | void SetBranchSpacing(int len); | |
351 | int GetBranchSpacing(); | |
352 | void SetBranchStyle(long style); | |
353 | long GetBranchStyle(); | |
354 | int PhysicalToLogicalAttachment(int physicalAttachment); | |
355 | int LogicalToPhysicalAttachment(int logicalAttachment); | |
356 | bool Draggable(); | |
357 | bool HasDescendant(wxPyShape *image); | |
358 | wxPyShape *CreateNewCopy(bool resetMapping = True, bool recompute = True); | |
359 | void Copy(wxPyShape& copy); | |
360 | void CopyWithHandler(wxPyShape& copy); | |
361 | void Rotate(double x, double y, double theta); | |
362 | double GetRotation(); | |
363 | void SetRotation(double rotation); | |
364 | void ClearAttachments(); | |
365 | void Recentre(wxDC& dc); | |
366 | void ClearPointList(wxList& list); | |
367 | wxPen GetBackgroundPen(); | |
368 | wxBrush GetBackgroundBrush(); | |
369 | ||
370 | void base_OnDelete(); | |
371 | void base_OnDraw(wxDC& dc); | |
372 | void base_OnDrawContents(wxDC& dc); | |
373 | void base_OnDrawBranches(wxDC& dc, bool erase = False); | |
374 | void base_OnMoveLinks(wxDC& dc); | |
375 | void base_OnErase(wxDC& dc); | |
376 | void base_OnEraseContents(wxDC& dc); | |
377 | void base_OnHighlight(wxDC& dc); | |
378 | void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0); | |
379 | void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0); | |
380 | void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0); | |
381 | void base_OnSize(double x, double y); | |
382 | bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True); | |
383 | void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True); | |
384 | void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); | |
385 | void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0); | |
386 | void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0); | |
387 | void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0); | |
388 | void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0); | |
389 | void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0); | |
390 | void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h); | |
391 | void base_OnDrawControlPoints(wxDC& dc); | |
392 | void base_OnEraseControlPoints(wxDC& dc); | |
393 | void base_OnMoveLink(wxDC& dc, bool moveControlPoints = True); | |
394 | void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0); | |
395 | void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0); | |
396 | void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0); | |
397 | void base_OnBeginSize(double w, double h); | |
398 | void base_OnEndSize(double w, double h); | |
399 | // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering); | |
400 | }; | |
401 | ||
402 | //--------------------------------------------------------------------------- | |
403 |