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