]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/glcanvas/glcanvas.i
Demo cleanup
[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
14%module glcanvas
15
16%{
1e7ecb7b 17#include "export.h"
0220cbc1 18#ifdef __WXMSW__
19cf4f80 19#include "myglcanvas.h"
0220cbc1
RD
20#else
21#include <wx/glcanvas.h>
22#endif
23
4b123bb9
HH
24%}
25
26//---------------------------------------------------------------------------
27
28%include typemaps.i
29%include my_typemaps.i
30
31%extern wx.i
32%extern windows.i
33%extern windows2.i
34%extern windows3.i
35%extern frames.i
36%extern _defs.i
37%extern misc.i
38%extern gdi.i
39%extern controls.i
40%extern events.i
41
42
4b123bb9
HH
43%pragma(python) code = "import wx"
44
45//---------------------------------------------------------------------------
46
47class wxPalette;
48class wxWindow;
49class wxSize;
50class wxPoint;
51class wxGLCanvas;
52
53//---------------------------------------------------------------------------
54
9416aa89 55class wxGLContext : public wxObject {
4b123bb9 56public:
b6e5c445 57#ifndef __WXMAC__ // fix this?
0122b7e3
RD
58 wxGLContext(bool isRGB, wxGLCanvas *win,
59 const wxPalette& palette = wxNullPalette);
b6e5c445 60#endif
4b123bb9
HH
61 ~wxGLContext();
62
63 void SetCurrent();
64 void SetColour(const char *colour);
65 void SwapBuffers();
66
67#ifdef __WXGTK__
68 void SetupPixelFormat();
69 void SetupPalette(const wxPalette& palette);
70 wxPalette CreateDefaultPalette();
71 wxPalette* GetPalette();
72#endif
73
74 wxWindow* GetWindow();
75};
76
77//---------------------------------------------------------------------------
78
c3819e4a
RD
79enum {
80 WX_GL_RGBA, // use true color palette
81 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
82 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
83 WX_GL_DOUBLEBUFFER, // use doublebuffer
84 WX_GL_STEREO, // use stereoscopic display
85 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
86 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
87 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
88 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
89 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
90 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
91 WX_GL_STENCIL_SIZE, // bits for stencil buffer
92 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
93 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
94 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
95 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
96};
97
98
c368d904
RD
99%typemap(python, in) int *attribList (int *temp) {
100 int i;
101 if (PySequence_Check($source)) {
102 int size = PyObject_Length($source);
103 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
104 for (i = 0; i < size; i++) {
105 temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
106 }
107 temp[size] = 0;
108 $target = temp;
109 }
110}
111
112%typemap(python, freearg) int *attribList
113{
114 delete [] $source;
115}
116
117
118
ab11ebfa 119class wxGLCanvas : public wxWindow {
4b123bb9
HH
120public:
121 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
1e7ecb7b
RD
122 const wxPoint& pos = wxDefaultPosition,
123 const wxSize& size = wxDefaultSize, long style = 0,
4b123bb9 124 const char* name = "GLCanvas",
c368d904 125 int *attribList = NULL,
4b123bb9
HH
126 const wxPalette& palette = wxNullPalette);
127
0122b7e3
RD
128 %name(wxGLCanvasWithContext)
129 wxGLCanvas( wxWindow *parent,
130 const wxGLContext *shared = NULL,
131 wxWindowID id = -1,
132 const wxPoint& pos = wxDefaultPosition,
133 const wxSize& size = wxDefaultSize,
134 long style = 0,
135 const char* name = "GLCanvas",
136 int *attribList = NULL,
137 const wxPalette& palette = wxNullPalette );
138
0220cbc1
RD
139// bool Create(wxWindow *parent, wxWindowID id,
140// const wxPoint& pos, const wxSize& size, long style, const wxString& name);
0122b7e3
RD
141
142 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
143 %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
4b123bb9
HH
144
145 void SetCurrent();
146 void SetColour(const char *colour);
147 void SwapBuffers();
148
149 wxGLContext* GetContext();
0122b7e3 150
0220cbc1
RD
151#ifdef __WXMSW__
152 void SetupPixelFormat(int *attribList = NULL);
153 void SetupPalette(const wxPalette& palette);
154 wxPalette CreateDefaultPalette();
155 wxPalette* GetPalette();
156#endif
4b123bb9
HH
157};
158
159
160//---------------------------------------------------------------------------
161
4b123bb9
HH
162%init %{
163
e508a2b6
RD
164 wxClassInfo::CleanUpClasses();
165 wxClassInfo::InitializeClasses();
4b123bb9
HH
166
167%}
168
169//---------------------------------------------------------------------------
170//---------------------------------------------------------------------------