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 //---------------------------------------------------------------------------
41 // Put some wx default wxChar* values into wxStrings.
42 DECLARE_DEF_STRING(ShapeCanvasNameStr);
45 //---------------------------------------------------------------------------
46 //---------------------------------------------------------------------------
48 class wxDiagram : public wxObject {
53 void AddShape(wxPyShape* shape, wxPyShape *addAfter = NULL);
55 void DeleteAllShapes();
56 void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
57 wxPyShape* FindShape(long id);
58 wxPyShapeCanvas* GetCanvas();
60 double GetGridSpacing();
61 int GetMouseTolerance();
63 // wxList* GetShapeList();
65 PyObject* GetShapeList() {
66 wxList* list = self->GetShapeList();
67 return wxPy_ConvertShapeList(list, "wxPyShape");
71 bool GetQuickEditMode();
73 void InsertShape(wxPyShape *shape);
76 bool LoadFile(const wxString& filename);
77 bool SaveFile(const wxString& filename);
81 // **** Have to deal with wxExpr and wxExprDatabase first...
82 //void OnDatabaseLoad(wxExprDatabase& database);
83 //void OnDatabaseSave(wxExprDatabase& database);
84 //bool OnHeaderLoad(wxExprDatabase& database, wxExpr& expr);
85 //bool OnHeaderSave(wxExprDatabase& database, wxExpr& expr);
86 //bool OnShapeLoad(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
87 //bool OnShapeSave(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
91 void ReadContainerGeometry(wxExprDatabase& database);
92 void ReadLines(wxExprDatabase& database);
93 void ReadNodes(wxExprDatabase& database);
96 void RecentreAll(wxDC& dc);
97 void Redraw(wxDC& dc);
98 void RemoveAllShapes();
99 void RemoveShape(wxPyShape* shape);
100 void SetCanvas(wxPyShapeCanvas* canvas);
101 void SetGridSpacing(double spacing);
102 void SetMouseTolerance(int tolerance);
103 void SetQuickEditMode(bool mode);
104 void SetSnapToGrid(bool snap);
105 void ShowAll(bool show);
106 void Snap(double *INOUT, double *INOUT);
110 //---------------------------------------------------------------------------
113 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragLeft);
114 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragRight);
115 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragLeft);
116 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragRight);
117 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragLeft);
118 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragRight);
119 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnLeftClick);
120 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnRightClick);
124 class wxPyShapeCanvas : public wxScrolledWindow {
126 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
127 const wxPoint& pos = wxDefaultPosition,
128 const wxSize& size = wxDefaultSize,
129 long style = wxBORDER,
130 const wxString& name = wxPyShapeCanvasNameStr);
132 void _setCallbackInfo(PyObject* self, PyObject* _class);
133 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShapeCanvas)"
134 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
136 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
138 // **** Need a typemap for wxClassInfo, or implement wxObject, etc.....
139 wxPyShape* FindShape(double x1, double y, int *OUTPUT,
140 wxClassInfo *info = NULL, wxPyShape* notImage = NULL);
142 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op);
143 wxDiagram* GetDiagram();
145 bool GetQuickEditMode();
146 void InsertShape(wxPyShape* shape);
149 void base_OnBeginDragLeft(double x, double y, int keys = 0);
150 void base_OnBeginDragRight(double x, double y, int keys = 0);
151 void base_OnEndDragLeft(double x, double y, int keys = 0);
152 void base_OnEndDragRight(double x, double y, int keys = 0);
153 void base_OnDragLeft(bool draw, double x, double y, int keys = 0);
154 void base_OnDragRight(bool draw, double x, double y, int keys = 0);
155 void base_OnLeftClick(double x, double y, int keys = 0);
156 void base_OnRightClick(double x, double y, int keys = 0);
158 void Redraw(wxDC& dc);
159 void RemoveShape(wxPyShape *shape);
160 void SetDiagram(wxDiagram *diagram);
161 void Snap(double *INOUT, double *INOUT);
164 %pragma(python) addtoclass = "
165 def GetShapeList(self):
166 return self.GetDiagram().GetShapeList()
172 //---------------------------------------------------------------------------