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