]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
All platforms have the same GLCanvas API now
[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 %define DOCSTRING
15 "`GLCanvas` provides an OpenGL Context on a `wx.Window`."
16 %enddef
17
18 %module(package="wx", docstring=DOCSTRING) glcanvas
19
20 %{
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
23
24 #include <wx/glcanvas.h>
25
26 %}
27
28 //---------------------------------------------------------------------------
29
30 %import core.i
31 %pythoncode { wx = _core }
32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
33
34
35 MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
36 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
37
38 //---------------------------------------------------------------------------
39
40 class wxPalette;
41
42 //---------------------------------------------------------------------------
43
44 MustHaveApp(wxGLContext);
45
46 class wxGLContext : public wxObject {
47 public:
48 wxGLContext(wxGLCanvas *win, const wxGLContext* other = NULL);
49 ~wxGLContext();
50
51 #ifndef __WXMAC__
52 void SetCurrent(const wxGLCanvas& win);
53 #endif
54 };
55
56 //---------------------------------------------------------------------------
57
58 enum {
59 WX_GL_RGBA, // use true color palette
60 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
61 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
62 WX_GL_DOUBLEBUFFER, // use doublebuffer
63 WX_GL_STEREO, // use stereoscopic display
64 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
65 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
66 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
67 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
68 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
69 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
70 WX_GL_STENCIL_SIZE, // bits for stencil buffer
71 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
72 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
73 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
74 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
75 };
76
77
78 %typemap(in) const int *attribList (int *temp) {
79 int i;
80 if (PySequence_Check($input)) {
81 int size = PyObject_Length($input);
82 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
83 for (i = 0; i < size; i++) {
84 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
85 }
86 temp[size] = 0;
87 $1 = temp;
88 }
89 }
90
91 %typemap(freearg) int *attribList
92 {
93 delete [] $1;
94 }
95
96
97
98 MustHaveApp(wxGLCanvas);
99
100 class wxGLCanvas : public wxWindow {
101 public:
102 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
103 wxGLCanvas(wxWindow *parent,
104 wxWindowID id = -1,
105 const int *attribList = NULL,
106 const wxPoint& pos = wxDefaultPosition,
107 const wxSize& size = wxDefaultSize,
108 long style = 0,
109 const wxString& name = wxPyGLCanvasNameStr,
110 const wxPalette& palette = wxNullPalette);
111
112 bool Create(wxWindow *parent,
113 wxWindowID id = wxID_ANY,
114 const wxPoint& pos = wxDefaultPosition,
115 const wxSize& size = wxDefaultSize,
116 long style = 0,
117 const wxString& name = wxGLCanvasName,
118 const int *attribList = NULL,
119 const wxPalette& palette = wxNullPalette);
120
121 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
122 %RenameCtor(GLCanvasWithContext,
123 wxGLCanvas( wxWindow *parent,
124 const wxGLContext *shared = NULL,
125 wxWindowID id = -1,
126 const wxPoint& pos = wxDefaultPosition,
127 const wxSize& size = wxDefaultSize,
128 long style = 0,
129 const wxString& name = wxPyGLCanvasNameStr,
130 const int *attribList = NULL,
131 const wxPalette& palette = wxNullPalette ));
132
133 %nokwargs SetCurrent;
134 void SetCurrent(const wxGLContext& context);
135 void SetColour(const wxString& colour);
136 void SwapBuffers();
137
138 // deprecated...
139 wxGLContext* GetContext();
140 void SetCurrent();
141
142
143 #ifdef __WXMSW__
144 // void SetupPixelFormat(int *attribList = NULL);
145 void SetupPalette(const wxPalette& palette);
146 wxPalette CreateDefaultPalette();
147 wxPalette* GetPalette();
148 #endif
149
150 %property(Context, GetContext, doc="See `GetContext`");
151 };
152
153
154 //---------------------------------------------------------------------------
155
156 %init %{
157
158 %}
159
160 //---------------------------------------------------------------------------
161 //---------------------------------------------------------------------------