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