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