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 WXSHAPE_IMP_CALLBACKS(wxPyShapeEvtHandler,wxShapeEvtHandler);
66 class wxPyShapeEvtHandler : public wxObject {
68 %addtofunc wxPyShapeEvtHandler "self._setOORandCallbackInfo(PyShapeEvtHandler)"
70 wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL,
71 wxPyShape *shape = NULL);
73 void _setCallbackInfo(PyObject* self, PyObject* _class);
75 void _setOORInfo(PyObject* _self) {
76 self->SetClientObject(new wxPyOORClientData(_self));
80 def _setOORandCallbackInfo(self, _class):
81 self._setOORInfo(self)
82 self._setCallbackInfo(self, _class)
86 void SetShape(wxPyShape *sh);
87 wxPyShape *GetShape();
88 void SetPreviousHandler(wxPyShapeEvtHandler* handler);
89 wxPyShapeEvtHandler* GetPreviousHandler();
90 wxPyShapeEvtHandler* CreateNewCopy();
93 void base_OnDraw(wxDC& dc);
94 void base_OnDrawContents(wxDC& dc);
95 void base_OnDrawBranches(wxDC& dc, bool erase = False);
96 void base_OnMoveLinks(wxDC& dc);
97 void base_OnErase(wxDC& dc);
98 void base_OnEraseContents(wxDC& dc);
99 void base_OnHighlight(wxDC& dc);
100 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
101 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
102 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
103 void base_OnSize(double x, double y);
104 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True);
105 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True);
106 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
107 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
108 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
109 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
110 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
111 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
112 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
113 void base_OnDrawControlPoints(wxDC& dc);
114 void base_OnEraseControlPoints(wxDC& dc);
115 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = True);
116 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
117 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
118 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
119 void base_OnBeginSize(double w, double h);
120 void base_OnEndSize(double w, double h);
121 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
124 //---------------------------------------------------------------------------
126 WXSHAPE_IMP_CALLBACKS(wxPyShape, wxShape);
130 class wxPyShape : public wxPyShapeEvtHandler {
132 %addtofunc wxPyShape "self._setOORandCallbackInfo(PyShapeEvtHandler)"
134 wxPyShape(wxPyShapeCanvas *can = NULL);
136 void _setCallbackInfo(PyObject* self, PyObject* _class);
138 void GetBoundingBoxMax(double *OUTPUT, double *OUTPUT);
139 void GetBoundingBoxMin(double *OUTPUT, double *OUTPUT);
140 bool GetPerimeterPoint(double x1, double y1,
141 double x2, double y2,
142 double *OUTPUT, double *OUTPUT);
143 wxPyShapeCanvas *GetCanvas();
144 void SetCanvas(wxPyShapeCanvas *the_canvas);
145 void AddToCanvas(wxPyShapeCanvas *the_canvas, wxPyShape *addAfter = NULL);
146 void InsertInCanvas(wxPyShapeCanvas *the_canvas);
147 void RemoveFromCanvas(wxPyShapeCanvas *the_canvas);
152 wxPyShape *GetParent();
153 void SetParent(wxPyShape *p);
154 wxPyShape *GetTopAncestor();
157 // wxList& GetChildren();
159 PyObject* GetChildren() {
160 wxList& list = self->GetChildren();
161 return wxPy_ConvertShapeList(&list);
167 void SetDrawHandles(bool drawH);
168 bool GetDrawHandles();
169 void MakeControlPoints();
170 void DeleteControlPoints(wxDC *dc = NULL);
171 void ResetControlPoints();
172 wxPyShapeEvtHandler *GetEventHandler();
173 void SetEventHandler(wxPyShapeEvtHandler *handler);
174 void MakeMandatoryControlPoints();
175 void ResetMandatoryControlPoints();
177 void CalculateSize();
178 void Select(bool select = True, wxDC* dc = NULL);
179 void SetHighlight(bool hi = True, bool recurse = False);
180 bool IsHighlighted() ;
182 bool AncestorSelected();
183 void SetSensitivityFilter(int sens = OP_ALL, bool recursive = False);
184 int GetSensitivityFilter();
185 void SetDraggable(bool drag, bool recursive = False);
186 void SetFixedSize(bool x, bool y);
187 void GetFixedSize(bool *OUTPUT, bool *OUTPUT) ;
188 bool GetFixedWidth();
189 bool GetFixedHeight();
190 void SetSpaceAttachments(bool sp);
191 bool GetSpaceAttachments() ;
192 void SetShadowMode(int mode, bool redraw = False);
194 bool HitTest(double x, double y, int *OUTPUT, double *OUTPUT);
195 void SetCentreResize(bool cr);
196 bool GetCentreResize();
197 void SetMaintainAspectRatio(bool ar);
198 bool GetMaintainAspectRatio();
201 // wxList& GetLines();
203 PyObject* GetLines() {
204 wxList& list = self->GetLines();
205 return wxPy_ConvertShapeList(&list);
209 void SetDisableLabel(bool flag);
210 bool GetDisableLabel();
211 void SetAttachmentMode(int mode);
212 int GetAttachmentMode();
216 void SetPen(wxPen *pen);
217 void SetBrush(wxBrush *brush);
220 // void SetClientData(wxObject *client_data);
221 // wxObject *GetClientData();
223 // The real client data methods are being used for OOR, so just fake it.
225 def SetClientData(self, data):
226 self.clientData = data
227 def GetClientData(self):
228 if hasattr(self, 'clientData'):
229 return self.clientData
234 void Show(bool show);
236 void Move(wxDC& dc, double x1, double y1, bool display = True);
237 void Erase(wxDC& dc);
238 void EraseContents(wxDC& dc);
241 void MoveLinks(wxDC& dc);
242 void DrawContents(wxDC& dc);
243 void SetSize(double x, double y, bool recursive = True);
244 void SetAttachmentSize(double x, double y);
245 void Attach(wxPyShapeCanvas *can);
248 void AddLine(wxPyLineShape *line, wxPyShape *other,
249 int attachFrom = 0, int attachTo = 0,
250 int positionFrom = -1, int positionTo = -1);
251 int GetLinePosition(wxPyLineShape* line);
252 void AddText(const wxString& string);
255 void SetDefaultRegionSize();
256 void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
257 void SetFormatMode(int mode, int regionId = 0);
258 int GetFormatMode(int regionId = 0);
259 void SetFont(wxFont *font, int regionId = 0);
260 wxFont *GetFont(int regionId = 0);
261 void SetTextColour(const wxString& colour, int regionId = 0);
262 wxString GetTextColour(int regionId = 0);
263 int GetNumberOfTextRegions();
264 void SetRegionName(const wxString& name, int regionId = 0);
265 wxString GetRegionName(int regionId);
266 int GetRegionId(const wxString& name);
267 void NameRegions(const wxString& parentName = wxPyEmptyString);
269 // wxList& GetRegions();
271 PyObject* GetRegions() {
272 wxList& list = self->GetRegions();
273 return wxPy_ConvertList(&list);
277 void AddRegion(wxShapeRegion *region);
280 wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT);
281 void FindRegionNames(wxStringList& list);
282 void ClearText(int regionId = 0);
283 void RemoveLine(wxPyLineShape *line);
285 #ifdef wxUSE_PROLOGIO
286 void WriteAttributes(wxExpr *clause);
287 void ReadAttributes(wxExpr *clause);
288 void ReadConstraints(wxExpr *clause, wxExprDatabase *database);
289 void WriteRegions(wxExpr *clause);
290 void ReadRegions(wxExpr *clause);
293 bool GetAttachmentPosition(int attachment, double *OUTPUT, double *OUTPUT,
294 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
295 int GetNumberOfAttachments();
296 bool AttachmentIsValid(int attachment);
297 bool GetAttachmentPositionEdge(int attachment, double *OUTPUT, double *OUTPUT,
298 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
299 wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2,
300 int nth, int noArcs, wxPyLineShape* line);
301 bool AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, const wxRealPoint& pt2);
302 void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = False);
303 void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = False);
304 bool MoveLineToNewAttachment(wxDC& dc, wxPyLineShape *to_move,
307 //void ApplyAttachmentOrdering(wxList& linesToSort);
309 void ApplyAttachmentOrdering(PyObject* linesToSort) {
310 wxList* list = wxPy_wxListHelper(linesToSort, wxT("wxPyLineShape"));
311 self->ApplyAttachmentOrdering(*list);
316 wxRealPoint GetBranchingAttachmentRoot(int attachment);
317 bool GetBranchingAttachmentInfo(int attachment, wxRealPoint& root, wxRealPoint& neck,
318 wxRealPoint& shoulder1, wxRealPoint& shoulder2);
319 bool GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& attachmentPoint,
320 wxRealPoint& stemPoint);
321 int GetAttachmentLineCount(int attachment);
322 void SetBranchNeckLength(int len);
323 int GetBranchNeckLength();
324 void SetBranchStemLength(int len);
325 int GetBranchStemLength();
326 void SetBranchSpacing(int len);
327 int GetBranchSpacing();
328 void SetBranchStyle(long style);
329 long GetBranchStyle();
330 int PhysicalToLogicalAttachment(int physicalAttachment);
331 int LogicalToPhysicalAttachment(int logicalAttachment);
333 bool HasDescendant(wxPyShape *image);
334 wxPyShape *CreateNewCopy(bool resetMapping = True, bool recompute = True);
335 void Copy(wxPyShape& copy);
336 void CopyWithHandler(wxPyShape& copy);
337 void Rotate(double x, double y, double theta);
338 double GetRotation();
339 void ClearAttachments();
340 void Recentre(wxDC& dc);
341 void ClearPointList(wxList& list);
342 wxPen GetBackgroundPen();
343 wxBrush GetBackgroundBrush();
345 void base_OnDelete();
346 void base_OnDraw(wxDC& dc);
347 void base_OnDrawContents(wxDC& dc);
348 void base_OnDrawBranches(wxDC& dc, bool erase = False);
349 void base_OnMoveLinks(wxDC& dc);
350 void base_OnErase(wxDC& dc);
351 void base_OnEraseContents(wxDC& dc);
352 void base_OnHighlight(wxDC& dc);
353 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
354 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
355 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
356 void base_OnSize(double x, double y);
357 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True);
358 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = True);
359 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
360 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
361 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
362 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
363 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
364 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
365 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
366 void base_OnDrawControlPoints(wxDC& dc);
367 void base_OnEraseControlPoints(wxDC& dc);
368 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = True);
369 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
370 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
371 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
372 void base_OnBeginSize(double w, double h);
373 void base_OnEndSize(double w, double h);
374 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
377 //---------------------------------------------------------------------------