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 self->SetClientObject(new wxPyOORClientData(_self));
96 def _setOORandCallbackInfo(self, _class):
97 self._setOORInfo(self)
98 self._setCallbackInfo(self, _class)
102 void SetShape(wxPyShape *sh);
103 wxPyShape *GetShape();
104 void SetPreviousHandler(wxPyShapeEvtHandler* handler);
105 wxPyShapeEvtHandler* GetPreviousHandler();
106 wxPyShapeEvtHandler* CreateNewCopy();
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);
140 //---------------------------------------------------------------------------
142 WXSHAPE_IMP_CALLBACKS(wxPyShape, wxShape);
146 class wxPyShape : public wxPyShapeEvtHandler {
148 %pythonAppend wxPyShape "self._setOORandCallbackInfo(PyShape)"
150 wxPyShape(wxPyShapeCanvas *can = NULL);
152 void _setCallbackInfo(PyObject* self, PyObject* _class);
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);
168 wxPyShape *GetParent();
169 void SetParent(wxPyShape *p);
170 wxPyShape *GetTopAncestor();
173 // wxList& GetChildren();
175 PyObject* GetChildren() {
176 wxList& list = self->GetChildren();
177 return wxPy_ConvertShapeList(&list);
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();
193 void CalculateSize();
194 void Select(bool select = True, wxDC* dc = NULL);
195 void SetHighlight(bool hi = True, bool recurse = False);
196 bool IsHighlighted() ;
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);
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();
217 // wxList& GetLines();
219 PyObject* GetLines() {
220 wxList& list = self->GetLines();
221 return wxPy_ConvertShapeList(&list);
225 void SetDisableLabel(bool flag);
226 bool GetDisableLabel();
227 void SetAttachmentMode(int mode);
228 int GetAttachmentMode();
232 void SetPen(wxPen *pen);
233 void SetBrush(wxBrush *brush);
236 // void SetClientData(wxObject *client_data);
237 // wxObject *GetClientData();
239 // The real client data methods are being used for OOR, so just fake it.
241 def SetClientData(self, data):
242 self.clientData = data
243 def GetClientData(self):
244 if hasattr(self, 'clientData'):
245 return self.clientData
250 void Show(bool show);
252 void Move(wxDC& dc, double x1, double y1, bool display = True);
253 void Erase(wxDC& dc);
254 void EraseContents(wxDC& dc);
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);
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);
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);
285 // wxList& GetRegions();
287 PyObject* GetRegions() {
288 wxList& list = self->GetRegions();
289 return wxPy_ConvertList(&list);
293 void AddRegion(wxShapeRegion *region);
296 wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT);
297 void FindRegionNames(wxStringList& list);
298 void ClearText(int regionId = 0);
299 void RemoveLine(wxPyLineShape *line);
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);
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);
315 PyObject* GetAttachments() {
316 wxList& list = self->GetAttachments();
317 return wxPy_ConvertList(&list);
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,
331 //void ApplyAttachmentOrdering(wxList& linesToSort);
333 void ApplyAttachmentOrdering(PyObject* linesToSort) {
334 wxList* list = wxPy_wxListHelper(linesToSort, wxT("wxPyLineShape"));
335 self->ApplyAttachmentOrdering(*list);
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);
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();
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);
402 //---------------------------------------------------------------------------