]>
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: |
b6e5c445 | 57 | #ifndef __WXMAC__ // fix this? |
0122b7e3 RD |
58 | wxGLContext(bool isRGB, wxGLCanvas *win, |
59 | const wxPalette& palette = wxNullPalette); | |
b6e5c445 | 60 | #endif |
4b123bb9 HH |
61 | ~wxGLContext(); |
62 | ||
63 | void SetCurrent(); | |
64 | void SetColour(const char *colour); | |
65 | void SwapBuffers(); | |
66 | ||
67 | #ifdef __WXGTK__ | |
68 | void SetupPixelFormat(); | |
69 | void SetupPalette(const wxPalette& palette); | |
70 | wxPalette CreateDefaultPalette(); | |
71 | wxPalette* GetPalette(); | |
72 | #endif | |
73 | ||
74 | wxWindow* GetWindow(); | |
75 | }; | |
76 | ||
77 | //--------------------------------------------------------------------------- | |
78 | ||
c368d904 RD |
79 | %typemap(python, in) int *attribList (int *temp) { |
80 | int i; | |
81 | if (PySequence_Check($source)) { | |
82 | int size = PyObject_Length($source); | |
83 | temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); | |
84 | for (i = 0; i < size; i++) { | |
85 | temp[i] = PyInt_AsLong(PySequence_GetItem($source, i)); | |
86 | } | |
87 | temp[size] = 0; | |
88 | $target = temp; | |
89 | } | |
90 | } | |
91 | ||
92 | %typemap(python, freearg) int *attribList | |
93 | { | |
94 | delete [] $source; | |
95 | } | |
96 | ||
97 | ||
98 | ||
ab11ebfa | 99 | class wxGLCanvas : public wxWindow { |
4b123bb9 HH |
100 | public: |
101 | wxGLCanvas(wxWindow *parent, wxWindowID id = -1, | |
1e7ecb7b RD |
102 | const wxPoint& pos = wxDefaultPosition, |
103 | const wxSize& size = wxDefaultSize, long style = 0, | |
4b123bb9 | 104 | const char* name = "GLCanvas", |
c368d904 | 105 | int *attribList = NULL, |
4b123bb9 HH |
106 | const wxPalette& palette = wxNullPalette); |
107 | ||
0122b7e3 RD |
108 | %name(wxGLCanvasWithContext) |
109 | wxGLCanvas( wxWindow *parent, | |
110 | const wxGLContext *shared = NULL, | |
111 | wxWindowID id = -1, | |
112 | const wxPoint& pos = wxDefaultPosition, | |
113 | const wxSize& size = wxDefaultSize, | |
114 | long style = 0, | |
115 | const char* name = "GLCanvas", | |
116 | int *attribList = NULL, | |
117 | const wxPalette& palette = wxNullPalette ); | |
118 | ||
0220cbc1 RD |
119 | // bool Create(wxWindow *parent, wxWindowID id, |
120 | // const wxPoint& pos, const wxSize& size, long style, const wxString& name); | |
0122b7e3 RD |
121 | |
122 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
123 | %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)" | |
4b123bb9 HH |
124 | |
125 | void SetCurrent(); | |
126 | void SetColour(const char *colour); | |
127 | void SwapBuffers(); | |
128 | ||
129 | wxGLContext* GetContext(); | |
0122b7e3 | 130 | |
0220cbc1 RD |
131 | #ifdef __WXMSW__ |
132 | void SetupPixelFormat(int *attribList = NULL); | |
133 | void SetupPalette(const wxPalette& palette); | |
134 | wxPalette CreateDefaultPalette(); | |
135 | wxPalette* GetPalette(); | |
136 | #endif | |
4b123bb9 HH |
137 | }; |
138 | ||
139 | ||
140 | //--------------------------------------------------------------------------- | |
141 | ||
4b123bb9 HH |
142 | %init %{ |
143 | ||
e508a2b6 RD |
144 | wxClassInfo::CleanUpClasses(); |
145 | wxClassInfo::InitializeClasses(); | |
4b123bb9 HH |
146 | |
147 | %} | |
148 | ||
149 | //--------------------------------------------------------------------------- | |
150 | //--------------------------------------------------------------------------- |