1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for the wxWindows Object Graphics Library
7 // Created: 7-Sept-1999
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include "oglhelpers.h"
21 //---------------------------------------------------------------------------
24 %include my_typemaps.i
37 %pragma(python) code = "import wx"
39 //---------------------------------------------------------------------------
40 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
48 void AddShape(wxPyShape*shape, wxPyShape *addAfter = NULL);
50 void DeleteAllShapes();
51 void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
52 wxPyShape* FindShape(long id);
53 wxPyShapeCanvas* GetCanvas();
55 double GetGridSpacing();
56 int GetMouseTolerance();
58 // wxList* GetShapeList();
60 PyObject* GetShapeList() {
61 wxList* list = self->GetShapeList();
62 return wxPy_ConvertList(list, "wxPyShape");
66 bool GetQuickEditMode();
68 void InsertShape(wxPyShape *shape);
69 bool LoadFile(const wxString& filename);
71 // **** Have to deal with wxExpr and wxExprDatabase first...
72 //void OnDatabaseLoad(wxExprDatabase& database);
73 //void OnDatabaseSave(wxExprDatabase& database);
74 //bool OnHeaderLoad(wxExprDatabase& database, wxExpr& expr);
75 //bool OnHeaderSave(wxExprDatabase& database, wxExpr& expr);
76 //bool OnShapeLoad(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
77 //bool OnShapeSave(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
80 void ReadContainerGeometry(wxExprDatabase& database);
81 void ReadLines(wxExprDatabase& database);
82 void ReadNodes(wxExprDatabase& database);
83 void RecentreAll(wxDC& dc);
84 void Redraw(wxDC& dc);
85 void RemoveAllShapes();
86 void RemoveShape(wxPyShape* shape);
87 bool SaveFile(const wxString& filename);
88 void SetCanvas(wxPyShapeCanvas* canvas);
89 void SetGridSpacing(double spacing);
90 void SetMouseTolerance(int tolerance);
91 void SetQuickEditMode(bool mode);
92 void SetSnapToGrid(bool snap);
93 void ShowAll(bool show);
94 void Snap(double *OUTPUT, double *OUTPUT);
98 //---------------------------------------------------------------------------
101 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragLeft);
102 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragRight);
103 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragLeft);
104 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragRight);
105 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragLeft);
106 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragRight);
107 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnLeftClick);
108 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnRightClick);
112 class wxPyShapeCanvas : public wxScrolledWindow {
114 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
115 const wxPoint& pos = wxDefaultPosition,
116 const wxSize& size = wxDefaultSize,
117 long style = wxBORDER);
119 void _setSelf(PyObject* self, PyObject* _class);
120 %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyShapeCanvas)"
122 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
123 %pragma(python) addtomethod = "__init__:#wx._StdOnScrollCallbacks(self)"
125 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
127 // **** Need a typemap for wxClassInfo, or implement wxObject, etc.....
128 wxPyShape* FindShape(double x1, double y, int *OUTPUT,
129 wxClassInfo *info = NULL, wxPyShape* notImage = NULL);
131 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op);
132 wxDiagram* GetDiagram();
134 bool GetQuickEditMode();
135 void InsertShape(wxPyShape* shape);
138 void base_OnBeginDragLeft(double x, double y, int keys = 0);
139 void base_OnBeginDragRight(double x, double y, int keys = 0);
140 void base_OnEndDragLeft(double x, double y, int keys = 0);
141 void base_OnEndDragRight(double x, double y, int keys = 0);
142 void base_OnDragLeft(bool draw, double x, double y, int keys = 0);
143 void base_OnDragRight(bool draw, double x, double y, int keys = 0);
144 void base_OnLeftClick(double x, double y, int keys = 0);
145 void base_OnRightClick(double x, double y, int keys = 0);
147 void Redraw(wxDC& dc);
148 void RemoveShape(wxPyShape *shape);
149 void SetDiagram(wxDiagram *diagram);
150 void Snap(double *OUTPUT, double *OUTPUT);
155 //---------------------------------------------------------------------------