]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/ogl/oglcanvas.i
Added name to wxShapeCanvas ctor for consistency
[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 bool LoadFile(const wxString& filename);
75
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);
83
84
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);
100
101 };
102
103 //---------------------------------------------------------------------------
104
105 %{
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);
114 %}
115
116
117 class wxPyShapeCanvas : public wxScrolledWindow {
118 public:
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);
124
125 void _setCallbackInfo(PyObject* self, PyObject* _class);
126 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShapeCanvas)"
127 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
128
129 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
130
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);
134
135 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op);
136 wxDiagram* GetDiagram();
137
138 bool GetQuickEditMode();
139 void InsertShape(wxPyShape* shape);
140
141
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);
150
151 void Redraw(wxDC& dc);
152 void RemoveShape(wxPyShape *shape);
153 void SetDiagram(wxDiagram *diagram);
154 void Snap(double *INOUT, double *INOUT);
155
156
157 %pragma(python) addtoclass = "
158 def GetShapeList(self):
159 return self.GetDiagram().GetShapeList()
160 "
161
162 };
163
164
165 //---------------------------------------------------------------------------
166
167