| 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 | * User-defined attachment point |
| 63 | */ |
| 64 | |
| 65 | class wxAttachmentPoint: public wxObject |
| 66 | { |
| 67 | public: |
| 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 | |
| 75 | //--------------------------------------------------------------------------- |
| 76 | |
| 77 | %{ |
| 78 | WXSHAPE_IMP_CALLBACKS(wxPyShapeEvtHandler,wxShapeEvtHandler); |
| 79 | %} |
| 80 | |
| 81 | |
| 82 | class wxPyShapeEvtHandler : public wxObject { |
| 83 | public: |
| 84 | %pythonAppend wxPyShapeEvtHandler "self._setOORandCallbackInfo(PyShapeEvtHandler)" |
| 85 | %typemap(out) wxPyShapeEvtHandler*; // turn off this typemap |
| 86 | |
| 87 | wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL, |
| 88 | wxPyShape *shape = NULL); |
| 89 | |
| 90 | %typemap(out) wxPyShapeEvtHandler* { $result = wxPyMake_wxShapeEvtHandler($1, $owner); } |
| 91 | |
| 92 | |
| 93 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
| 94 | %extend { |
| 95 | void _setOORInfo(PyObject* _self) { |
| 96 | self->SetClientObject(new wxPyOORClientData(_self)); |
| 97 | } |
| 98 | } |
| 99 | %pythoncode { |
| 100 | def _setOORandCallbackInfo(self, _class): |
| 101 | self._setOORInfo(self) |
| 102 | self._setCallbackInfo(self, _class) |
| 103 | } |
| 104 | |
| 105 | |
| 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); |
| 115 | void base_OnDrawBranches(wxDC& dc, bool erase = false); |
| 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); |
| 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); |
| 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); |
| 135 | void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true); |
| 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); |
| 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 | |
| 150 | class wxPyShape : public wxPyShapeEvtHandler { |
| 151 | public: |
| 152 | %pythonAppend wxPyShape "self._setOORandCallbackInfo(PyShape)" |
| 153 | %typemap(out) wxPyShape*; // turn off this typemap |
| 154 | |
| 155 | wxPyShape(wxPyShapeCanvas *can = NULL); |
| 156 | |
| 157 | %typemap(out) wxPyShape* { $result = wxPyMake_wxShapeEvtHandler($1, $owner); } |
| 158 | |
| 159 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
| 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(); |
| 181 | %extend { |
| 182 | PyObject* GetChildren() { |
| 183 | wxList& list = self->GetChildren(); |
| 184 | return wxPy_ConvertShapeList(&list); |
| 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(); |
| 201 | void Select(bool select = true, wxDC* dc = NULL); |
| 202 | void SetHighlight(bool hi = true, bool recurse = false); |
| 203 | bool IsHighlighted() ; |
| 204 | bool Selected(); |
| 205 | bool AncestorSelected(); |
| 206 | void SetSensitivityFilter(int sens = OP_ALL, bool recursive = false); |
| 207 | int GetSensitivityFilter(); |
| 208 | void SetDraggable(bool drag, bool recursive = false); |
| 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() ; |
| 215 | void SetShadowMode(int mode, bool redraw = false); |
| 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(); |
| 225 | %extend { |
| 226 | PyObject* GetLines() { |
| 227 | wxList& list = self->GetLines(); |
| 228 | return wxPy_ConvertShapeList(&list); |
| 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(); |
| 238 | |
| 239 | void SetPen(wxPen *pen); |
| 240 | void SetBrush(wxBrush *brush); |
| 241 | |
| 242 | |
| 243 | // void SetClientData(wxObject *client_data); |
| 244 | // wxObject *GetClientData(); |
| 245 | |
| 246 | // The real client data methods are being used for OOR, so just fake it. |
| 247 | %pythoncode { |
| 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 |
| 255 | } |
| 256 | |
| 257 | void Show(bool show); |
| 258 | bool IsShown(); |
| 259 | void Move(wxDC& dc, double x1, double y1, bool display = true); |
| 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); |
| 266 | void SetSize(double x, double y, bool recursive = true); |
| 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); |
| 290 | void NameRegions(const wxString& parentName = wxPyEmptyString); |
| 291 | |
| 292 | // wxList& GetRegions(); |
| 293 | %extend { |
| 294 | PyObject* GetRegions() { |
| 295 | wxList& list = self->GetRegions(); |
| 296 | return wxPy_ConvertList(&list); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | void AddRegion(wxShapeRegion *region); |
| 301 | void ClearRegions(); |
| 302 | void AssignNewIds(); |
| 303 | wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT); |
| 304 | void FindRegionNames(wxStringList& list); |
| 305 | void ClearText(int regionId = 0); |
| 306 | void RemoveLine(wxPyLineShape *line); |
| 307 | |
| 308 | #ifdef wxUSE_PROLOGIO |
| 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 | |
| 316 | bool GetAttachmentPosition(int attachment, double *OUTPUT, double *OUTPUT, |
| 317 | int nth = 0, int no_arcs = 1, wxPyLineShape *line = NULL); |
| 318 | int GetNumberOfAttachments(); |
| 319 | bool AttachmentIsValid(int attachment); |
| 320 | |
| 321 | %extend { |
| 322 | PyObject* GetAttachments() { |
| 323 | wxList& list = self->GetAttachments(); |
| 324 | return wxPy_ConvertList(&list); |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | bool GetAttachmentPositionEdge(int attachment, double *OUTPUT, double *OUTPUT, |
| 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); |
| 333 | void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = false); |
| 334 | void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = false); |
| 335 | bool MoveLineToNewAttachment(wxDC& dc, wxPyLineShape *to_move, |
| 336 | double x, double y); |
| 337 | |
| 338 | //void ApplyAttachmentOrdering(wxList& linesToSort); |
| 339 | %extend { |
| 340 | void ApplyAttachmentOrdering(PyObject* linesToSort) { |
| 341 | wxList* list = wxPy_wxListHelper(linesToSort, wxT("wxPyLineShape")); |
| 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); |
| 365 | wxPyShape *CreateNewCopy(bool resetMapping = true, bool recompute = true); |
| 366 | void Copy(wxPyShape& copy); |
| 367 | void CopyWithHandler(wxPyShape& copy); |
| 368 | void Rotate(double x, double y, double theta); |
| 369 | double GetRotation(); |
| 370 | void SetRotation(double rotation); |
| 371 | void ClearAttachments(); |
| 372 | void Recentre(wxDC& dc); |
| 373 | void ClearPointList(wxList& list); |
| 374 | wxPen GetBackgroundPen(); |
| 375 | wxBrush GetBackgroundBrush(); |
| 376 | |
| 377 | void base_OnDelete(); |
| 378 | void base_OnDraw(wxDC& dc); |
| 379 | void base_OnDrawContents(wxDC& dc); |
| 380 | void base_OnDrawBranches(wxDC& dc, bool erase = false); |
| 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); |
| 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); |
| 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); |
| 400 | void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true); |
| 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); |
| 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 | |