]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/modules/ogl/oglcanvas.i
some ifdef'd out things added back in
[wxWidgets.git] / utils / wxPython / modules / 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 "helpers.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 %extern oglbasic.i
35
36
37 %pragma(python) code = "import wx"
38
39 //---------------------------------------------------------------------------
40 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
42
43 class wxDiagram {
44 public:
45 wxDiagram();
46 ~wxDiagram();
47
48 void AddShape(wxPyShape*shape, wxPyShape *addAfter = NULL);
49 void Clear(wxDC& dc);
50 void DeleteAllShapes();
51 void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
52 wxPyShape* FindShape(long id);
53 wxPyShapeCanvas* GetCanvas();
54 int GetCount();
55 double GetGridSpacing();
56 int GetMouseTolerance();
57
58 // wxList* GetShapeList();
59 %addmethods {
60 PyObject* GetShapeList() {
61 wxList* list = self->GetShapeList();
62 return wxPy_ConvertList(list, "wxPyShape");
63 }
64 }
65
66 bool GetQuickEditMode();
67 bool GetSnapToGrid();
68 void InsertShape(wxPyShape *shape);
69 bool LoadFile(const wxString& filename);
70
71 // **** Have to deal with wxExpr and wxExprDatabase first...
72 //void OnDatabaseLoad(wxExprDatabase& database);
73 //void OnDatabaseSave(wxExprDatabase& database);
74 //bool OnHeaderLoad(wxExprDatabase& database, wxExpr& expr);
75 //bool OnHeaderSave(wxExprDatabase& database, wxExpr& expr);
76 //bool OnShapeLoad(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
77 //bool OnShapeSave(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
78
79
80 void ReadContainerGeometry(wxExprDatabase& database);
81 void ReadLines(wxExprDatabase& database);
82 void ReadNodes(wxExprDatabase& database);
83 void RecentreAll(wxDC& dc);
84 void Redraw(wxDC& dc);
85 void RemoveAllShapes();
86 void RemoveShape(wxPyShape* shape);
87 bool SaveFile(const wxString& filename);
88 void SetCanvas(wxPyShapeCanvas* canvas);
89 void SetGridSpacing(double spacing);
90 void SetMouseTolerance(int tolerance);
91 void SetQuickEditMode(bool mode);
92 void SetSnapToGrid(bool snap);
93 void ShowAll(bool show);
94 void Snap(double *x, double *y);
95
96 };
97
98 //---------------------------------------------------------------------------
99
100 %{
101 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragLeft);
102 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnBeginDragRight);
103 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragLeft);
104 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnEndDragRight);
105 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragLeft);
106 IMP_PYCALLBACK__BOOL2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnDragRight);
107 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnLeftClick);
108 IMP_PYCALLBACK__2DBLINT(wxPyShapeCanvas, wxShapeCanvas, OnRightClick);
109 %}
110
111
112 class wxPyShapeCanvas : public wxScrolledWindow {
113 public:
114 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
115 const wxPoint& pos = wxPyDefaultPosition,
116 const wxSize& size = wxPyDefaultSize,
117 long style = wxBORDER);
118
119 void _setSelf(PyObject* self);
120 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
121
122 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
123 %pragma(python) addtomethod = "__init__:wx._StdOnScrollCallbacks(self)"
124
125 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
126
127 // **** Need a typemap for wxClassInfo, or implement wxObject, etc.....
128 wxPyShape* FindShape(double x1, double y, int *attachment,
129 wxClassInfo *info = NULL, wxPyShape* notImage = NULL);
130
131 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *attachment, int op);
132 wxDiagram* GetDiagram();
133
134 bool GetQuickEditMode();
135 void InsertShape(wxPyShape* shape);
136
137
138 void base_OnBeginDragLeft(double x, double y, int keys = 0);
139 void base_OnBeginDragRight(double x, double y, int keys = 0);
140 void base_OnEndDragLeft(double x, double y, int keys = 0);
141 void base_OnEndDragRight(double x, double y, int keys = 0);
142 void base_OnDragLeft(bool draw, double x, double y, int keys = 0);
143 void base_OnDragRight(bool draw, double x, double y, int keys = 0);
144 void base_OnLeftClick(double x, double y, int keys = 0);
145 void base_OnRightClick(double x, double y, int keys = 0);
146
147 void Redraw(wxDC& dc);
148 void RemoveShape(wxPyShape *shape);
149 void SetDiagram(wxDiagram *diagram);
150 void Snap(double *x, double *y);
151
152 };
153
154
155 //---------------------------------------------------------------------------
156
157