]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/glcanvas/glcanvas.i
fixed memory leaks when reading invalid GIFs
[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
b2eb030f
RD
17
18%module(package="wx", docstring=DOCSTRING) glcanvas
4b123bb9
HH
19
20%{
d14a1e28
RD
21#include "wx/wxPython/wxPython.h"
22#include "wx/wxPython/pyclasses.h"
b6e2edde 23
0220cbc1 24#include <wx/glcanvas.h>
0220cbc1 25
4b123bb9
HH
26%}
27
28//---------------------------------------------------------------------------
29
d14a1e28 30%import core.i
54f9ee45 31%pythoncode { wx = _core }
99109c0f 32%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
137b5242 33
b2dc1044 34
089142a5 35MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
b2dc1044
RD
36MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
37
4b123bb9
HH
38//---------------------------------------------------------------------------
39
40class wxPalette;
4b123bb9
HH
41
42//---------------------------------------------------------------------------
43
ab1f7d2a
RD
44MustHaveApp(wxGLContext);
45
9416aa89 46class wxGLContext : public wxObject {
4b123bb9 47public:
d14a1e28 48#ifndef __WXMAC__
8e1a5d3a 49 wxGLContext(wxGLCanvas *win, const wxGLContext* other = NULL);
d14a1e28
RD
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
b6e5c445 60#endif
4b123bb9
HH
61 ~wxGLContext();
62
df4895f6 63#ifndef __WXMAC__
925430af 64 void SetCurrent(const wxGLCanvas& win);
df4895f6 65#endif
4b123bb9
HH
66};
67
68//---------------------------------------------------------------------------
69
c3819e4a
RD
70enum {
71 WX_GL_RGBA, // use true color palette
72 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
73 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
74 WX_GL_DOUBLEBUFFER, // use doublebuffer
75 WX_GL_STEREO, // use stereoscopic display
76 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
77 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
78 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
79 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
80 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
81 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
82 WX_GL_STENCIL_SIZE, // bits for stencil buffer
83 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
84 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
85 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
86 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
87};
88
89
d14a1e28 90%typemap(in) int *attribList (int *temp) {
c368d904 91 int i;
d14a1e28
RD
92 if (PySequence_Check($input)) {
93 int size = PyObject_Length($input);
c368d904
RD
94 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
95 for (i = 0; i < size; i++) {
d14a1e28 96 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
c368d904
RD
97 }
98 temp[size] = 0;
d14a1e28 99 $1 = temp;
c368d904
RD
100 }
101}
102
d14a1e28 103%typemap(freearg) int *attribList
c368d904 104{
d14a1e28 105 delete [] $1;
c368d904
RD
106}
107
108
109
ab1f7d2a
RD
110MustHaveApp(wxGLCanvas);
111
ab11ebfa 112class wxGLCanvas : public wxWindow {
4b123bb9 113public:
2b9048c5 114 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
4b123bb9 115 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
1e7ecb7b
RD
116 const wxPoint& pos = wxDefaultPosition,
117 const wxSize& size = wxDefaultSize, long style = 0,
137b5242 118 const wxString& name = wxPyGLCanvasNameStr,
c368d904 119 int *attribList = NULL,
4b123bb9
HH
120 const wxPalette& palette = wxNullPalette);
121
2b9048c5 122 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
1b8c7ba6 123 %RenameCtor(GLCanvasWithContext,
0122b7e3
RD
124 wxGLCanvas( wxWindow *parent,
125 const wxGLContext *shared = NULL,
126 wxWindowID id = -1,
127 const wxPoint& pos = wxDefaultPosition,
128 const wxSize& size = wxDefaultSize,
129 long style = 0,
137b5242 130 const wxString& name = wxPyGLCanvasNameStr,
0122b7e3 131 int *attribList = NULL,
1b8c7ba6 132 const wxPalette& palette = wxNullPalette ));
0122b7e3 133
7f442096 134 %nokwargs SetCurrent;
df4895f6 135 void SetCurrent();
7f442096 136#ifndef __WXMAC__
925430af 137 void SetCurrent(const wxGLContext& RC);
df4895f6 138#endif
1e4a197e 139 void SetColour(const wxString& colour);
4b123bb9
HH
140 void SwapBuffers();
141
142 wxGLContext* GetContext();
0122b7e3 143
0220cbc1
RD
144#ifdef __WXMSW__
145 void SetupPixelFormat(int *attribList = NULL);
146 void SetupPalette(const wxPalette& palette);
147 wxPalette CreateDefaultPalette();
148 wxPalette* GetPalette();
149#endif
e70b4d2d
RD
150
151 %property(Context, GetContext, doc="See `GetContext`");
4b123bb9
HH
152};
153
154
155//---------------------------------------------------------------------------
156
4b123bb9
HH
157%init %{
158
4b123bb9
HH
159%}
160
161//---------------------------------------------------------------------------
162//---------------------------------------------------------------------------