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