]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/ogl/_oglbasic.i
Fixed a very weird typo
[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 // Not a %module
15
16
17 //---------------------------------------------------------------------------
18 %newgroup;
19
20
21 class wxShapeRegion : public wxObject {
22 public:
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();
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);
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
66 class wxPyShapeEvtHandler : public wxObject {
67 public:
68 %addtofunc wxPyShapeEvtHandler "self._setOORandCallbackInfo(PyShapeEvtHandler)"
69
70 wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL,
71 wxPyShape *shape = NULL);
72
73 void _setCallbackInfo(PyObject* self, PyObject* _class);
74 %extend {
75 void _setOORInfo(PyObject* _self) {
76 self->SetClientObject(new wxPyOORClientData(_self));
77 }
78 }
79 %pythoncode {
80 def _setOORandCallbackInfo(self, _class):
81 self._setOORInfo(self)
82 self._setCallbackInfo(self, _class)
83 }
84
85
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);
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);
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
130 class wxPyShape : public wxPyShapeEvtHandler {
131 public:
132 %addtofunc wxPyShape "self._setOORandCallbackInfo(PyShapeEvtHandler)"
133
134 wxPyShape(wxPyShapeCanvas *can = NULL);
135
136 void _setCallbackInfo(PyObject* self, PyObject* _class);
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();
158 %extend {
159 PyObject* GetChildren() {
160 wxList& list = self->GetChildren();
161 return wxPy_ConvertShapeList(&list);
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();
202 %extend {
203 PyObject* GetLines() {
204 wxList& list = self->GetLines();
205 return wxPy_ConvertShapeList(&list);
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();
215
216 void SetPen(wxPen *pen);
217 void SetBrush(wxBrush *brush);
218
219
220 // void SetClientData(wxObject *client_data);
221 // wxObject *GetClientData();
222
223 // The real client data methods are being used for OOR, so just fake it.
224 %pythoncode {
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
232 }
233
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 = wxPyEmptyString);
268
269 // wxList& GetRegions();
270 %extend {
271 PyObject* GetRegions() {
272 wxList& list = self->GetRegions();
273 return wxPy_ConvertList(&list);
274 }
275 }
276
277 void AddRegion(wxShapeRegion *region);
278 void ClearRegions();
279 void AssignNewIds();
280 wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT);
281 void FindRegionNames(wxStringList& list);
282 void ClearText(int regionId = 0);
283 void RemoveLine(wxPyLineShape *line);
284
285 #ifdef wxUSE_PROLOGIO
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
293 bool GetAttachmentPosition(int attachment, double *OUTPUT, double *OUTPUT,
294 int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL);
295 int GetNumberOfAttachments();
296 bool AttachmentIsValid(int attachment);
297 bool GetAttachmentPositionEdge(int attachment, double *OUTPUT, double *OUTPUT,
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);
308 %extend {
309 void ApplyAttachmentOrdering(PyObject* linesToSort) {
310 wxList* list = wxPy_wxListHelper(linesToSort, wxT("wxPyLineShape"));
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);
342 wxPen GetBackgroundPen();
343 wxBrush GetBackgroundBrush();
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);
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);
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