]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/ogl/oglbasic.i
compilation fix
[wxWidgets.git] / wxPython / contrib / ogl / oglbasic.i
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
14 %module oglbasic
15
16 %{
17 #include "export.h"
18 #include "oglhelpers.h"
19 %}
20
21 //---------------------------------------------------------------------------
22
23 %include typemaps.i
24 %include my_typemaps.i
25
26 %extern wx.i
27 %import windows.i
28 %extern _defs.i
29 %extern misc.i
30 %extern gdi.i
31
32 %include _ogldefs.i
33
34 //%extern oglcanvas.i
35
36
37 %pragma(python) code = "import wx"
38 %pragma(python) code = "from oglcanvas import wxPyShapeCanvasPtr"
39
40 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
42 //---------------------------------------------------------------------------
43
44
45 class wxShapeRegion : public wxObject {
46 public:
47 wxShapeRegion();
48 //~wxShapeRegion();
49
50 void SetText(const wxString& s);
51 void SetFont(wxFont *f);
52 void SetMinSize(double w, double h);
53 void SetSize(double w, double h);
54 void SetPosition(double x, double y);
55 void SetProportions(double x, double y);
56 void SetFormatMode(int mode);
57 void SetName(const wxString& s);
58 void SetColour(const wxString& col);
59
60 wxString GetText();
61 wxFont *GetFont();
62 void GetMinSize(double *OUTPUT, double *OUTPUT);
63 void GetProportion(double *OUTPUT, double *OUTPUT);
64 void GetSize(double *OUTPUT, double *OUTPUT);
65 void GetPosition(double *OUTPUT, double *OUTPUT);
66 int GetFormatMode();
67 wxString GetName();
68 wxString GetColour();
69 wxColour *GetActualColourObject();
70 wxList& GetFormattedText();
71 wxString GetPenColour();
72 int GetPenStyle();
73 void SetPenStyle(int style);
74 void SetPenColour(const wxString& col);
75 wxPen *GetActualPen();
76 double GetWidth();
77 double GetHeight();
78
79 void ClearText();
80 };
81
82
83 //---------------------------------------------------------------------------
84
85 %{
86 WXSHAPE_IMP_CALLBACKS(wxPyShapeEvtHandler,wxShapeEvtHandler);
87 %}
88
89
90 class wxPyShapeEvtHandler : public wxObject {
91 public:
92 wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL,
93 wxPyShape *shape = NULL);
94
95 void _setCallbackInfo(PyObject* self, PyObject* _class);
96 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShapeEvtHandler)"
97 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
98
99 %addmethods { void Destroy() { delete self; } }
100 %addmethods {
101 void _setOORInfo(PyObject* _self) {
102 self->SetClientObject(new wxPyClientData(_self));
103 }
104 }
105
106
107 void SetShape(wxPyShape *sh);
108 wxPyShape *GetShape();
109 void SetPreviousHandler(wxPyShapeEvtHandler* handler);
110 wxPyShapeEvtHandler* GetPreviousHandler();
111 wxPyShapeEvtHandler* CreateNewCopy();
112
113 void base_OnDelete();
114 void base_OnDraw(wxDC& dc);
115 void base_OnDrawContents(wxDC& dc);
116 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
117 void base_OnMoveLinks(wxDC& dc);
118 void base_OnErase(wxDC& dc);
119 void base_OnEraseContents(wxDC& dc);
120 void base_OnHighlight(wxDC& dc);
121 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
122 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
123 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
124 void base_OnSize(double x, double y);
125 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
126 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
127 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
128 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
129 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
130 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
131 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
132 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
133 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
134 void base_OnDrawControlPoints(wxDC& dc);
135 void base_OnEraseControlPoints(wxDC& dc);
136 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
137 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
138 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
139 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
140 void base_OnBeginSize(double w, double h);
141 void base_OnEndSize(double w, double h);
142 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
143 };
144
145 //---------------------------------------------------------------------------
146 %{
147 WXSHAPE_IMP_CALLBACKS(wxPyShape, wxShape);
148 %}
149
150
151 class wxPyShape : public wxPyShapeEvtHandler {
152 public:
153 // wxPyShape(wxPyShapeCanvas *can = NULL); abstract base class...
154
155 void _setCallbackInfo(PyObject* self, PyObject* _class);
156 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShape)"
157 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
158
159 void GetBoundingBoxMax(double *OUTPUT, double *OUTPUT);
160 void GetBoundingBoxMin(double *OUTPUT, double *OUTPUT);
161 bool GetPerimeterPoint(double x1, double y1,
162 double x2, double y2,
163 double *OUTPUT, double *OUTPUT);
164 wxPyShapeCanvas *GetCanvas();
165 void SetCanvas(wxPyShapeCanvas *the_canvas);
166 void AddToCanvas(wxPyShapeCanvas *the_canvas, wxPyShape *addAfter = NULL);
167 void InsertInCanvas(wxPyShapeCanvas *the_canvas);
168 void RemoveFromCanvas(wxPyShapeCanvas *the_canvas);
169 double GetX();
170 double GetY();
171 void SetX(double x);
172 void SetY(double y);
173 wxPyShape *GetParent();
174 void SetParent(wxPyShape *p);
175 wxPyShape *GetTopAncestor();
176
177
178 // wxList& GetChildren();
179 %addmethods {
180 PyObject* GetChildren() {
181 wxList& list = self->GetChildren();
182 return wxPy_ConvertList(&list, "wxPyShape");
183 }
184 }
185
186
187 void Unlink();
188 void SetDrawHandles(bool drawH);
189 bool GetDrawHandles();
190 void MakeControlPoints();
191 void DeleteControlPoints(wxDC *dc = NULL);
192 void ResetControlPoints();
193 wxPyShapeEvtHandler *GetEventHandler();
194 void SetEventHandler(wxPyShapeEvtHandler *handler);
195 void MakeMandatoryControlPoints();
196 void ResetMandatoryControlPoints();
197 bool Recompute();
198 void CalculateSize();
199 void Select(bool select = TRUE, wxDC* dc = NULL);
200 void SetHighlight(bool hi = TRUE, bool recurse = FALSE);
201 bool IsHighlighted() ;
202 bool Selected();
203 bool AncestorSelected();
204 void SetSensitivityFilter(int sens = OP_ALL, bool recursive = FALSE);
205 int GetSensitivityFilter();
206 void SetDraggable(bool drag, bool recursive = FALSE);
207 void SetFixedSize(bool x, bool y);
208 void GetFixedSize(bool *OUTPUT, bool *OUTPUT) ;
209 bool GetFixedWidth();
210 bool GetFixedHeight();
211 void SetSpaceAttachments(bool sp);
212 bool GetSpaceAttachments() ;
213 void SetShadowMode(int mode, bool redraw = FALSE);
214 int GetShadowMode();
215 bool HitTest(double x, double y, int *OUTPUT, double *OUTPUT);
216 void SetCentreResize(bool cr);
217 bool GetCentreResize();
218 void SetMaintainAspectRatio(bool ar);
219 bool GetMaintainAspectRatio();
220
221
222 // wxList& GetLines();
223 %addmethods {
224 PyObject* GetLines() {
225 wxList& list = self->GetLines();
226 return wxPy_ConvertList(&list, "wxPyLineShape");
227 }
228 }
229
230 void SetDisableLabel(bool flag);
231 bool GetDisableLabel();
232 void SetAttachmentMode(int mode);
233 int GetAttachmentMode();
234 void SetId(long i);
235 long GetId();
236
237 void SetPen(wxPen *pen);
238 void SetBrush(wxBrush *brush);
239
240
241 // void SetClientData(wxObject *client_data);
242 // wxObject *GetClientData();
243
244 // The real client data methods are being used for OOR, so just fake it.
245 %pragma(python) addtoclass = "
246 def SetClientData(self, data):
247 self.clientData = data
248 def GetClientData(self):
249 if hasattr(self, 'clientData'):
250 return self.clientData
251 else:
252 return None
253 "
254
255 void Show(bool show);
256 bool IsShown();
257 void Move(wxDC& dc, double x1, double y1, bool display = TRUE);
258 void Erase(wxDC& dc);
259 void EraseContents(wxDC& dc);
260 void Draw(wxDC& dc);
261 void Flash();
262 void MoveLinks(wxDC& dc);
263 void DrawContents(wxDC& dc);
264 void SetSize(double x, double y, bool recursive = TRUE);
265 void SetAttachmentSize(double x, double y);
266 void Attach(wxPyShapeCanvas *can);
267 void Detach();
268 bool Constrain();
269 void AddLine(wxPyLineShape *line, wxPyShape *other,
270 int attachFrom = 0, int attachTo = 0,
271 int positionFrom = -1, int positionTo = -1);
272 int GetLinePosition(wxPyLineShape* line);
273 void AddText(const wxString& string);
274 wxPen *GetPen();
275 wxBrush *GetBrush();
276 void SetDefaultRegionSize();
277 void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
278 void SetFormatMode(int mode, int regionId = 0);
279 int GetFormatMode(int regionId = 0);
280 void SetFont(wxFont *font, int regionId = 0);
281 wxFont *GetFont(int regionId = 0);
282 void SetTextColour(const wxString& colour, int regionId = 0);
283 wxString GetTextColour(int regionId = 0);
284 int GetNumberOfTextRegions();
285 void SetRegionName(const wxString& name, int regionId = 0);
286 wxString GetRegionName(int regionId);
287 int GetRegionId(const wxString& name);
288 void NameRegions(const wxString& parentName = "");
289
290 // wxList& GetRegions();
291 %addmethods {
292 PyObject* GetRegions() {
293 wxList& list = self->GetRegions();
294 return wxPy_ConvertList(&list, "wxShapeRegion");
295 }
296 }
297
298 void AddRegion(wxShapeRegion *region);
299 void ClearRegions();
300 void AssignNewIds();
301 wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT);
302 void FindRegionNames(wxStringList& list);
303 void ClearText(int regionId = 0);
304 void RemoveLine(wxPyLineShape *line);
305
306 #ifdef PROLOGIO
307 void WriteAttributes(wxExpr *clause);
308 void ReadAttributes(wxExpr *clause);
309 void ReadConstraints(wxExpr *clause, wxExprDatabase *database);
310 void WriteRegions(wxExpr *clause);
311 void ReadRegions(wxExpr *clause);
312 #endif
313
314 bool GetAttachmentPosition(int attachment, double *OUTPUT, double *OUTPUT,
315 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
316 int GetNumberOfAttachments();
317 bool AttachmentIsValid(int attachment);
318 bool GetAttachmentPositionEdge(int attachment, double *OUTPUT, double *OUTPUT,
319 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
320 wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2,
321 int nth, int noArcs, wxPyLineShape* line);
322 bool AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, const wxRealPoint& pt2);
323 void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
324 void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
325 bool MoveLineToNewAttachment(wxDC& dc, wxPyLineShape *to_move,
326 double x, double y);
327
328 //void ApplyAttachmentOrdering(wxList& linesToSort);
329 %addmethods {
330 void ApplyAttachmentOrdering(PyObject* linesToSort) {
331 wxList* list = wxPy_wxListHelper(linesToSort, "_wxPyLineShape_p");
332 self->ApplyAttachmentOrdering(*list);
333 delete list;
334 }
335 }
336
337 wxRealPoint GetBranchingAttachmentRoot(int attachment);
338 bool GetBranchingAttachmentInfo(int attachment, wxRealPoint& root, wxRealPoint& neck,
339 wxRealPoint& shoulder1, wxRealPoint& shoulder2);
340 bool GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& attachmentPoint,
341 wxRealPoint& stemPoint);
342 int GetAttachmentLineCount(int attachment);
343 void SetBranchNeckLength(int len);
344 int GetBranchNeckLength();
345 void SetBranchStemLength(int len);
346 int GetBranchStemLength();
347 void SetBranchSpacing(int len);
348 int GetBranchSpacing();
349 void SetBranchStyle(long style);
350 long GetBranchStyle();
351 int PhysicalToLogicalAttachment(int physicalAttachment);
352 int LogicalToPhysicalAttachment(int logicalAttachment);
353 bool Draggable();
354 bool HasDescendant(wxPyShape *image);
355 wxPyShape *CreateNewCopy(bool resetMapping = TRUE, bool recompute = TRUE);
356 void Copy(wxPyShape& copy);
357 void CopyWithHandler(wxPyShape& copy);
358 void Rotate(double x, double y, double theta);
359 double GetRotation();
360 void ClearAttachments();
361 void Recentre(wxDC& dc);
362 void ClearPointList(wxList& list);
363 wxPen GetBackgroundPen();
364 wxBrush GetBackgroundBrush();
365
366 void base_OnDelete();
367 void base_OnDraw(wxDC& dc);
368 void base_OnDrawContents(wxDC& dc);
369 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
370 void base_OnMoveLinks(wxDC& dc);
371 void base_OnErase(wxDC& dc);
372 void base_OnEraseContents(wxDC& dc);
373 void base_OnHighlight(wxDC& dc);
374 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
375 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
376 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
377 void base_OnSize(double x, double y);
378 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
379 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
380 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
381 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
382 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
383 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
384 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
385 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
386 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
387 void base_OnDrawControlPoints(wxDC& dc);
388 void base_OnEraseControlPoints(wxDC& dc);
389 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
390 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
391 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
392 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
393 void base_OnBeginSize(double w, double h);
394 void base_OnEndSize(double w, double h);
395 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
396 };
397
398 //---------------------------------------------------------------------------
399