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 /////////////////////////////////////////////////////////////////////////////
17 //---------------------------------------------------------------------------
21 class wxShapeRegion : public wxObject {
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);
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);
45 wxColour GetActualColourObject();
46 wxList& GetFormattedText();
47 wxString GetPenColour();
49 void SetPenStyle(int style);
50 void SetPenColour(const wxString& col);
51 wxPen *GetActualPen();
59 //---------------------------------------------------------------------------
62 * User-defined attachment point
65 class wxAttachmentPoint: public wxObject
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
75 //---------------------------------------------------------------------------
78 WXSHAPE_IMP_CALLBACKS(wxPyShapeEvtHandler,wxShapeEvtHandler);
82 class wxPyShapeEvtHandler : public wxObject {
84 %pythonAppend wxPyShapeEvtHandler "self._setOORandCallbackInfo(PyShapeEvtHandler)"
86 wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL,
87 wxPyShape *shape = NULL);
89 void _setCallbackInfo(PyObject* self, PyObject* _class);
91 void _setOORInfo(PyObject* _self) {
92 if (!self->GetClientObject())
93 self->SetClientObject(new wxPyOORClientData(_self));
97 def _setOORandCallbackInfo(self, _class):
98 self._setOORInfo(self)
99 self._setCallbackInfo(self, _class)
103 void SetShape(wxPyShape *sh);
104 wxPyShape *GetShape();
105 void SetPreviousHandler(wxPyShapeEvtHandler* handler);
106 wxPyShapeEvtHandler* GetPreviousHandler();
107 wxPyShapeEvtHandler* CreateNewCopy();
109 void base_OnDelete();
110 void base_OnDraw(wxDC& dc);
111 void base_OnDrawContents(wxDC& dc);
112 void base_OnDrawBranches(wxDC& dc, bool erase = False);
113 void base_OnMoveLinks(wxDC& dc);
114 void base_OnErase(wxDC& dc);
115 void base_OnEraseContents(wxDC& dc);
116 void base_OnHighlight(wxDC& dc);
117 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
118 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
119 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
120 void base_OnSize(double x, double y);
121 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True);
122 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True);
123 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
124 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
125 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
126 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
127 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
128 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
129 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
130 void base_OnDrawControlPoints(wxDC& dc);
131 void base_OnEraseControlPoints(wxDC& dc);
132 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = True);
133 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
134 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
135 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
136 void base_OnBeginSize(double w, double h);
137 void base_OnEndSize(double w, double h);
138 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
141 //---------------------------------------------------------------------------
143 WXSHAPE_IMP_CALLBACKS(wxPyShape, wxShape);
147 class wxPyShape : public wxPyShapeEvtHandler {
149 %pythonAppend wxPyShape "self._setOORandCallbackInfo(PyShape)"
151 wxPyShape(wxPyShapeCanvas *can = NULL);
153 void _setCallbackInfo(PyObject* self, PyObject* _class);
155 void GetBoundingBoxMax(double *OUTPUT, double *OUTPUT);
156 void GetBoundingBoxMin(double *OUTPUT, double *OUTPUT);
157 bool GetPerimeterPoint(double x1, double y1,
158 double x2, double y2,
159 double *OUTPUT, double *OUTPUT);
160 wxPyShapeCanvas *GetCanvas();
161 void SetCanvas(wxPyShapeCanvas *the_canvas);
162 void AddToCanvas(wxPyShapeCanvas *the_canvas, wxPyShape *addAfter = NULL);
163 void InsertInCanvas(wxPyShapeCanvas *the_canvas);
164 void RemoveFromCanvas(wxPyShapeCanvas *the_canvas);
169 wxPyShape *GetParent();
170 void SetParent(wxPyShape *p);
171 wxPyShape *GetTopAncestor();
174 // wxList& GetChildren();
176 PyObject* GetChildren() {
177 wxList& list = self->GetChildren();
178 return wxPy_ConvertShapeList(&list);
184 void SetDrawHandles(bool drawH);
185 bool GetDrawHandles();
186 void MakeControlPoints();
187 void DeleteControlPoints(wxDC *dc = NULL);
188 void ResetControlPoints();
189 wxPyShapeEvtHandler *GetEventHandler();
190 void SetEventHandler(wxPyShapeEvtHandler *handler);
191 void MakeMandatoryControlPoints();
192 void ResetMandatoryControlPoints();
194 void CalculateSize();
195 void Select(bool select = True, wxDC* dc = NULL);
196 void SetHighlight(bool hi = True, bool recurse = False);
197 bool IsHighlighted() ;
199 bool AncestorSelected();
200 void SetSensitivityFilter(int sens = OP_ALL, bool recursive = False);
201 int GetSensitivityFilter();
202 void SetDraggable(bool drag, bool recursive = False);
203 void SetFixedSize(bool x, bool y);
204 void GetFixedSize(bool *OUTPUT, bool *OUTPUT) ;
205 bool GetFixedWidth();
206 bool GetFixedHeight();
207 void SetSpaceAttachments(bool sp);
208 bool GetSpaceAttachments() ;
209 void SetShadowMode(int mode, bool redraw = False);
211 bool HitTest(double x, double y, int *OUTPUT, double *OUTPUT);
212 void SetCentreResize(bool cr);
213 bool GetCentreResize();
214 void SetMaintainAspectRatio(bool ar);
215 bool GetMaintainAspectRatio();
218 // wxList& GetLines();
220 PyObject* GetLines() {
221 wxList& list = self->GetLines();
222 return wxPy_ConvertShapeList(&list);
226 void SetDisableLabel(bool flag);
227 bool GetDisableLabel();
228 void SetAttachmentMode(int mode);
229 int GetAttachmentMode();
233 void SetPen(wxPen *pen);
234 void SetBrush(wxBrush *brush);
237 // void SetClientData(wxObject *client_data);
238 // wxObject *GetClientData();
240 // The real client data methods are being used for OOR, so just fake it.
242 def SetClientData(self, data):
243 self.clientData = data
244 def GetClientData(self):
245 if hasattr(self, 'clientData'):
246 return self.clientData
251 void Show(bool show);
253 void Move(wxDC& dc, double x1, double y1, bool display = True);
254 void Erase(wxDC& dc);
255 void EraseContents(wxDC& dc);
258 void MoveLinks(wxDC& dc);
259 void DrawContents(wxDC& dc);
260 void SetSize(double x, double y, bool recursive = True);
261 void SetAttachmentSize(double x, double y);
262 void Attach(wxPyShapeCanvas *can);
265 void AddLine(wxPyLineShape *line, wxPyShape *other,
266 int attachFrom = 0, int attachTo = 0,
267 int positionFrom = -1, int positionTo = -1);
268 int GetLinePosition(wxPyLineShape* line);
269 void AddText(const wxString& string);
272 void SetDefaultRegionSize();
273 void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
274 void SetFormatMode(int mode, int regionId = 0);
275 int GetFormatMode(int regionId = 0);
276 void SetFont(wxFont *font, int regionId = 0);
277 wxFont *GetFont(int regionId = 0);
278 void SetTextColour(const wxString& colour, int regionId = 0);
279 wxString GetTextColour(int regionId = 0);
280 int GetNumberOfTextRegions();
281 void SetRegionName(const wxString& name, int regionId = 0);
282 wxString GetRegionName(int regionId);
283 int GetRegionId(const wxString& name);
284 void NameRegions(const wxString& parentName = wxPyEmptyString);
286 // wxList& GetRegions();
288 PyObject* GetRegions() {
289 wxList& list = self->GetRegions();
290 return wxPy_ConvertList(&list);
294 void AddRegion(wxShapeRegion *region);
297 wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT);
298 void FindRegionNames(wxStringList& list);
299 void ClearText(int regionId = 0);
300 void RemoveLine(wxPyLineShape *line);
302 #ifdef wxUSE_PROLOGIO
303 void WriteAttributes(wxExpr *clause);
304 void ReadAttributes(wxExpr *clause);
305 void ReadConstraints(wxExpr *clause, wxExprDatabase *database);
306 void WriteRegions(wxExpr *clause);
307 void ReadRegions(wxExpr *clause);
310 bool GetAttachmentPosition(int attachment, double *OUTPUT, double *OUTPUT,
311 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
312 int GetNumberOfAttachments();
313 bool AttachmentIsValid(int attachment);
316 PyObject* GetAttachments() {
317 wxList& list = self->GetAttachments();
318 return wxPy_ConvertList(&list);
322 bool GetAttachmentPositionEdge(int attachment, double *OUTPUT, double *OUTPUT,
323 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
324 wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2,
325 int nth, int noArcs, wxPyLineShape* line);
326 bool AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, const wxRealPoint& pt2);
327 void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = False);
328 void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = False);
329 bool MoveLineToNewAttachment(wxDC& dc, wxPyLineShape *to_move,
332 //void ApplyAttachmentOrdering(wxList& linesToSort);
334 void ApplyAttachmentOrdering(PyObject* linesToSort) {
335 wxList* list = wxPy_wxListHelper(linesToSort, wxT("wxPyLineShape"));
336 self->ApplyAttachmentOrdering(*list);
341 wxRealPoint GetBranchingAttachmentRoot(int attachment);
342 bool GetBranchingAttachmentInfo(int attachment, wxRealPoint& root, wxRealPoint& neck,
343 wxRealPoint& shoulder1, wxRealPoint& shoulder2);
344 bool GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& attachmentPoint,
345 wxRealPoint& stemPoint);
346 int GetAttachmentLineCount(int attachment);
347 void SetBranchNeckLength(int len);
348 int GetBranchNeckLength();
349 void SetBranchStemLength(int len);
350 int GetBranchStemLength();
351 void SetBranchSpacing(int len);
352 int GetBranchSpacing();
353 void SetBranchStyle(long style);
354 long GetBranchStyle();
355 int PhysicalToLogicalAttachment(int physicalAttachment);
356 int LogicalToPhysicalAttachment(int logicalAttachment);
358 bool HasDescendant(wxPyShape *image);
359 wxPyShape *CreateNewCopy(bool resetMapping = True, bool recompute = True);
360 void Copy(wxPyShape& copy);
361 void CopyWithHandler(wxPyShape& copy);
362 void Rotate(double x, double y, double theta);
363 double GetRotation();
364 void SetRotation(double rotation);
365 void ClearAttachments();
366 void Recentre(wxDC& dc);
367 void ClearPointList(wxList& list);
368 wxPen GetBackgroundPen();
369 wxBrush GetBackgroundBrush();
371 void base_OnDelete();
372 void base_OnDraw(wxDC& dc);
373 void base_OnDrawContents(wxDC& dc);
374 void base_OnDrawBranches(wxDC& dc, bool erase = False);
375 void base_OnMoveLinks(wxDC& dc);
376 void base_OnErase(wxDC& dc);
377 void base_OnEraseContents(wxDC& dc);
378 void base_OnHighlight(wxDC& dc);
379 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
380 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
381 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
382 void base_OnSize(double x, double y);
383 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True);
384 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True);
385 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
386 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
387 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
388 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
389 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
390 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
391 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
392 void base_OnDrawControlPoints(wxDC& dc);
393 void base_OnEraseControlPoints(wxDC& dc);
394 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = True);
395 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
396 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
397 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
398 void base_OnBeginSize(double w, double h);
399 void base_OnEndSize(double w, double h);
400 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
403 //---------------------------------------------------------------------------