]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/ogl/oglcanvas.i
Demo cleanup
[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%{
1e7ecb7b 17#include "export.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//---------------------------------------------------------------------------
40//---------------------------------------------------------------------------
41//---------------------------------------------------------------------------
42
9416aa89 43class wxDiagram : public wxObject {
e91a9dfc
RD
44public:
45 wxDiagram();
9416aa89 46 //~wxDiagram();
e91a9dfc 47
edf2f43e 48 void AddShape(wxPyShape* shape, wxPyShape *addAfter = NULL);
e91a9dfc
RD
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);
211a46cf 94 void Snap(double *INOUT, double *INOUT);
e91a9dfc
RD
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
112class wxPyShapeCanvas : public wxScrolledWindow {
113public:
114 wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
1e7ecb7b
RD
115 const wxPoint& pos = wxDefaultPosition,
116 const wxSize& size = wxDefaultSize,
e91a9dfc
RD
117 long style = wxBORDER);
118
0122b7e3
RD
119 void _setCallbackInfo(PyObject* self, PyObject* _class);
120 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShapeCanvas)"
121 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
e91a9dfc
RD
122
123 void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL);
124
125 // **** Need a typemap for wxClassInfo, or implement wxObject, etc.....
4e0dcbb1 126 wxPyShape* FindShape(double x1, double y, int *OUTPUT,
e91a9dfc
RD
127 wxClassInfo *info = NULL, wxPyShape* notImage = NULL);
128
4e0dcbb1 129 wxPyShape * FindFirstSensitiveShape(double x1, double y, int *OUTPUT, int op);
e91a9dfc
RD
130 wxDiagram* GetDiagram();
131
132 bool GetQuickEditMode();
133 void InsertShape(wxPyShape* shape);
134
135
136 void base_OnBeginDragLeft(double x, double y, int keys = 0);
137 void base_OnBeginDragRight(double x, double y, int keys = 0);
138 void base_OnEndDragLeft(double x, double y, int keys = 0);
139 void base_OnEndDragRight(double x, double y, int keys = 0);
140 void base_OnDragLeft(bool draw, double x, double y, int keys = 0);
141 void base_OnDragRight(bool draw, double x, double y, int keys = 0);
142 void base_OnLeftClick(double x, double y, int keys = 0);
143 void base_OnRightClick(double x, double y, int keys = 0);
144
145 void Redraw(wxDC& dc);
146 void RemoveShape(wxPyShape *shape);
147 void SetDiagram(wxDiagram *diagram);
211a46cf 148 void Snap(double *INOUT, double *INOUT);
e91a9dfc
RD
149
150};
151
152
153//---------------------------------------------------------------------------
154
155