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);
74 bool LoadFile(const wxString& filename);
76 // **** Have to deal with wxExpr and wxExprDatabase first...
77 //void OnDatabaseLoad(wxExprDatabase& database);
78 //void OnDatabaseSave(wxExprDatabase& database);
79 //bool OnHeaderLoad(wxExprDatabase& database, wxExpr& expr);
80 //bool OnHeaderSave(wxExprDatabase& database, wxExpr& expr);
81 //bool OnShapeLoad(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
82 //bool OnShapeSave(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
85 void ReadContainerGeometry(wxExprDatabase& database);
86 void ReadLines(wxExprDatabase& database);
87 void ReadNodes(wxExprDatabase& database);
88 void RecentreAll(wxDC& dc);
89 void Redraw(wxDC& dc);
90 void RemoveAllShapes();
91 void RemoveShape(wxPyShape* shape);
92 bool SaveFile(const wxString& filename);
93 void SetCanvas(wxPyShapeCanvas* canvas);
94 void SetGridSpacing(double spacing);
95 void SetMouseTolerance(int tolerance);
96 void SetQuickEditMode(bool mode);
97 void SetSnapToGrid(bool snap);
98 void ShowAll(bool show);
99 void Snap(double *INOUT, double *INOUT);
103 //---------------------------------------------------------------------------
106 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragLeft);
107 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragRight);
108 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragLeft);
109 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragRight);
110 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragLeft);
111 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragRight);
112 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnLeftClick);
113 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnRightClick);
117 class wxPyShapeCanvas : public wxScrolledWindow {
119 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
120 const wxPoint& pos = wxDefaultPosition,
121 const wxSize& size = wxDefaultSize,
122 long style = wxBORDER,
123 const wxString& name = wxPyShapeCanvasNameStr);
125 void _setCallbackInfo(PyObject* self, PyObject* _class);
126 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShapeCanvas)"
127 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
129 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
131 // **** Need a typemap for wxClassInfo, or implement wxObject, etc.....
132 wxPyShape* FindShape(double x1, double y, int *OUTPUT,
133 wxClassInfo *info = NULL, wxPyShape* notImage = NULL);
135 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op);
136 wxDiagram* GetDiagram();
138 bool GetQuickEditMode();
139 void InsertShape(wxPyShape* shape);
142 void base_OnBeginDragLeft(double x, double y, int keys = 0);
143 void base_OnBeginDragRight(double x, double y, int keys = 0);
144 void base_OnEndDragLeft(double x, double y, int keys = 0);
145 void base_OnEndDragRight(double x, double y, int keys = 0);
146 void base_OnDragLeft(bool draw, double x, double y, int keys = 0);
147 void base_OnDragRight(bool draw, double x, double y, int keys = 0);
148 void base_OnLeftClick(double x, double y, int keys = 0);
149 void base_OnRightClick(double x, double y, int keys = 0);
151 void Redraw(wxDC& dc);
152 void RemoveShape(wxPyShape *shape);
153 void SetDiagram(wxDiagram *diagram);
154 void Snap(double *INOUT, double *INOUT);
157 %pragma(python) addtoclass = "
158 def GetShapeList(self):
159 return self.GetDiagram().GetShapeList()
165 //---------------------------------------------------------------------------