]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
e399a9e7f3a2ba57f5431182f84a484a729a9f73
[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 #ifndef __WXMAC__
49 wxGLContext(wxWindow *win, const wxGLContext* other = NULL);
50 #else
51 %extend {
52 wxGLContext(bool isRGB, wxGLCanvas *win,
53 const wxPalette& palette = wxNullPalette,
54 const wxGLContext* other = NULL) {
55 AGLPixelFormat fmt; // TODO: How should this be initialized?
56 return new wxGLContext(fmt, win, palette, other);
57 }
58 }
59
60 #endif
61 ~wxGLContext();
62
63 void SetCurrent(const wxGLCanvas& win);
64 };
65
66 //---------------------------------------------------------------------------
67
68 enum {
69 WX_GL_RGBA, // use true color palette
70 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
71 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
72 WX_GL_DOUBLEBUFFER, // use doublebuffer
73 WX_GL_STEREO, // use stereoscopic display
74 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
75 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
76 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
77 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
78 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
79 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
80 WX_GL_STENCIL_SIZE, // bits for stencil buffer
81 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
82 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
83 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
84 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
85 };
86
87
88 %typemap(in) int *attribList (int *temp) {
89 int i;
90 if (PySequence_Check($input)) {
91 int size = PyObject_Length($input);
92 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
93 for (i = 0; i < size; i++) {
94 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
95 }
96 temp[size] = 0;
97 $1 = temp;
98 }
99 }
100
101 %typemap(freearg) int *attribList
102 {
103 delete [] $1;
104 }
105
106
107
108 MustHaveApp(wxGLCanvas);
109
110 class wxGLCanvas : public wxWindow {
111 public:
112 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
113 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
114 const wxPoint& pos = wxDefaultPosition,
115 const wxSize& size = wxDefaultSize, long style = 0,
116 const wxString& name = wxPyGLCanvasNameStr,
117 int *attribList = NULL,
118 const wxPalette& palette = wxNullPalette);
119
120 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
121 %RenameCtor(GLCanvasWithContext,
122 wxGLCanvas( wxWindow *parent,
123 const wxGLContext *shared = NULL,
124 wxWindowID id = -1,
125 const wxPoint& pos = wxDefaultPosition,
126 const wxSize& size = wxDefaultSize,
127 long style = 0,
128 const wxString& name = wxPyGLCanvasNameStr,
129 int *attribList = NULL,
130 const wxPalette& palette = wxNullPalette ));
131
132
133 void SetCurrent(const wxGLContext& RC);
134 void SetColour(const wxString& colour);
135 void SwapBuffers();
136
137 wxGLContext* GetContext();
138
139 #ifdef __WXMSW__
140 void SetupPixelFormat(int *attribList = NULL);
141 void SetupPalette(const wxPalette& palette);
142 wxPalette CreateDefaultPalette();
143 wxPalette* GetPalette();
144 #endif
145 };
146
147
148 //---------------------------------------------------------------------------
149
150 %init %{
151
152 %}
153
154 //---------------------------------------------------------------------------
155 //---------------------------------------------------------------------------