]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/ogl/oglcanvas.i
Added some missing constants and fixed GetPoints
[wxWidgets.git] / wxPython / contrib / ogl / oglcanvas.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: oglcanvas.i
3 // Purpose: SWIG definitions for the wxWindows Object Graphics Library
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 7-Sept-1999
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13
14 %module oglcanvas
15
16 %{
17 #include "wxPython.h"
18 #include "oglhelpers.h"
19 %}
20
21 //---------------------------------------------------------------------------
22
23 %include typemaps.i
24 %include my_typemaps.i
25
26 %extern wx.i
27 %import windows.i
28 %extern _defs.i
29 %extern misc.i
30 %extern gdi.i
31
32 %include _ogldefs.i
33
34 %import oglbasic.i
35
36
37 %pragma(python) code = "import wx"
38
39 //---------------------------------------------------------------------------
40 %{
41 // Put some wx default wxChar* values into wxStrings.
42 DECLARE_DEF_STRING(ShapeCanvasNameStr);
43 %}
44
45 //---------------------------------------------------------------------------
46 //---------------------------------------------------------------------------
47
48 class wxDiagram : public wxObject {
49 public:
50 wxDiagram();
51 //~wxDiagram();
52
53 void AddShape(wxPyShape* shape, wxPyShape *addAfter = NULL);
54 void Clear(wxDC& dc);
55 void DeleteAllShapes();
56 void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
57 wxPyShape* FindShape(long id);
58 wxPyShapeCanvas* GetCanvas();
59 int GetCount();
60 double GetGridSpacing();
61 int GetMouseTolerance();
62
63 // wxList* GetShapeList();
64 %addmethods {
65 PyObject* GetShapeList() {
66 wxList* list = self->GetShapeList();
67 return wxPy_ConvertShapeList(list, "wxPyShape");
68 }
69 }
70
71 bool GetQuickEditMode();
72 bool GetSnapToGrid();
73 void InsertShape(wxPyShape *shape);
74
75 #ifdef wxUSE_PROLOGIO
76 bool LoadFile(const wxString& filename);
77 bool SaveFile(const wxString& filename);
78 #endif
79
80 #ifdef wxUSE_PROLOGIO
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);
88 #endif
89
90 #ifdef wxUSE_PROLOGIO
91 void ReadContainerGeometry(wxExprDatabase& database);
92 void ReadLines(wxExprDatabase& database);
93 void ReadNodes(wxExprDatabase& database);
94 #endif
95
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);
107
108 };
109
110 //---------------------------------------------------------------------------
111
112 %{
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);
121 %}
122
123
124 class wxPyShapeCanvas : public wxScrolledWindow {
125 public:
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);
131
132 void _setCallbackInfo(PyObject* self, PyObject* _class);
133 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShapeCanvas)"
134 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
135
136 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
137
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);
141
142 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op);
143 wxDiagram* GetDiagram();
144
145 bool GetQuickEditMode();
146 void InsertShape(wxPyShape* shape);
147
148
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);
157
158 void Redraw(wxDC& dc);
159 void RemoveShape(wxPyShape *shape);
160 void SetDiagram(wxDiagram *diagram);
161 void Snap(double *INOUT, double *INOUT);
162
163
164 %pragma(python) addtoclass = "
165 def GetShapeList(self):
166 return self.GetDiagram().GetShapeList()
167 "
168
169 };
170
171
172 //---------------------------------------------------------------------------
173
174