]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
exchanged the base classes order, wxObject must be always first
[wxWidgets.git] / wxPython / contrib / glcanvas / glcanvas.i
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 %{
17 #include "wxPython.h"
18
19 #ifdef __WXMAC__ // avoid a bug in Carbon headers
20 #define scalb scalbn
21 #endif
22
23 #ifdef __WXMSW__
24 #include "myglcanvas.h"
25 #else
26 #include <wx/glcanvas.h>
27 #endif
28
29 %}
30
31 //---------------------------------------------------------------------------
32
33 %include typemaps.i
34 %include my_typemaps.i
35
36 %extern wx.i
37 %extern windows.i
38 %extern windows2.i
39 %extern windows3.i
40 %extern frames.i
41 %extern _defs.i
42 %extern misc.i
43 %extern gdi.i
44 %extern controls.i
45 %extern events.i
46
47
48 %pragma(python) code = "import wx"
49
50 //----------------------------------------------------------------------
51
52 %{
53 // Put some wx default wxChar* values into wxStrings.
54 static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
55 static const wxString wxPyEmptyString(wxT(""));
56 %}
57
58 //---------------------------------------------------------------------------
59
60 class wxPalette;
61 class wxWindow;
62 class wxSize;
63 class wxPoint;
64 class wxGLCanvas;
65
66 //---------------------------------------------------------------------------
67
68 class wxGLContext : public wxObject {
69 public:
70 #ifndef __WXMAC__ // fix this?
71 wxGLContext(bool isRGB, wxGLCanvas *win,
72 const wxPalette& palette = wxNullPalette);
73 #endif
74 ~wxGLContext();
75
76 void SetCurrent();
77 void SetColour(const wxString& colour);
78 void SwapBuffers();
79
80 #ifdef __WXGTK__
81 void SetupPixelFormat();
82 void SetupPalette(const wxPalette& palette);
83 wxPalette CreateDefaultPalette();
84 wxPalette* GetPalette();
85 #endif
86
87 wxWindow* GetWindow();
88 };
89
90 //---------------------------------------------------------------------------
91
92 enum {
93 WX_GL_RGBA, // use true color palette
94 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
95 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
96 WX_GL_DOUBLEBUFFER, // use doublebuffer
97 WX_GL_STEREO, // use stereoscopic display
98 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
99 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
100 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
101 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
102 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
103 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
104 WX_GL_STENCIL_SIZE, // bits for stencil buffer
105 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
106 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
107 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
108 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
109 };
110
111
112 %typemap(python, in) int *attribList (int *temp) {
113 int i;
114 if (PySequence_Check($source)) {
115 int size = PyObject_Length($source);
116 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
117 for (i = 0; i < size; i++) {
118 temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
119 }
120 temp[size] = 0;
121 $target = temp;
122 }
123 }
124
125 %typemap(python, freearg) int *attribList
126 {
127 delete [] $source;
128 }
129
130
131
132 class wxGLCanvas : public wxWindow {
133 public:
134 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
135 const wxPoint& pos = wxDefaultPosition,
136 const wxSize& size = wxDefaultSize, long style = 0,
137 const wxString& name = wxPyGLCanvasNameStr,
138 int *attribList = NULL,
139 const wxPalette& palette = wxNullPalette);
140
141 %name(wxGLCanvasWithContext)
142 wxGLCanvas( wxWindow *parent,
143 const wxGLContext *shared = NULL,
144 wxWindowID id = -1,
145 const wxPoint& pos = wxDefaultPosition,
146 const wxSize& size = wxDefaultSize,
147 long style = 0,
148 const wxString& name = wxPyGLCanvasNameStr,
149 int *attribList = NULL,
150 const wxPalette& palette = wxNullPalette );
151
152 // bool Create(wxWindow *parent, wxWindowID id,
153 // const wxPoint& pos, const wxSize& size, long style, const wxString& name);
154
155 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
156 %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
157
158 void SetCurrent();
159 void SetColour(const wxString& colour);
160 void SwapBuffers();
161
162 wxGLContext* GetContext();
163
164 #ifdef __WXMSW__
165 void SetupPixelFormat(int *attribList = NULL);
166 void SetupPalette(const wxPalette& palette);
167 wxPalette CreateDefaultPalette();
168 wxPalette* GetPalette();
169 #endif
170 };
171
172
173 //---------------------------------------------------------------------------
174
175 %init %{
176
177 %}
178
179 //---------------------------------------------------------------------------
180 //---------------------------------------------------------------------------