]>
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 | %{ | |
d14a1e28 RD |
17 | #include "wx/wxPython/wxPython.h" |
18 | #include "wx/wxPython/pyclasses.h" | |
b6e2edde | 19 | |
0220cbc1 | 20 | #include <wx/glcanvas.h> |
0220cbc1 | 21 | |
4b123bb9 HH |
22 | %} |
23 | ||
24 | //--------------------------------------------------------------------------- | |
25 | ||
d14a1e28 | 26 | %import core.i |
54f9ee45 | 27 | %pythoncode { wx = _core } |
99109c0f | 28 | %pythoncode { __docfilter__ = wx.__DocFilter(globals()) } |
137b5242 | 29 | |
b2dc1044 | 30 | |
089142a5 | 31 | MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas")); |
b2dc1044 RD |
32 | MAKE_CONST_WXSTRING_NOSWIG(EmptyString); |
33 | ||
34 | ||
d14a1e28 | 35 | %include _glcanvas_rename.i |
137b5242 | 36 | |
4b123bb9 HH |
37 | //--------------------------------------------------------------------------- |
38 | ||
39 | class wxPalette; | |
4b123bb9 HH |
40 | |
41 | //--------------------------------------------------------------------------- | |
42 | ||
9416aa89 | 43 | class wxGLContext : public wxObject { |
4b123bb9 | 44 | public: |
d14a1e28 | 45 | #ifndef __WXMAC__ |
0122b7e3 | 46 | wxGLContext(bool isRGB, wxGLCanvas *win, |
d14a1e28 RD |
47 | const wxPalette& palette = wxNullPalette, |
48 | const wxGLContext* other = NULL); | |
49 | #else | |
50 | %extend { | |
51 | wxGLContext(bool isRGB, wxGLCanvas *win, | |
52 | const wxPalette& palette = wxNullPalette, | |
53 | const wxGLContext* other = NULL) { | |
54 | AGLPixelFormat fmt; // TODO: How should this be initialized? | |
55 | return new wxGLContext(fmt, win, palette, other); | |
56 | } | |
57 | } | |
58 | ||
b6e5c445 | 59 | #endif |
4b123bb9 HH |
60 | ~wxGLContext(); |
61 | ||
62 | void SetCurrent(); | |
1e4a197e | 63 | void SetColour(const wxString& colour); |
4b123bb9 HH |
64 | void SwapBuffers(); |
65 | ||
66 | #ifdef __WXGTK__ | |
67 | void SetupPixelFormat(); | |
68 | void SetupPalette(const wxPalette& palette); | |
69 | wxPalette CreateDefaultPalette(); | |
70 | wxPalette* GetPalette(); | |
71 | #endif | |
72 | ||
73 | wxWindow* GetWindow(); | |
74 | }; | |
75 | ||
76 | //--------------------------------------------------------------------------- | |
77 | ||
c3819e4a RD |
78 | enum { |
79 | WX_GL_RGBA, // use true color palette | |
80 | WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA | |
81 | WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay | |
82 | WX_GL_DOUBLEBUFFER, // use doublebuffer | |
83 | WX_GL_STEREO, // use stereoscopic display | |
84 | WX_GL_AUX_BUFFERS, // number of auxiliary buffers | |
85 | WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits) | |
86 | WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits) | |
87 | WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits) | |
88 | WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits) | |
89 | WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32) | |
90 | WX_GL_STENCIL_SIZE, // bits for stencil buffer | |
91 | WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits) | |
92 | WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits) | |
93 | WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits) | |
94 | WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) | |
95 | }; | |
96 | ||
97 | ||
d14a1e28 | 98 | %typemap(in) int *attribList (int *temp) { |
c368d904 | 99 | int i; |
d14a1e28 RD |
100 | if (PySequence_Check($input)) { |
101 | int size = PyObject_Length($input); | |
c368d904 RD |
102 | temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); |
103 | for (i = 0; i < size; i++) { | |
d14a1e28 | 104 | temp[i] = PyInt_AsLong(PySequence_GetItem($input, i)); |
c368d904 RD |
105 | } |
106 | temp[size] = 0; | |
d14a1e28 | 107 | $1 = temp; |
c368d904 RD |
108 | } |
109 | } | |
110 | ||
d14a1e28 | 111 | %typemap(freearg) int *attribList |
c368d904 | 112 | { |
d14a1e28 | 113 | delete [] $1; |
c368d904 RD |
114 | } |
115 | ||
116 | ||
117 | ||
ab11ebfa | 118 | class wxGLCanvas : public wxWindow { |
4b123bb9 | 119 | public: |
2b9048c5 | 120 | %pythonAppend wxGLCanvas "self._setOORInfo(self)" |
4b123bb9 | 121 | wxGLCanvas(wxWindow *parent, wxWindowID id = -1, |
1e7ecb7b RD |
122 | const wxPoint& pos = wxDefaultPosition, |
123 | const wxSize& size = wxDefaultSize, long style = 0, | |
137b5242 | 124 | const wxString& name = wxPyGLCanvasNameStr, |
c368d904 | 125 | int *attribList = NULL, |
4b123bb9 HH |
126 | const wxPalette& palette = wxNullPalette); |
127 | ||
2b9048c5 | 128 | %pythonAppend wxGLCanvas "val._setOORInfo(val)" |
6ab5b2e6 | 129 | %name(GLCanvasWithContext) |
0122b7e3 RD |
130 | wxGLCanvas( wxWindow *parent, |
131 | const wxGLContext *shared = NULL, | |
132 | wxWindowID id = -1, | |
133 | const wxPoint& pos = wxDefaultPosition, | |
134 | const wxSize& size = wxDefaultSize, | |
135 | long style = 0, | |
137b5242 | 136 | const wxString& name = wxPyGLCanvasNameStr, |
0122b7e3 RD |
137 | int *attribList = NULL, |
138 | const wxPalette& palette = wxNullPalette ); | |
139 | ||
4b123bb9 HH |
140 | |
141 | void SetCurrent(); | |
1e4a197e | 142 | void SetColour(const wxString& colour); |
4b123bb9 HH |
143 | void SwapBuffers(); |
144 | ||
145 | wxGLContext* GetContext(); | |
0122b7e3 | 146 | |
0220cbc1 RD |
147 | #ifdef __WXMSW__ |
148 | void SetupPixelFormat(int *attribList = NULL); | |
149 | void SetupPalette(const wxPalette& palette); | |
150 | wxPalette CreateDefaultPalette(); | |
151 | wxPalette* GetPalette(); | |
152 | #endif | |
4b123bb9 HH |
153 | }; |
154 | ||
155 | ||
156 | //--------------------------------------------------------------------------- | |
157 | ||
4b123bb9 HH |
158 | %init %{ |
159 | ||
4b123bb9 HH |
160 | %} |
161 | ||
162 | //--------------------------------------------------------------------------- | |
163 | //--------------------------------------------------------------------------- |