]>
Commit | Line | Data |
---|---|---|
e91a9dfc RD |
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 | ||
d14a1e28 | 14 | // not a %module |
e91a9dfc | 15 | |
e91a9dfc RD |
16 | |
17 | //--------------------------------------------------------------------------- | |
4fcf77bc RD |
18 | %{ |
19 | // Put some wx default wxChar* values into wxStrings. | |
20 | DECLARE_DEF_STRING(ShapeCanvasNameStr); | |
21 | %} | |
22 | ||
e91a9dfc RD |
23 | //--------------------------------------------------------------------------- |
24 | //--------------------------------------------------------------------------- | |
25 | ||
9416aa89 | 26 | class wxDiagram : public wxObject { |
e91a9dfc RD |
27 | public: |
28 | wxDiagram(); | |
9416aa89 | 29 | //~wxDiagram(); |
e91a9dfc | 30 | |
edf2f43e | 31 | void AddShape(wxPyShape* shape, wxPyShape *addAfter = NULL); |
e91a9dfc RD |
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(); | |
d14a1e28 | 42 | %extend { |
e91a9dfc RD |
43 | PyObject* GetShapeList() { |
44 | wxList* list = self->GetShapeList(); | |
d14a1e28 | 45 | return wxPy_ConvertShapeList(list); |
e91a9dfc RD |
46 | } |
47 | } | |
48 | ||
49 | bool GetQuickEditMode(); | |
50 | bool GetSnapToGrid(); | |
51 | void InsertShape(wxPyShape *shape); | |
1e4a197e RD |
52 | |
53 | #ifdef wxUSE_PROLOGIO | |
e91a9dfc | 54 | bool LoadFile(const wxString& filename); |
1e4a197e RD |
55 | bool SaveFile(const wxString& filename); |
56 | #endif | |
e91a9dfc | 57 | |
1e4a197e | 58 | #ifdef wxUSE_PROLOGIO |
e91a9dfc RD |
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); | |
1e4a197e | 66 | #endif |
e91a9dfc | 67 | |
1e4a197e | 68 | #ifdef wxUSE_PROLOGIO |
e91a9dfc RD |
69 | void ReadContainerGeometry(wxExprDatabase& database); |
70 | void ReadLines(wxExprDatabase& database); | |
71 | void ReadNodes(wxExprDatabase& database); | |
1e4a197e RD |
72 | #endif |
73 | ||
e91a9dfc RD |
74 | void RecentreAll(wxDC& dc); |
75 | void Redraw(wxDC& dc); | |
76 | void RemoveAllShapes(); | |
77 | void RemoveShape(wxPyShape* shape); | |
e91a9dfc RD |
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); | |
211a46cf | 84 | void Snap(double *INOUT, double *INOUT); |
e91a9dfc RD |
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 | class wxPyShapeCanvas : public wxScrolledWindow { | |
103 | public: | |
d14a1e28 RD |
104 | %addtofunc wxPyShapeEvtHandler "self._setOORandCallbackInfo(PyShapeEvtHandler)" |
105 | ||
e91a9dfc | 106 | wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1, |
1e7ecb7b RD |
107 | const wxPoint& pos = wxDefaultPosition, |
108 | const wxSize& size = wxDefaultSize, | |
4fcf77bc RD |
109 | long style = wxBORDER, |
110 | const wxString& name = wxPyShapeCanvasNameStr); | |
e91a9dfc | 111 | |
0122b7e3 | 112 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
d14a1e28 RD |
113 | %pythoncode { |
114 | def _setOORandCallbackInfo(self, _class): | |
115 | self._setOORInfo(self) | |
116 | self._setCallbackInfo(self, _class) | |
117 | } | |
e91a9dfc RD |
118 | |
119 | void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL); | |
120 | ||
d14a1e28 | 121 | // **** Need a typemap for wxClassInfo, or fully implement wxObject, etc..... |
4e0dcbb1 | 122 | wxPyShape* FindShape(double x1, double y, int *OUTPUT, |
e91a9dfc RD |
123 | wxClassInfo *info = NULL, wxPyShape* notImage = NULL); |
124 | ||
4e0dcbb1 | 125 | wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op); |
e91a9dfc RD |
126 | wxDiagram* GetDiagram(); |
127 | ||
128 | bool GetQuickEditMode(); | |
129 | void InsertShape(wxPyShape* shape); | |
130 | ||
131 | ||
132 | void base_OnBeginDragLeft(double x, double y, int keys = 0); | |
133 | void base_OnBeginDragRight(double x, double y, int keys = 0); | |
134 | void base_OnEndDragLeft(double x, double y, int keys = 0); | |
135 | void base_OnEndDragRight(double x, double y, int keys = 0); | |
136 | void base_OnDragLeft(bool draw, double x, double y, int keys = 0); | |
137 | void base_OnDragRight(bool draw, double x, double y, int keys = 0); | |
138 | void base_OnLeftClick(double x, double y, int keys = 0); | |
139 | void base_OnRightClick(double x, double y, int keys = 0); | |
140 | ||
141 | void Redraw(wxDC& dc); | |
142 | void RemoveShape(wxPyShape *shape); | |
143 | void SetDiagram(wxDiagram *diagram); | |
211a46cf | 144 | void Snap(double *INOUT, double *INOUT); |
e91a9dfc | 145 | |
c893f25d | 146 | |
d14a1e28 | 147 | %pythoncode { |
c893f25d RD |
148 | def GetShapeList(self): |
149 | return self.GetDiagram().GetShapeList() | |
d14a1e28 | 150 | } |
e91a9dfc RD |
151 | }; |
152 | ||
153 | ||
154 | //--------------------------------------------------------------------------- | |
155 | ||
156 |