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