]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/contrib/glcanvas/glcanvas.i
Some ifdef's to correct compile problems on wxMac
[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%module glcanvas
15
16%{
17#include "wx/wxPython/wxPython.h"
18#include "wx/wxPython/pyclasses.h"
19
20#include <wx/glcanvas.h>
21
22%}
23
24//---------------------------------------------------------------------------
25
26%import core.i
27%pythoncode { wx = core }
28
29
30MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
31MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
32
33
34%include _glcanvas_rename.i
35
36//---------------------------------------------------------------------------
37
38class wxPalette;
39
40//---------------------------------------------------------------------------
41
42class wxGLContext : public wxObject {
43public:
44#ifndef __WXMAC__
45 wxGLContext(bool isRGB, wxGLCanvas *win,
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
58#endif
59 ~wxGLContext();
60
61 void SetCurrent();
62 void SetColour(const wxString& colour);
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
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
97%typemap(in) int *attribList (int *temp) {
98 int i;
99 if (PySequence_Check($input)) {
100 int size = PyObject_Length($input);
101 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
102 for (i = 0; i < size; i++) {
103 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
104 }
105 temp[size] = 0;
106 $1 = temp;
107 }
108}
109
110%typemap(freearg) int *attribList
111{
112 delete [] $1;
113}
114
115
116
117class wxGLCanvas : public wxWindow {
118public:
119 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
120 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
121 const wxPoint& pos = wxDefaultPosition,
122 const wxSize& size = wxDefaultSize, long style = 0,
123 const wxString& name = wxPyGLCanvasNameStr,
124 int *attribList = NULL,
125 const wxPalette& palette = wxNullPalette);
126
127 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
128 %name(GLCanvasWithContext)
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 wxString& name = wxPyGLCanvasNameStr,
136 int *attribList = NULL,
137 const wxPalette& palette = wxNullPalette );
138
139
140 void SetCurrent();
141 void SetColour(const wxString& colour);
142 void SwapBuffers();
143
144 wxGLContext* GetContext();
145
146#ifdef __WXMSW__
147 void SetupPixelFormat(int *attribList = NULL);
148 void SetupPalette(const wxPalette& palette);
149 wxPalette CreateDefaultPalette();
150 wxPalette* GetPalette();
151#endif
152};
153
154
155//---------------------------------------------------------------------------
156
157%init %{
158
159%}
160
161//---------------------------------------------------------------------------
162//---------------------------------------------------------------------------