]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/glcanvas/glcanvas.i
Add a package="name" option to the %module directive in my SWIG patch
[wxWidgets.git] / wxPython / contrib / glcanvas / glcanvas.i
CommitLineData
4b123bb9
HH
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
c8fac2b6
RD
14%define DOCSTRING
15"`GLCanvas` provides an OpenGL Context on a `wx.Window`."
16%enddef
17%module(docstring=DOCSTRING) glcanvas
4b123bb9
HH
18
19%{
d14a1e28
RD
20#include "wx/wxPython/wxPython.h"
21#include "wx/wxPython/pyclasses.h"
b6e2edde 22
0220cbc1 23#include <wx/glcanvas.h>
0220cbc1 24
4b123bb9
HH
25%}
26
27//---------------------------------------------------------------------------
28
d14a1e28 29%import core.i
54f9ee45 30%pythoncode { wx = _core }
99109c0f 31%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
137b5242 32
b2dc1044 33
089142a5 34MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
b2dc1044
RD
35MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
36
37
d14a1e28 38%include _glcanvas_rename.i
137b5242 39
4b123bb9
HH
40//---------------------------------------------------------------------------
41
42class wxPalette;
4b123bb9
HH
43
44//---------------------------------------------------------------------------
45
ab1f7d2a
RD
46MustHaveApp(wxGLContext);
47
9416aa89 48class wxGLContext : public wxObject {
4b123bb9 49public:
d14a1e28 50#ifndef __WXMAC__
0122b7e3 51 wxGLContext(bool isRGB, wxGLCanvas *win,
d14a1e28
RD
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
b6e5c445 64#endif
4b123bb9
HH
65 ~wxGLContext();
66
67 void SetCurrent();
1e4a197e 68 void SetColour(const wxString& colour);
4b123bb9
HH
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
c3819e4a
RD
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
d14a1e28 103%typemap(in) int *attribList (int *temp) {
c368d904 104 int i;
d14a1e28
RD
105 if (PySequence_Check($input)) {
106 int size = PyObject_Length($input);
c368d904
RD
107 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
108 for (i = 0; i < size; i++) {
d14a1e28 109 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
c368d904
RD
110 }
111 temp[size] = 0;
d14a1e28 112 $1 = temp;
c368d904
RD
113 }
114}
115
d14a1e28 116%typemap(freearg) int *attribList
c368d904 117{
d14a1e28 118 delete [] $1;
c368d904
RD
119}
120
121
122
ab1f7d2a
RD
123MustHaveApp(wxGLCanvas);
124
ab11ebfa 125class wxGLCanvas : public wxWindow {
4b123bb9 126public:
2b9048c5 127 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
4b123bb9 128 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
1e7ecb7b
RD
129 const wxPoint& pos = wxDefaultPosition,
130 const wxSize& size = wxDefaultSize, long style = 0,
137b5242 131 const wxString& name = wxPyGLCanvasNameStr,
c368d904 132 int *attribList = NULL,
4b123bb9
HH
133 const wxPalette& palette = wxNullPalette);
134
2b9048c5 135 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
6ab5b2e6 136 %name(GLCanvasWithContext)
0122b7e3
RD
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,
137b5242 143 const wxString& name = wxPyGLCanvasNameStr,
0122b7e3
RD
144 int *attribList = NULL,
145 const wxPalette& palette = wxNullPalette );
146
4b123bb9
HH
147
148 void SetCurrent();
1e4a197e 149 void SetColour(const wxString& colour);
4b123bb9
HH
150 void SwapBuffers();
151
152 wxGLContext* GetContext();
0122b7e3 153
0220cbc1
RD
154#ifdef __WXMSW__
155 void SetupPixelFormat(int *attribList = NULL);
156 void SetupPalette(const wxPalette& palette);
157 wxPalette CreateDefaultPalette();
158 wxPalette* GetPalette();
159#endif
4b123bb9
HH
160};
161
162
163//---------------------------------------------------------------------------
164
4b123bb9
HH
165%init %{
166
4b123bb9
HH
167%}
168
169//---------------------------------------------------------------------------
170//---------------------------------------------------------------------------