]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/ogl/oglcanvas.i
Delete help text entry before adding new one, else
[wxWidgets.git] / wxPython / contrib / ogl / oglcanvas.i
CommitLineData
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
14%module oglcanvas
15
16%{
6e2129f9 17#include "wxPython.h"
e91a9dfc
RD
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
edf2f43e 34%import oglbasic.i
e91a9dfc
RD
35
36
37%pragma(python) code = "import wx"
38
39//---------------------------------------------------------------------------
4fcf77bc
RD
40%{
41 // Put some wx default wxChar* values into wxStrings.
42 DECLARE_DEF_STRING(ShapeCanvasNameStr);
43%}
44
e91a9dfc
RD
45//---------------------------------------------------------------------------
46//---------------------------------------------------------------------------
47
9416aa89 48class wxDiagram : public wxObject {
e91a9dfc
RD
49public:
50 wxDiagram();
9416aa89 51 //~wxDiagram();
e91a9dfc 52
edf2f43e 53 void AddShape(wxPyShape* shape, wxPyShape *addAfter = NULL);
e91a9dfc
RD
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();
c893f25d 67 return wxPy_ConvertShapeList(list, "wxPyShape");
e91a9dfc
RD
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);
211a46cf 99 void Snap(double *INOUT, double *INOUT);
e91a9dfc
RD
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
117class wxPyShapeCanvas : public wxScrolledWindow {
118public:
119 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
1e7ecb7b
RD
120 const wxPoint& pos = wxDefaultPosition,
121 const wxSize& size = wxDefaultSize,
4fcf77bc
RD
122 long style = wxBORDER,
123 const wxString& name = wxPyShapeCanvasNameStr);
e91a9dfc 124
0122b7e3
RD
125 void _setCallbackInfo(PyObject* self, PyObject* _class);
126 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShapeCanvas)"
127 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
e91a9dfc
RD
128
129 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
130
131 // **** Need a typemap for wxClassInfo, or implement wxObject, etc.....
4e0dcbb1 132 wxPyShape* FindShape(double x1, double y, int *OUTPUT,
e91a9dfc
RD
133 wxClassInfo *info = NULL, wxPyShape* notImage = NULL);
134
4e0dcbb1 135 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op);
e91a9dfc
RD
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);
211a46cf 154 void Snap(double *INOUT, double *INOUT);
e91a9dfc 155
c893f25d
RD
156
157 %pragma(python) addtoclass = "
158 def GetShapeList(self):
159 return self.GetDiagram().GetShapeList()
160 "
161
e91a9dfc
RD
162};
163
164
165//---------------------------------------------------------------------------
166
167