]>
Commit | Line | Data |
---|---|---|
4b123bb9 HH |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: glcanvas.i | |
3 | // Purpose: SWIG definitions for the OpenGL wxWindows classes | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 15-Mar-1999 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
14 | %module glcanvas | |
15 | ||
16 | %{ | |
1e7ecb7b | 17 | #include "export.h" |
0220cbc1 | 18 | #ifdef __WXMSW__ |
19cf4f80 | 19 | #include "myglcanvas.h" |
0220cbc1 RD |
20 | #else |
21 | #include <wx/glcanvas.h> | |
22 | #endif | |
23 | ||
4b123bb9 HH |
24 | %} |
25 | ||
26 | //--------------------------------------------------------------------------- | |
27 | ||
28 | %include typemaps.i | |
29 | %include my_typemaps.i | |
30 | ||
31 | %extern wx.i | |
32 | %extern windows.i | |
33 | %extern windows2.i | |
34 | %extern windows3.i | |
35 | %extern frames.i | |
36 | %extern _defs.i | |
37 | %extern misc.i | |
38 | %extern gdi.i | |
39 | %extern controls.i | |
40 | %extern events.i | |
41 | ||
42 | ||
4b123bb9 HH |
43 | %pragma(python) code = "import wx" |
44 | ||
45 | //--------------------------------------------------------------------------- | |
46 | ||
47 | class wxPalette; | |
48 | class wxWindow; | |
49 | class wxSize; | |
50 | class wxPoint; | |
51 | class wxGLCanvas; | |
52 | ||
53 | //--------------------------------------------------------------------------- | |
54 | ||
9416aa89 | 55 | class wxGLContext : public wxObject { |
4b123bb9 | 56 | public: |
0122b7e3 RD |
57 | wxGLContext(bool isRGB, wxGLCanvas *win, |
58 | const wxPalette& palette = wxNullPalette); | |
4b123bb9 HH |
59 | ~wxGLContext(); |
60 | ||
61 | void SetCurrent(); | |
62 | void SetColour(const char *colour); | |
63 | void SwapBuffers(); | |
64 | ||
65 | #ifdef __WXGTK__ | |
66 | void SetupPixelFormat(); | |
67 | void SetupPalette(const wxPalette& palette); | |
68 | wxPalette CreateDefaultPalette(); | |
69 | wxPalette* GetPalette(); | |
70 | #endif | |
71 | ||
72 | wxWindow* GetWindow(); | |
73 | }; | |
74 | ||
75 | //--------------------------------------------------------------------------- | |
76 | ||
c368d904 RD |
77 | %typemap(python, in) int *attribList (int *temp) { |
78 | int i; | |
79 | if (PySequence_Check($source)) { | |
80 | int size = PyObject_Length($source); | |
81 | temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); | |
82 | for (i = 0; i < size; i++) { | |
83 | temp[i] = PyInt_AsLong(PySequence_GetItem($source, i)); | |
84 | } | |
85 | temp[size] = 0; | |
86 | $target = temp; | |
87 | } | |
88 | } | |
89 | ||
90 | %typemap(python, freearg) int *attribList | |
91 | { | |
92 | delete [] $source; | |
93 | } | |
94 | ||
95 | ||
96 | ||
4b123bb9 HH |
97 | class wxGLCanvas : public wxScrolledWindow { |
98 | public: | |
99 | wxGLCanvas(wxWindow *parent, wxWindowID id = -1, | |
1e7ecb7b RD |
100 | const wxPoint& pos = wxDefaultPosition, |
101 | const wxSize& size = wxDefaultSize, long style = 0, | |
4b123bb9 | 102 | const char* name = "GLCanvas", |
c368d904 | 103 | int *attribList = NULL, |
4b123bb9 HH |
104 | const wxPalette& palette = wxNullPalette); |
105 | ||
0122b7e3 RD |
106 | %name(wxGLCanvasWithContext) |
107 | wxGLCanvas( wxWindow *parent, | |
108 | const wxGLContext *shared = NULL, | |
109 | wxWindowID id = -1, | |
110 | const wxPoint& pos = wxDefaultPosition, | |
111 | const wxSize& size = wxDefaultSize, | |
112 | long style = 0, | |
113 | const char* name = "GLCanvas", | |
114 | int *attribList = NULL, | |
115 | const wxPalette& palette = wxNullPalette ); | |
116 | ||
0220cbc1 RD |
117 | // bool Create(wxWindow *parent, wxWindowID id, |
118 | // const wxPoint& pos, const wxSize& size, long style, const wxString& name); | |
0122b7e3 RD |
119 | |
120 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
121 | %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)" | |
4b123bb9 HH |
122 | |
123 | void SetCurrent(); | |
124 | void SetColour(const char *colour); | |
125 | void SwapBuffers(); | |
126 | ||
127 | wxGLContext* GetContext(); | |
0122b7e3 | 128 | |
0220cbc1 RD |
129 | #ifdef __WXMSW__ |
130 | void SetupPixelFormat(int *attribList = NULL); | |
131 | void SetupPalette(const wxPalette& palette); | |
132 | wxPalette CreateDefaultPalette(); | |
133 | wxPalette* GetPalette(); | |
134 | #endif | |
4b123bb9 HH |
135 | }; |
136 | ||
137 | ||
138 | //--------------------------------------------------------------------------- | |
139 | ||
4b123bb9 HH |
140 | %init %{ |
141 | ||
e508a2b6 RD |
142 | wxClassInfo::CleanUpClasses(); |
143 | wxClassInfo::InitializeClasses(); | |
4b123bb9 HH |
144 | |
145 | %} | |
146 | ||
147 | //--------------------------------------------------------------------------- | |
148 | //--------------------------------------------------------------------------- |