]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/ogl/_oglcanvas.i
use WX_DEFINE_ARRAY_PTR for anarray of pointers (fixes Sun CC warning)
[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 // not a %module
15
16
17 //---------------------------------------------------------------------------
18 %{
19 // Put some wx default wxChar* values into wxStrings.
20 DECLARE_DEF_STRING(ShapeCanvasNameStr);
21 %}
22
23 //---------------------------------------------------------------------------
24 //---------------------------------------------------------------------------
25
26 class wxDiagram : public wxObject {
27 public:
28 wxDiagram();
29 //~wxDiagram();
30
31 void AddShape(wxPyShape* shape, wxPyShape *addAfter = NULL);
32 void Clear(wxDC& dc);
33 void DeleteAllShapes();
34 void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
35 wxPyShape* FindShape(long id);
36 wxPyShapeCanvas* GetCanvas();
37 int GetCount();
38 double GetGridSpacing();
39 int GetMouseTolerance();
40
41 // wxList* GetShapeList();
42 %extend {
43 PyObject* GetShapeList() {
44 wxList* list = self->GetShapeList();
45 return wxPy_ConvertShapeList(list);
46 }
47 }
48
49 bool GetQuickEditMode();
50 bool GetSnapToGrid();
51 void InsertShape(wxPyShape *shape);
52
53 #ifdef wxUSE_PROLOGIO
54 bool LoadFile(const wxString& filename);
55 bool SaveFile(const wxString& filename);
56 #endif
57
58 #ifdef wxUSE_PROLOGIO
59 // **** Have to deal with wxExpr and wxExprDatabase first...
60 //void OnDatabaseLoad(wxExprDatabase& database);
61 //void OnDatabaseSave(wxExprDatabase& database);
62 //bool OnHeaderLoad(wxExprDatabase& database, wxExpr& expr);
63 //bool OnHeaderSave(wxExprDatabase& database, wxExpr& expr);
64 //bool OnShapeLoad(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
65 //bool OnShapeSave(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
66 #endif
67
68 #ifdef wxUSE_PROLOGIO
69 void ReadContainerGeometry(wxExprDatabase& database);
70 void ReadLines(wxExprDatabase& database);
71 void ReadNodes(wxExprDatabase& database);
72 #endif
73
74 void RecentreAll(wxDC& dc);
75 void Redraw(wxDC& dc);
76 void RemoveAllShapes();
77 void RemoveShape(wxPyShape* shape);
78 void SetCanvas(wxPyShapeCanvas* canvas);
79 void SetGridSpacing(double spacing);
80 void SetMouseTolerance(int tolerance);
81 void SetQuickEditMode(bool mode);
82 void SetSnapToGrid(bool snap);
83 void ShowAll(bool show);
84 void Snap(double *INOUT, double *INOUT);
85
86 };
87
88 //---------------------------------------------------------------------------
89
90 %{
91 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragLeft);
92 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragRight);
93 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragLeft);
94 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragRight);
95 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragLeft);
96 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragRight);
97 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnLeftClick);
98 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnRightClick);
99 %}
100
101
102 MustHaveApp(wxPyShapeCanvas);
103
104 class wxPyShapeCanvas : public wxScrolledWindow {
105 public:
106 %pythonAppend wxPyShapeCanvas "self._setOORandCallbackInfo(PyShapeCanvas)"
107 %typemap(out) wxPyShapeCanvas*; // turn off this typemap
108
109 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
110 const wxPoint& pos = wxDefaultPosition,
111 const wxSize& size = wxDefaultSize,
112 long style = wxBORDER,
113 const wxString& name = wxPyShapeCanvasNameStr);
114
115 %typemap(out) wxPyShapeCanvas* { $result = wxPyMake_wxObject($1, $owner); }
116
117 void _setCallbackInfo(PyObject* self, PyObject* _class);
118 %pythoncode {
119 def _setOORandCallbackInfo(self, _class):
120 self._setOORInfo(self)
121 self._setCallbackInfo(self, _class)
122 }
123
124 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
125
126 // **** Need a typemap for wxClassInfo, or fully implement wxObject, etc.....
127 wxPyShape* FindShape(double x1, double y, int *OUTPUT,
128 wxClassInfo *info = NULL, wxPyShape* notImage = NULL);
129
130 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op);
131 wxDiagram* GetDiagram();
132
133 bool GetQuickEditMode();
134 void InsertShape(wxPyShape* shape);
135
136
137 void base_OnBeginDragLeft(double x, double y, int keys = 0);
138 void base_OnBeginDragRight(double x, double y, int keys = 0);
139 void base_OnEndDragLeft(double x, double y, int keys = 0);
140 void base_OnEndDragRight(double x, double y, int keys = 0);
141 void base_OnDragLeft(bool draw, double x, double y, int keys = 0);
142 void base_OnDragRight(bool draw, double x, double y, int keys = 0);
143 void base_OnLeftClick(double x, double y, int keys = 0);
144 void base_OnRightClick(double x, double y, int keys = 0);
145
146 void Redraw(wxDC& dc);
147 void RemoveShape(wxPyShape *shape);
148 void SetDiagram(wxDiagram *diagram);
149 void Snap(double *INOUT, double *INOUT);
150
151
152 %pythoncode {
153 def GetShapeList(self):
154 return self.GetDiagram().GetShapeList()
155 }
156 };
157
158
159 //---------------------------------------------------------------------------
160
161