]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/modules/ogl/oglbasic.i
Removed all non wx stuff from the glcanvas module since DA's PyOpenGL
[wxWidgets.git] / utils / wxPython / modules / 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 "helpers.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 {
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 *x, double *y);
63 void GetProportion(double *x, double *y);
64 void GetSize(double *x, double *y);
65 void GetPosition(double *xp, double *yp);
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 {
91 public:
92 wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL,
93 wxPyShape *shape = NULL);
94
95 void _setSelf(PyObject* self);
96 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
97
98 %addmethods {
99 void Destroy() { delete self; }
100 }
101
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);
111 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
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);
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);
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);
131 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
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);
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
146 class wxPyShape : public wxPyShapeEvtHandler {
147 public:
148 // wxPyShape(wxPyShapeCanvas *can = NULL); abstract base class...
149
150 void _setSelf(PyObject* self);
151 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
152
153 %addmethods {
154 void Destroy() { delete self; }
155 }
156
157 void GetBoundingBoxMax(double *OUTPUT, double *OUTPUT);
158 void GetBoundingBoxMin(double *OUTPUT, double *OUTPUT);
159 bool GetPerimeterPoint(double x1, double y1,
160 double x2, double y2,
161 double *OUTPUT, double *OUTPUT);
162 wxPyShapeCanvas *GetCanvas();
163 void SetCanvas(wxPyShapeCanvas *the_canvas);
164 void AddToCanvas(wxPyShapeCanvas *the_canvas, wxPyShape *addAfter = NULL);
165 void InsertInCanvas(wxPyShapeCanvas *the_canvas);
166 void RemoveFromCanvas(wxPyShapeCanvas *the_canvas);
167 double GetX();
168 double GetY();
169 void SetX(double x);
170 void SetY(double y);
171 wxPyShape *GetParent();
172 void SetParent(wxPyShape *p);
173 wxPyShape *GetTopAncestor();
174
175
176 // wxList& GetChildren();
177 %addmethods {
178 PyObject* GetChildren() {
179 wxList& list = self->GetChildren();
180 return wxPy_ConvertList(&list, "wxPyShape");
181 }
182 }
183
184
185 void Unlink();
186 void SetDrawHandles(bool drawH);
187 bool GetDrawHandles();
188 void MakeControlPoints();
189 void DeleteControlPoints(wxDC *dc = NULL);
190 void ResetControlPoints();
191 wxPyShapeEvtHandler *GetEventHandler();
192 void SetEventHandler(wxPyShapeEvtHandler *handler);
193 void MakeMandatoryControlPoints();
194 void ResetMandatoryControlPoints();
195 bool Recompute();
196 void CalculateSize();
197 void Select(bool select = TRUE, wxDC* dc = NULL);
198 void SetHighlight(bool hi = TRUE, bool recurse = FALSE);
199 bool IsHighlighted() ;
200 bool Selected();
201 bool AncestorSelected();
202 void SetSensitivityFilter(int sens = OP_ALL, bool recursive = FALSE);
203 int GetSensitivityFilter();
204 void SetDraggable(bool drag, bool recursive = FALSE);
205 void SetFixedSize(bool x, bool y);
206 void GetFixedSize(bool *OUTPUT, bool *OUTPUT) ;
207 bool GetFixedWidth();
208 bool GetFixedHeight();
209 void SetSpaceAttachments(bool sp);
210 bool GetSpaceAttachments() ;
211 void SetShadowMode(int mode, bool redraw = FALSE);
212 int GetShadowMode();
213 bool HitTest(double x, double y, int *OUTPUT, double *OUTPUT);
214 void SetCentreResize(bool cr);
215 bool GetCentreResize();
216 void SetMaintainAspectRatio(bool ar);
217 bool GetMaintainAspectRatio();
218
219
220 // wxList& GetLines();
221 %addmethods {
222 PyObject* GetLines() {
223 wxList& list = self->GetLines();
224 return wxPy_ConvertList(&list, "wxPyLineShape");
225 }
226 }
227
228 void SetDisableLabel(bool flag);
229 bool GetDisableLabel();
230 void SetAttachmentMode(int mode);
231 int GetAttachmentMode();
232 void SetId(long i);
233 long GetId();
234 void SetPen(wxPen *pen);
235 void SetBrush(wxBrush *brush);
236 void SetClientData(wxObject *client_data);
237 wxObject *GetClientData() ;
238 void Show(bool show);
239 bool IsShown();
240 void Move(wxDC& dc, double x1, double y1, bool display = TRUE);
241 void Erase(wxDC& dc);
242 void EraseContents(wxDC& dc);
243 void Draw(wxDC& dc);
244 void Flash();
245 void MoveLinks(wxDC& dc);
246 void DrawContents(wxDC& dc);
247 void SetSize(double x, double y, bool recursive = TRUE);
248 void SetAttachmentSize(double x, double y);
249 void Attach(wxPyShapeCanvas *can);
250 void Detach();
251 bool Constrain();
252 void AddLine(wxPyLineShape *line, wxPyShape *other,
253 int attachFrom = 0, int attachTo = 0,
254 int positionFrom = -1, int positionTo = -1);
255 int GetLinePosition(wxPyLineShape* line);
256 void AddText(const wxString& string);
257 wxPen *GetPen();
258 wxBrush *GetBrush();
259 void SetDefaultRegionSize();
260 void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
261 void SetFormatMode(int mode, int regionId = 0);
262 int GetFormatMode(int regionId = 0);
263 void SetFont(wxFont *font, int regionId = 0);
264 wxFont *GetFont(int regionId = 0);
265 void SetTextColour(const wxString& colour, int regionId = 0);
266 wxString GetTextColour(int regionId = 0);
267 int GetNumberOfTextRegions();
268 void SetRegionName(const wxString& name, int regionId = 0);
269 wxString GetRegionName(int regionId);
270 int GetRegionId(const wxString& name);
271 void NameRegions(const wxString& parentName = "");
272
273 // wxList& GetRegions();
274 %addmethods {
275 PyObject* GetRegions() {
276 wxList& list = self->GetRegions();
277 return wxPy_ConvertList(&list, "wxShapeRegion");
278 }
279 }
280
281 void AddRegion(wxShapeRegion *region);
282 void ClearRegions();
283 void AssignNewIds();
284 wxPyShape *FindRegion(const wxString& regionName, int *regionId);
285 void FindRegionNames(wxStringList& list);
286 void ClearText(int regionId = 0);
287 void RemoveLine(wxPyLineShape *line);
288
289 #ifdef PROLOGIO
290 void WriteAttributes(wxExpr *clause);
291 void ReadAttributes(wxExpr *clause);
292 void ReadConstraints(wxExpr *clause, wxExprDatabase *database);
293 void WriteRegions(wxExpr *clause);
294 void ReadRegions(wxExpr *clause);
295 #endif
296
297 bool GetAttachmentPosition(int attachment, double *x, double *y,
298 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
299 int GetNumberOfAttachments();
300 bool AttachmentIsValid(int attachment);
301 bool GetAttachmentPositionEdge(int attachment, double *x, double *y,
302 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
303 wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2,
304 int nth, int noArcs, wxPyLineShape* line);
305 bool AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, const wxRealPoint& pt2);
306 void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
307 void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
308 bool MoveLineToNewAttachment(wxDC& dc, wxPyLineShape *to_move,
309 double x, double y);
310
311 //void ApplyAttachmentOrdering(wxList& linesToSort);
312 %addmethods {
313 void ApplyAttachmentOrdering(PyObject* linesToSort) {
314 wxList* list = wxPy_wxListHelper(linesToSort, "wxPyLineShape");
315 self->ApplyAttachmentOrdering(*list);
316 delete list;
317 }
318 }
319
320 wxRealPoint GetBranchingAttachmentRoot(int attachment);
321 bool GetBranchingAttachmentInfo(int attachment, wxRealPoint& root, wxRealPoint& neck,
322 wxRealPoint& shoulder1, wxRealPoint& shoulder2);
323 bool GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& attachmentPoint,
324 wxRealPoint& stemPoint);
325 int GetAttachmentLineCount(int attachment);
326 void SetBranchNeckLength(int len);
327 int GetBranchNeckLength();
328 void SetBranchStemLength(int len);
329 int GetBranchStemLength();
330 void SetBranchSpacing(int len);
331 int GetBranchSpacing();
332 void SetBranchStyle(long style);
333 long GetBranchStyle();
334 int PhysicalToLogicalAttachment(int physicalAttachment);
335 int LogicalToPhysicalAttachment(int logicalAttachment);
336 bool Draggable();
337 bool HasDescendant(wxPyShape *image);
338 wxPyShape *CreateNewCopy(bool resetMapping = TRUE, bool recompute = TRUE);
339 void Copy(wxPyShape& copy);
340 void CopyWithHandler(wxPyShape& copy);
341 void Rotate(double x, double y, double theta);
342 double GetRotation();
343 void ClearAttachments();
344 void Recentre(wxDC& dc);
345 void ClearPointList(wxList& list);
346
347 void base_OnDelete();
348 void base_OnDraw(wxDC& dc);
349 void base_OnDrawContents(wxDC& dc);
350 void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
351 void base_OnMoveLinks(wxDC& dc);
352 void base_OnErase(wxDC& dc);
353 void base_OnEraseContents(wxDC& dc);
354 void base_OnHighlight(wxDC& dc);
355 void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
356 void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
357 void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
358 void base_OnSize(double x, double y);
359 bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
360 void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
361 void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
362 void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
363 void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
364 void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
365 void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
366 void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
367 void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
368 void base_OnDrawControlPoints(wxDC& dc);
369 void base_OnEraseControlPoints(wxDC& dc);
370 void base_OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
371 void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
372 void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
373 void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
374 void base_OnBeginSize(double w, double h);
375 void base_OnEndSize(double w, double h);
376 // void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
377 };
378
379 //---------------------------------------------------------------------------
380