]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
don't show generic dir dlg when it's the same as the standard one
[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 "export.h"
18 #ifdef __WXMSW__
19 #include "myglcanvas.h"
20 #else
21 #include <wx/glcanvas.h>
22 #endif
23
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
43 %pragma(python) code = "import wx"
44
45 //----------------------------------------------------------------------
46
47 %{
48 // Put some wx default wxChar* values into wxStrings.
49 static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
50 static const wxString wxPyEmptyString(wxT(""));
51 %}
52
53 //---------------------------------------------------------------------------
54
55 class wxPalette;
56 class wxWindow;
57 class wxSize;
58 class wxPoint;
59 class wxGLCanvas;
60
61 //---------------------------------------------------------------------------
62
63 class wxGLContext : public wxObject {
64 public:
65 #ifndef __WXMAC__ // fix this?
66 wxGLContext(bool isRGB, wxGLCanvas *win,
67 const wxPalette& palette = wxNullPalette);
68 #endif
69 ~wxGLContext();
70
71 void SetCurrent();
72 void SetColour(const char *colour);
73 void SwapBuffers();
74
75 #ifdef __WXGTK__
76 void SetupPixelFormat();
77 void SetupPalette(const wxPalette& palette);
78 wxPalette CreateDefaultPalette();
79 wxPalette* GetPalette();
80 #endif
81
82 wxWindow* GetWindow();
83 };
84
85 //---------------------------------------------------------------------------
86
87 enum {
88 WX_GL_RGBA, // use true color palette
89 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
90 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
91 WX_GL_DOUBLEBUFFER, // use doublebuffer
92 WX_GL_STEREO, // use stereoscopic display
93 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
94 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
95 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
96 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
97 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
98 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
99 WX_GL_STENCIL_SIZE, // bits for stencil buffer
100 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
101 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
102 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
103 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
104 };
105
106
107 %typemap(python, in) int *attribList (int *temp) {
108 int i;
109 if (PySequence_Check($source)) {
110 int size = PyObject_Length($source);
111 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
112 for (i = 0; i < size; i++) {
113 temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
114 }
115 temp[size] = 0;
116 $target = temp;
117 }
118 }
119
120 %typemap(python, freearg) int *attribList
121 {
122 delete [] $source;
123 }
124
125
126
127 class wxGLCanvas : public wxWindow {
128 public:
129 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
130 const wxPoint& pos = wxDefaultPosition,
131 const wxSize& size = wxDefaultSize, long style = 0,
132 const wxString& name = wxPyGLCanvasNameStr,
133 int *attribList = NULL,
134 const wxPalette& palette = wxNullPalette);
135
136 %name(wxGLCanvasWithContext)
137 wxGLCanvas( wxWindow *parent,
138 const wxGLContext *shared = NULL,
139 wxWindowID id = -1,
140 const wxPoint& pos = wxDefaultPosition,
141 const wxSize& size = wxDefaultSize,
142 long style = 0,
143 const wxString& name = wxPyGLCanvasNameStr,
144 int *attribList = NULL,
145 const wxPalette& palette = wxNullPalette );
146
147 // bool Create(wxWindow *parent, wxWindowID id,
148 // const wxPoint& pos, const wxSize& size, long style, const wxString& name);
149
150 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
151 %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
152
153 void SetCurrent();
154 void SetColour(const char *colour);
155 void SwapBuffers();
156
157 wxGLContext* GetContext();
158
159 #ifdef __WXMSW__
160 void SetupPixelFormat(int *attribList = NULL);
161 void SetupPalette(const wxPalette& palette);
162 wxPalette CreateDefaultPalette();
163 wxPalette* GetPalette();
164 #endif
165 };
166
167
168 //---------------------------------------------------------------------------
169
170 %init %{
171
172 wxClassInfo::CleanUpClasses();
173 wxClassInfo::InitializeClasses();
174
175 %}
176
177 //---------------------------------------------------------------------------
178 //---------------------------------------------------------------------------