]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/ogl/_oglbasic.i
SWIG patch for "autodoc" and "docstring" %features
[wxWidgets.git] / wxPython / contrib / ogl / _oglbasic.i
CommitLineData
e91a9dfc
RD
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
d14a1e28 14// Not a %module
e91a9dfc 15
e91a9dfc 16
e91a9dfc 17//---------------------------------------------------------------------------
d14a1e28 18%newgroup;
e91a9dfc
RD
19
20
9416aa89 21class wxShapeRegion : public wxObject {
e91a9dfc
RD
22public:
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();
f6bcfd97
BP
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);
e91a9dfc
RD
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 WXSHAPE_IMP_CALLBACKS(wxPyShapeEvtHandler,wxShapeEvtHandler);
63%}
64
65
9416aa89 66class wxPyShapeEvtHandler : public wxObject {
e91a9dfc 67public:
d14a1e28
RD
68 %addtofunc wxPyShapeEvtHandler "self._setOORandCallbackInfo(PyShapeEvtHandler)"
69
e91a9dfc
RD
70 wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL,
71 wxPyShape *shape = NULL);
72
0122b7e3 73 void _setCallbackInfo(PyObject* self, PyObject* _class);
d14a1e28 74 %extend {
2f4e9287 75 void _setOORInfo(PyObject* _self) {
4acff284 76 self->SetClientObject(new wxPyOORClientData(_self));
2f4e9287
RD
77 }
78 }
d14a1e28
RD
79 %pythoncode {
80 def _setOORandCallbackInfo(self, _class):
81 self._setOORInfo(self)
82 self._setCallbackInfo(self, _class)
83 }
2f4e9287 84
d14a1e28 85
e91a9dfc
RD
86 void SetShape(wxPyShape *sh);
87 wxPyShape *GetShape();
88 void SetPreviousHandler(wxPyShapeEvtHandler* handler);
89 wxPyShapeEvtHandler* GetPreviousHandler();
90 wxPyShapeEvtHandler* CreateNewCopy();
91
92 void base_OnDelete();
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);
2348eaee
RD
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);
e91a9dfc
RD
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);
122};
123
124//---------------------------------------------------------------------------
125%{
126 WXSHAPE_IMP_CALLBACKS(wxPyShape, wxShape);
127%}
128
129
130class wxPyShape : public wxPyShapeEvtHandler {
131public:
d14a1e28
RD
132 %addtofunc wxPyShape "self._setOORandCallbackInfo(PyShapeEvtHandler)"
133
134 wxPyShape(wxPyShapeCanvas *can = NULL);
e91a9dfc 135
0122b7e3 136 void _setCallbackInfo(PyObject* self, PyObject* _class);
e91a9dfc
RD
137
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);
148 double GetX();
149 double GetY();
150 void SetX(double x);
151 void SetY(double y);
152 wxPyShape *GetParent();
153 void SetParent(wxPyShape *p);
154 wxPyShape *GetTopAncestor();
155
156
157 // wxList& GetChildren();
d14a1e28 158 %extend {
e91a9dfc
RD
159 PyObject* GetChildren() {
160 wxList& list = self->GetChildren();
d14a1e28 161 return wxPy_ConvertShapeList(&list);
e91a9dfc
RD
162 }
163 }
164
165
166 void Unlink();
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();
176 bool Recompute();
177 void CalculateSize();
178 void Select(bool select = TRUE, wxDC* dc = NULL);
179 void SetHighlight(bool hi = TRUE, bool recurse = FALSE);
180 bool IsHighlighted() ;
181 bool Selected();
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);
193 int GetShadowMode();
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();
199
200
201 // wxList& GetLines();
d14a1e28 202 %extend {
e91a9dfc
RD
203 PyObject* GetLines() {
204 wxList& list = self->GetLines();
d14a1e28 205 return wxPy_ConvertShapeList(&list);
e91a9dfc
RD
206 }
207 }
208
209 void SetDisableLabel(bool flag);
210 bool GetDisableLabel();
211 void SetAttachmentMode(int mode);
212 int GetAttachmentMode();
213 void SetId(long i);
214 long GetId();
d74525f7 215
e91a9dfc
RD
216 void SetPen(wxPen *pen);
217 void SetBrush(wxBrush *brush);
714d23b4 218
d74525f7 219
714d23b4
RD
220 // void SetClientData(wxObject *client_data);
221 // wxObject *GetClientData();
714d23b4 222
1dc302a8 223 // The real client data methods are being used for OOR, so just fake it.
d14a1e28 224 %pythoncode {
1dc302a8
RD
225 def SetClientData(self, data):
226 self.clientData = data
227 def GetClientData(self):
228 if hasattr(self, 'clientData'):
229 return self.clientData
230 else:
231 return None
d14a1e28 232 }
714d23b4 233
e91a9dfc
RD
234 void Show(bool show);
235 bool IsShown();
236 void Move(wxDC& dc, double x1, double y1, bool display = TRUE);
237 void Erase(wxDC& dc);
238 void EraseContents(wxDC& dc);
239 void Draw(wxDC& dc);
240 void Flash();
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);
246 void Detach();
247 bool Constrain();
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);
253 wxPen *GetPen();
254 wxBrush *GetBrush();
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 = "");
268
269 // wxList& GetRegions();
d14a1e28 270 %extend {
e91a9dfc
RD
271 PyObject* GetRegions() {
272 wxList& list = self->GetRegions();
d14a1e28 273 return wxPy_ConvertList(&list);
e91a9dfc
RD
274 }
275 }
276
277 void AddRegion(wxShapeRegion *region);
278 void ClearRegions();
279 void AssignNewIds();
f6bcfd97 280 wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT);
e91a9dfc
RD
281 void FindRegionNames(wxStringList& list);
282 void ClearText(int regionId = 0);
283 void RemoveLine(wxPyLineShape *line);
284
1e4a197e 285#ifdef wxUSE_PROLOGIO
e91a9dfc
RD
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);
291#endif
292
714d23b4 293 bool GetAttachmentPosition(int attachment, double *OUTPUT, double *OUTPUT,
e91a9dfc
RD
294 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
295 int GetNumberOfAttachments();
296 bool AttachmentIsValid(int attachment);
714d23b4 297 bool GetAttachmentPositionEdge(int attachment, double *OUTPUT, double *OUTPUT,
e91a9dfc
RD
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,
305 double x, double y);
306
307 //void ApplyAttachmentOrdering(wxList& linesToSort);
d14a1e28 308 %extend {
e91a9dfc 309 void ApplyAttachmentOrdering(PyObject* linesToSort) {
d14a1e28 310 wxList* list = wxPy_wxListHelper(linesToSort, wxT("wxPyLineShape"));
e91a9dfc
RD
311 self->ApplyAttachmentOrdering(*list);
312 delete list;
313 }
314 }
315
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);
332 bool Draggable();
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);
2f4e9287
RD
342 wxPen GetBackgroundPen();
343 wxBrush GetBackgroundBrush();
e91a9dfc
RD
344
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);
2348eaee
RD
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);
e91a9dfc
RD
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);
375};
376
377//---------------------------------------------------------------------------
378