]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/ogl/_oglbasic.i
reSWIGged
[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)"
d14a1e28 85
e91a9dfc
RD
86 wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL,
87 wxPyShape *shape = NULL);
88
0122b7e3 89 void _setCallbackInfo(PyObject* self, PyObject* _class);
d14a1e28 90 %extend {
2f4e9287 91 void _setOORInfo(PyObject* _self) {
4acff284 92 self->SetClientObject(new wxPyOORClientData(_self));
2f4e9287
RD
93 }
94 }
d14a1e28
RD
95 %pythoncode {
96 def _setOORandCallbackInfo(self, _class):
97 self._setOORInfo(self)
98 self._setCallbackInfo(self, _class)
99 }
2f4e9287 100
d14a1e28 101
e91a9dfc
RD
102 void SetShape(wxPyShape *sh);
103 wxPyShape *GetShape();
104 void SetPreviousHandler(wxPyShapeEvtHandler* handler);
105 wxPyShapeEvtHandler* GetPreviousHandler();
106 wxPyShapeEvtHandler* CreateNewCopy();
107
108 void base_OnDelete();
109 void base_OnDraw(wxDC& dc);
110 void base_OnDrawContents(wxDC& dc);
dd9f7fea 111 void base_OnDrawBranches(wxDC& dc, bool erase = False);
e91a9dfc
RD
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);
dd9f7fea
RD
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);
e91a9dfc
RD
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);
dd9f7fea 131 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = True);
2348eaee
RD
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);
e91a9dfc
RD
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);
138};
139
140//---------------------------------------------------------------------------
141%{
142 WXSHAPE_IMP_CALLBACKS(wxPyShape, wxShape);
143%}
144
145
146class wxPyShape : public wxPyShapeEvtHandler {
147public:
2b9048c5 148 %pythonAppend wxPyShape "self._setOORandCallbackInfo(PyShapeEvtHandler)"
d14a1e28
RD
149
150 wxPyShape(wxPyShapeCanvas *can = NULL);
e91a9dfc 151
0122b7e3 152 void _setCallbackInfo(PyObject* self, PyObject* _class);
e91a9dfc
RD
153
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);
164 double GetX();
165 double GetY();
166 void SetX(double x);
167 void SetY(double y);
168 wxPyShape *GetParent();
169 void SetParent(wxPyShape *p);
170 wxPyShape *GetTopAncestor();
171
172
173 // wxList& GetChildren();
d14a1e28 174 %extend {
e91a9dfc
RD
175 PyObject* GetChildren() {
176 wxList& list = self->GetChildren();
d14a1e28 177 return wxPy_ConvertShapeList(&list);
e91a9dfc
RD
178 }
179 }
180
181
182 void Unlink();
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();
192 bool Recompute();
193 void CalculateSize();
dd9f7fea
RD
194 void Select(bool select = True, wxDC* dc = NULL);
195 void SetHighlight(bool hi = True, bool recurse = False);
e91a9dfc
RD
196 bool IsHighlighted() ;
197 bool Selected();
198 bool AncestorSelected();
dd9f7fea 199 void SetSensitivityFilter(int sens = OP_ALL, bool recursive = False);
e91a9dfc 200 int GetSensitivityFilter();
dd9f7fea 201 void SetDraggable(bool drag, bool recursive = False);
e91a9dfc
RD
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() ;
dd9f7fea 208 void SetShadowMode(int mode, bool redraw = False);
e91a9dfc
RD
209 int GetShadowMode();
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();
215
216
217 // wxList& GetLines();
d14a1e28 218 %extend {
e91a9dfc
RD
219 PyObject* GetLines() {
220 wxList& list = self->GetLines();
d14a1e28 221 return wxPy_ConvertShapeList(&list);
e91a9dfc
RD
222 }
223 }
224
225 void SetDisableLabel(bool flag);
226 bool GetDisableLabel();
227 void SetAttachmentMode(int mode);
228 int GetAttachmentMode();
229 void SetId(long i);
230 long GetId();
d74525f7 231
e91a9dfc
RD
232 void SetPen(wxPen *pen);
233 void SetBrush(wxBrush *brush);
714d23b4 234
d74525f7 235
714d23b4
RD
236 // void SetClientData(wxObject *client_data);
237 // wxObject *GetClientData();
714d23b4 238
1dc302a8 239 // The real client data methods are being used for OOR, so just fake it.
d14a1e28 240 %pythoncode {
1dc302a8
RD
241 def SetClientData(self, data):
242 self.clientData = data
243 def GetClientData(self):
244 if hasattr(self, 'clientData'):
245 return self.clientData
246 else:
247 return None
d14a1e28 248 }
714d23b4 249
e91a9dfc
RD
250 void Show(bool show);
251 bool IsShown();
dd9f7fea 252 void Move(wxDC& dc, double x1, double y1, bool display = True);
e91a9dfc
RD
253 void Erase(wxDC& dc);
254 void EraseContents(wxDC& dc);
255 void Draw(wxDC& dc);
256 void Flash();
257 void MoveLinks(wxDC& dc);
258 void DrawContents(wxDC& dc);
dd9f7fea 259 void SetSize(double x, double y, bool recursive = True);
e91a9dfc
RD
260 void SetAttachmentSize(double x, double y);
261 void Attach(wxPyShapeCanvas *can);
262 void Detach();
263 bool Constrain();
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);
269 wxPen *GetPen();
270 wxBrush *GetBrush();
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);
dec9fa49 283 void NameRegions(const wxString& parentName = wxPyEmptyString);
e91a9dfc
RD
284
285 // wxList& GetRegions();
d14a1e28 286 %extend {
e91a9dfc
RD
287 PyObject* GetRegions() {
288 wxList& list = self->GetRegions();
d14a1e28 289 return wxPy_ConvertList(&list);
e91a9dfc
RD
290 }
291 }
292
293 void AddRegion(wxShapeRegion *region);
294 void ClearRegions();
295 void AssignNewIds();
f6bcfd97 296 wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT);
e91a9dfc
RD
297 void FindRegionNames(wxStringList& list);
298 void ClearText(int regionId = 0);
299 void RemoveLine(wxPyLineShape *line);
300
1e4a197e 301#ifdef wxUSE_PROLOGIO
e91a9dfc
RD
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);
307#endif
308
714d23b4 309 bool GetAttachmentPosition(int attachment, double *OUTPUT, double *OUTPUT,
e91a9dfc
RD
310 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
311 int GetNumberOfAttachments();
312 bool AttachmentIsValid(int attachment);
e7726f5e
RD
313
314 %extend {
315 PyObject* GetAttachments() {
316 wxList& list = self->GetAttachments();
317 return wxPy_ConvertList(&list);
318 }
319 }
320
714d23b4 321 bool GetAttachmentPositionEdge(int attachment, double *OUTPUT, double *OUTPUT,
e91a9dfc
RD
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);
dd9f7fea
RD
326 void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = False);
327 void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = False);
e91a9dfc
RD
328 bool MoveLineToNewAttachment(wxDC& dc, wxPyLineShape *to_move,
329 double x, double y);
330
331 //void ApplyAttachmentOrdering(wxList& linesToSort);
d14a1e28 332 %extend {
e91a9dfc 333 void ApplyAttachmentOrdering(PyObject* linesToSort) {
d14a1e28 334 wxList* list = wxPy_wxListHelper(linesToSort, wxT("wxPyLineShape"));
e91a9dfc
RD
335 self->ApplyAttachmentOrdering(*list);
336 delete list;
337 }
338 }
339
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);
356 bool Draggable();
357 bool HasDescendant(wxPyShape *image);
dd9f7fea 358 wxPyShape *CreateNewCopy(bool resetMapping = True, bool recompute = True);
e91a9dfc
RD
359 void Copy(wxPyShape& copy);
360 void CopyWithHandler(wxPyShape& copy);
361 void Rotate(double x, double y, double theta);
362 double GetRotation();
e7726f5e 363 void SetRotation(double rotation);
e91a9dfc
RD
364 void ClearAttachments();
365 void Recentre(wxDC& dc);
366 void ClearPointList(wxList& list);
2f4e9287
RD
367 wxPen GetBackgroundPen();
368 wxBrush GetBackgroundBrush();
e91a9dfc
RD
369
370 void base_OnDelete();
371 void base_OnDraw(wxDC& dc);
372 void base_OnDrawContents(wxDC& dc);
dd9f7fea 373 void base_OnDrawBranches(wxDC& dc, bool erase = False);
e91a9dfc
RD
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);
dd9f7fea
RD
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);
e91a9dfc
RD
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);
dd9f7fea 393 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = True);
2348eaee
RD
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);
e91a9dfc
RD
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);
400};
401
402//---------------------------------------------------------------------------
403